Repository navigation
fix(models): numbers of union fields render as stored, and literals of plain enum members write - #126
Merged
Merged
Conversation
…f plain enum members write
Key templates rendered Decimal values of union and Any fields as given
(PRICE#1.50 for Decimal("1.50")), while the instance read back rendered
PRICE#1.5, so its save() raised "key changed". They now render numbers
of such fields as the field decodes them after DynamoDB normalized them.
Literal[Color.RED] with a plain Enum member passed validation and
failed to write: the literal codec now stores the member's value and
reads back the member. IntCodec.validate() raised OverflowError and
InvalidOperation for infinite and signaling NaN Decimals instead of
a validation error.
Fixes #100
Co-authored-by: Carl Oscar Aaro <[email protected]>
|
fctl reviewed The template rendering and On lines the diff doesn't show:
Reviewed by fctl · Review agent settings |
…mbers' values Collections copied the elements of literal fields without encoding them, so a list[Literal[Shade.DARK]] kept the member and the write failed. Co-authored-by: Carl Oscar Aaro <[email protected]>
Contributor
Author
|
Fixed in da62fb3: |
kalaspuff
pushed a commit
to hyperstructure/fctl
that referenced
this pull request
Oct 31, 2026
…364) ## Summary A review's findings on lines the diff doesn't show go in its summary comment, not in threads of their own. A later review had no way to resolve them: `fctl review threads` didn't list them, and `resolved` took only thread ids. So a summary that held one never counted as addressed, and stayed shown after its issue was fixed. Inline findings already get resolved and their summaries hidden. kalaspuff/dynamoxy#126 shows the problem: the second review saw the fix but said "it has no thread to resolve". Now: - `fctl review threads` lists each finding in an earlier summary's text, with an id made of the summary's id and the finding's number there (`IC_…#1`), its path and line. It shows as resolved once fixed, or once the summary is hidden. - `resolved` in `fctl review submit` takes those ids. The agent's instructions, the review agent's AGENTS.md, `fctl review submit --help` and the docs say so. - The later review strikes through the finding's title in the summary and adds a "Fixed in `sha`." line with the agent's note. It records the finding's number in the summary's hidden note and counts it in the "Addressed as of …" line. Once every issue in the summary is addressed, it hides the summary as outdated, as for threads. If GitHub refuses the edit, the summary stays shown. - Findings in the text of summaries still shown count as still open, like open threads. So a review with nothing new to report and such a finding open gets a neutral check, not a passed one. - New summaries' notes record how many findings their text holds (`in_text`). Without that, a list the agent wrote in its own summary text could pass for fctl's. Older summaries, like dynamoxy#126's, are read from their list, up to the number of issues found. - Restating an earlier summary no longer removes fctl's marks from the text the agent wrote. A finding that quoted one could otherwise lose text, or be merged with the next finding, and the wrong finding could be struck through. I verified it with unit tests in `fctl_domain::reviews`: listing, ids, marking, standing and hiding, a summary in the exact older format, a finding that quotes fctl's mark, and a list faked in the agent's text. I also rendered a marked summary with GitHub's Markdown API to check that the struck-through title and the "Fixed in" line show as intended. I didn't run a review end to end against GitHub. ## Worth confirming - **Decision:** A fixed finding stays in the summary with its title struck through and a "Fixed in" line under it, rather than being removed. This mirrors how fixed inline comments read. - **Decision:** An open finding in a summary's text keeps a review's check neutral until a later review finds it fixed or someone hides the summary. People can't resolve it any other way, since it has no thread. Pull requests whose old summaries hold such findings will see neutral checks where they passed before, until those findings are marked fixed. [fctl session](https://app.fctl.sh/s/ses_01M67W6EZG7WRWM4ZSF3V470X0) <!-- FCTL_REVIEW_SUMMARY --> --- > [!NOTE] > **Low risk.** It changes how fctl's own review comments are restated and counted, in the control plane's review posting code; a mistake would show as a wrong review outcome or a summary left unmarked, not as lost data. > > **What it does.** Findings that an earlier review put in its summary's text, because their lines weren't in the diff, can now be resolved by a later review through ids like `IC_…#1`, listed by `fctl review threads`. The summary marks them fixed with a strike-through and a note, and hides itself once everything in it is addressed. Since the last review it keeps the agent's text whole when restating a summary, keeps a summary shown when its edit failed, and counts unfixed in-text findings as still open, so the check stays neutral. The CLI help, docs and the review agent's prompt now name the new ids. > > **Review outcome.** A re-review with no new findings now ends neutral instead of passing while a shown summary still holds unfixed findings in its text. > > <sub>[fctl review](https://app.fctl.sh/s/ses_01M67X1RFBXSXMWH1WR6GXP12F)'s first look at [`d239f0d`](d239f0d) · 8 files, +624 −75 · [Review agent settings](https://app.fctl.sh/p/fctl?tab=reviews)</sub> <!-- /FCTL_REVIEW_SUMMARY --> --------- Co-authored-by: fctl-sh[bot] <fctl-sh[bot]@users.noreply.github.com>
Contributor
Author
|
Stack of 10 pull requests, merged in this order with "Squash and merge":
|
This was referenced Oct 31, 2026
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.
What and why
Three of the smaller codec issues of #100 still reproduced on main (the fourth,
update(M.tags.set(set()))andM.tags.remove()on a set field, was fixed by #113):Decimalvalues of union andAnyfields as given. Withamount: Attr[Decimal | str]andsk="PRICE#{amount}",Decimal("1.50")wrotePRICE#1.50, the instance read back renderedPRICE#1.5, and itssave()raised "key changed". Templates now render a number of such a field as the field reads it back after DynamoDB normalized it, as they already did forDecimalfields (ADR 0013):Decimal("1.50")as1.5, and2.0in anint | floatfield as2.Literal[Color.RED]with a member of a plainEnumpassed validation and then failed to write ("cannot store a value of type Color"). The literal codec now stores the member's value (also in key templates and expressions) and reads back the member, as anEnumfield does. A literal member whose value DynamoDB cannot store (a tuple) is aTypeErrorwhen the model is declared.intfields raisedOverflowErrorforDecimal("Infinity")anddecimal.InvalidOperationforDecimal("sNaN"), instead of the validation error other values get.Verified with unit tests of the codecs and of template rendering, which fail without the fix, and integration tests on the in-memory backend and MiniStack: a plain-enum literal in an attribute, a key template, an index key and a filter, and a
Decimal | strsort key that a loaded instance saves back to the same item.make checkpasses.Fixes #100
Checklist
make checkpasses locally (lint, types, clippy, consistency, tests)Worth confirming
Literalof plainEnummembers holds the member in instances (like anEnumfield) and accepts only the member, not its bare value, when validating; members of(str, Enum)mixins stay plain values as before.get(amount=Decimal("1.50"))) now addressPRICE#1.5, so they no longer find items written before withPRICE#1.50; such items could not be saved back before either.fctl session
Note
Medium risk. It changes how number values of union and
Anyfields render into key templates and howLiteralfields of plainEnummembers are stored, which feeds keys and stored data, though only for fields that did not work or round-trip before.What it does. Fixes three codec problems from #100. Key templates now render numbers of union and
Anyfields as DynamoDB reads them back (Decimal("1.50")as1.5), so a loaded item'ssave()no longer reports a changed key.Literalfields of plainEnummembers now store the member's value and read back the member, also inside lists, sets and maps, andintfields give a validation error forDecimal("Infinity")andDecimal("sNaN")instead of crashing.Key rendering change. Lookups by a non-canonical number of a union field (
get(amount=Decimal("1.50"))) now addressPRICE#1.5, so items written earlier underPRICE#1.50are no longer found and need the move that ADR 0013 describes.fctl review's first look at
da62fb3· 9 files, +222 −18 · Review agent settings