IW-436: review-state CLI — fix five flag-parsing and update-semantics defects #499
No reviewers
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!499
Loading…
Reference in a new issue
No description provided.
Delete branch "IW-436"
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?
Fixes the five defects reported in IW-436, each in its own phase with its own reviewed PR.
Defects fixed
--checkpointselected a merge mode that wiped the whole checkpoint map, so a new phase destroyed every earlier phase's checkpointReviewStateCliParser.parseArrayModeReviewStateCliParser.parseCheckpointreview-state updatenever refreshedgit_sha, so the card's SHA named an older commit than the card describedReviewState.applyUpdate--needs-attention falseset the flag totrue— the exact opposite of the intent — and exited 0ReviewStateCliParserpresence flags--append-action/--append-badgeconcatenated blindly, so repeating one produced a duplicate button or badgeReviewStateUpdater.mergeArrayPhases 1 and 3 change a published CLI contract: a wrong invocation that was previously accepted now exits 1 with a message naming the remedy. That was settled in the analysis as a straight semantic flip — no deprecation period, no warning mode.
Deliberately not done
context_shastay as they are, and destroyed checkpoints are not recovered. The SHA check lives inparseCheckpointonly — putting it inReviewStateValidatoror the schema would fail the nextupdateof every still-corrupt card.mergeArray's newkeyFieldis given no key for artifacts: IW-206 holds twoReview Packetentries with the same label and different paths, so alabelkey would destroy one. Evidence and the 9-of-55 measurement are on #200, where the key decision belongs.git_shais refreshed on theupdatepath only. Six phase commands still write a stale SHA through theReviewStateOpsport. Accepted residual, now filed as #493.Testing
Unit tier throughout, TDD, every phase writing the failing test first and confirming it failed for the stated reason. Phase 1 also closed a standing coverage gap:
ReviewStateUpdaterTest.scalahad no checkpoint tests at all, which is why the map-wiping defect shipped and then destroyed checkpoints across three phases of IW-437. Replace, Append and Clear cases forphase_checkpointsare now covered.Phase 3's rejection tests assert the full error message rather than
isLeft, after mutation testing showed four separate mistakes stayed green underisLeft-only assertions. That rule is now written down indocs/testing.md.Lessons
All 13 entries in
LESSONS.mdare triaged and decided. Most already had a home on the tracker, so the usual outcome was evidence attached to an open issue rather than a new one.phase-commit --itemscomma splitting (#337)docs/testing.mdrule, and a correction to the phase-04 documents that had mismarked one reproduction as a guardRelease notes
project-management/issues/IW-436/release-notes.md(Czech).Issue: IW-436 Phase: 1 - `--checkpoint` corrupts and destroys the checkpoint map (defects 3 + 4) This commit marks the checkpoint for phase 1 context generation. Use dx-fix IW-436 to return to this point. 🤖 Generated with Claude Code`--checkpoint` corrupts and destroys the checkpoint map (defects 3 + 4) Artifacts: - phase-01-tasks.md 🤖 Generated with Claude CodeIssue: IW-436 Phase: 2 - `review-state update` does not refresh `git_sha` (defect 5) This commit marks the checkpoint for phase 2 context generation. Use dx-fix IW-436 to return to this point. 🤖 Generated with Claude CodeLESSONS.md entry 5. A set JDK_JAVA_OPTIONS makes every JVM Mill spawns print a NOTE line onto the daemon's RPC pipe, so the daemon fails to parse it as JSON and the launcher reports a crashed worker. Environment fault, not an iw-cli defect; workaround is `env -u JDK_JAVA_OPTIONS`. 🤖 Generated with Claude Code`review-state update` does not refresh `git_sha` (defect 5) Artifacts: - phase-02-tasks.md 🤖 Generated with Claude Codereview-state updaterefreshes git_sha (defect 5)- applyUpdate fills git_sha from HEAD via a shared currentGitSha helper; an explicit --git-sha still wins, and a git failure preserves the card's existing value - 6 harness cases and 1 BATS case covering refresh, override, --commit ordering and the preserve-on-failure branch - FakeGit gained a getHeadSha failure hook, closing a fixture gap that left a non-repository unsimulatable at every tier - docs/commands/review-state.md now states the real git_sha contract on update - LESSONS entries 5-7 record three findings left deliberately unfixed under RESOLVED 3 Phase 2 of IW-436. The pure core is untouched: core/model/, the ReviewStateOps port, ReviewStateAdapter, FakeReviewStateOps and the schema all show zero diff. 🤖 Generated with Claude Codereview-state updaterefreshes git_sha (defect 5)' (#484) from IW-436-phase-02 into IW-436 6e0242abd3Issue: IW-436 Phase: 3 - `--needs-attention false` sets the flag to `true` (defect 1) This commit marks the checkpoint for phase 3 context generation. Use dx-fix IW-436 to return to this point. Also records LESSONS entry 8: the pre-push hook reports a Bloop BSP timeout as a compile failure. 🤖 Generated with Claude Code`--needs-attention false` sets the flag to `true` (defect 1) Artifacts: - phase-03-tasks.md 🤖 Generated with Claude CodeCLI CONTRACT CHANGE. `--needs-attention` and the 13 clear flags are set-only. A value after one of them was previously read by nobody, so `--needs-attention false` wrote `needs_attention: true` at exit 0. Such an invocation now exits 1 and names the flag and the stray token. Per RESOLVED 2 this is a straight semantic flip: no warning mode, no deprecation period, no version floor. - `parsePresenceFlag` scans every occurrence, delegating to `extractRepeatedFlag` — an `indexOf` shape would pass `--needs-attention --status x --needs-attention false`. It covers all 14 flag names across 15 call sites, so the 13 sibling instances of the same defect close with it. - `--needs-attention` carries the remedy a user cannot guess: `--clear-needs-attention` removes the field. - 146 test lines added, none removed. Every rejection asserts the exact message, not `isLeft` — the message is the deliverable. - Docs: both clear-flag tables state the rule, and the table gains the two rows it was missing, `--clear-activity` and `--clear-workflow-type`. 🤖 Generated with Claude Code--needs-attention falsesets the flag totrue(defect 1)' (#488) from IW-436-phase-03 into IW-436 48ebe754aaIssue: IW-436 Phase: 4 - `--append-action` does not de-duplicate by id (defect 2) This commit marks the checkpoint for phase 4 context generation. Use dx-fix IW-436 to return to this point. 🤖 Generated with Claude CodeIssue: IW-436 Phase: 4 - `--append-action` and `--append-badge` do not de-duplicate (defect 2) The keyField parameter that fixes actions fixes badges at the same call site cost: Some("id") for available_actions, Some("label") for badges. Badges duplicate on 22 of 28 cards that carry them, no card holds one label with two type values, and badges render one-to-one in the card view - so a duplicate is visible noise and a label key loses nothing. Artifacts stay keyed None. IW-206 holds two artifacts both labelled "Review Packet" pointing at different files, so a label key would destroy one. Task lists stay None; no card uses the field. This widens the fix strategy's "actions only" recommendation, which is not one of RESOLVED 1-3. Its premise was that badge duplication is not reported; measurement supersedes that. Estimate raised 1-2h to 2-3h - the test count roughly doubles. 🤖 Generated with Claude Code`--append-action` and `--append-badge` do not de-duplicate (defect 2) Artifacts: - phase-04-tasks.md 🤖 Generated with Claude Code--append-actionand--append-badgede-duplicate (defect 2)--append-actionand--append-badgedo not de-duplicate (defect 2)' (#490) from IW-436-phase-04 into IW-436 6773f60dba