review-state: a context_sha that is not a git SHA is accepted silently #464
Labels
No labels
agent-ready
bug
contract
documentation
duplicate
enhancement
good first issue
help wanted
invalid
needs-human
needs-input
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
iterative-works/iw-cli#464
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found triaging IW-437.
ReviewStateValidator (core/model/ReviewStateValidator.scala:368-378) checks only that a phase checkpoint's context_sha is a string. Any string passes.
ReviewStateCliParser.parseCheckpoint (core/model/ReviewStateCliParser.scala:75-79) splits --checkpoint on the FIRST colon only and stores the remainder verbatim (core/model/ReviewStateUpdater.scala:198,207). So a wrong invocation such as
writes context_sha = "context_sha=0f64de40...". The card validates. The corruption is visible only by reading the file back. Anything that later resolves a checkpoint to a commit (ag-revert, a dx-fix/wf-implement resume that reads phase_checkpoints) gets a reference git cannot resolve.
This happened twice in one issue (IW-437 phases 1 and 2) from an unchanged command snippet, and was caught both times only by reading the written card back.
PROPOSED FIX: reject a context_sha that is not 7-40 hexadecimal characters, so a wrong invocation fails loudly instead of writing a dead reference. Same "a typo must fail loudly" principle IW-423 raised for --needs-attention.
The snippet defect itself is filed against kanon as dev-docs#187.
Duplicate. #436 already covers this as its defect 3, and #436 places the fix better — in
parseCheckpoint, where a bad value can be rejected at parse time, rather than in the validator after it is written.#436 defect 4 also covers the second half of the same problem, which this issue did not mention:
--checkpointmerges withArrayMergeMode.Replaceand therefore wipes every earlier phase entry. #436 proposes making append the default, with an explicit--clear-checkpointsfor replace. That is the right shape.Evidence to carry over from IW-437, which hit both defects at every one of its three phases:
{1: ...}at phase 1, then{2: ...}alone at phase 2 (f294ed1), then{3: ...}alone at phase 3 (349a04a). Two checkpoints were destroyed before anyone looked.0f64de40) and phase 2 (b66e166e), each verified to resolve to its "Phase N: context ready" commit, then re-appended alongside phase 3 (ceb86105).The caller-side snippet fix is tracked at dev-docs#187 (and note dev-docs#183).
Closing in favour of #436.