Type the taskLog rows that were landing empty (schema 282) - #1214
Merged
Conversation
Ported from 1.6 #1213. Schema 280 gave `logType` a DEFAULT of 'state' and that step said the existing writer could be left alone, since the default would cover it. It does not: a column default applies only when the column is absent from the INSERT, and FOGController::save() writes every declared field -- so TaskingElement::taskLog(), which has recorded task state changes since long before this column existed and sets no type, has been storing '' ever since the field was declared. Found on 1.6 against a live install, where one such row appeared as soon as a task was created; the code is identical here, so the defect is too. TaskLog::__construct() now types the row itself, guarded so that loading an existing row and saving it cannot retype it, and schema 282 repairs what the gap produced. Two assertions, both mutation-tested. Less visible on 1.5 than on 1.6, which has a pane that filters on the type; here it is the difference between a stored value that says what a row is and one that says nothing. Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Port of #1213's first half. (The other half is a UI tab 1.5 does not have.)
Schema 280 gave
logTypeaDEFAULT 'state', and that step said the existing writer could therefore be left alone. It cannot: a column default applies only when the column is absent from the INSERT, andFOGController::save()writes every declared field — soTaskingElement::taskLog(), which has recorded task state changes since long before this column existed and sets no type, has been storing''ever since the field was declared.Found on 1.6 against a live install, where such a row appeared the moment a task was created. The code here is identical, so the defect is too.
TaskLog::__construct()types the row itself, guarded on it being empty so loading an existing row and saving it cannot retype itLess visible on 1.5 than on 1.6, which has a pane that filters on the type; here it is simply the difference between a stored value that says what a row is and one that says nothing.
Two assertions, both mutation-tested. Full suite green.