IW-548: a non-repeatable valued flag given twice takes the last value everywhere #786

Merged
mph merged 13 commits from IW-548 into main 2026-10-11 07:08:12 +00:00
Member

Summary

A valued flag that is not declared repeatable and is given twice now resolves by one rule everywhere: the last value wins (decision on the issue: "1: a, 2: yes, same rules").

Defects fixed

  • Phase 1 (#784): CommandArgParser already kept the last value, but no test pinned it and no document stated it. Tests in CommandArgParserTest now pin last-wins for Flag.Required, Flag.Valued and Flag.Resolved; the parse doc comment and docs/api/CommandArgParser.md state the rule.
  • Phase 2 (#785): review-state write and review-state update read scalar flags with ReviewStateCliParser.extractFlag, which took the first occurrence, while the gate validated the last. So --version abc --version 3 wrote version 2, and --issue-id IW-1 --issue-id IW-2 updated the IW-1 card. extractFlag now takes the last occurrence; docs/api/ReviewStateCliParser.md is updated.

Repeatable flags and presence switches are unchanged.

Testing

  • Unit: CommandArgParserTest, ReviewStateCliParserTest, ReviewStateHarnessTest.
  • E2E: test/review-state.bats (a flag given twice on update stores the last value).
  • Pre-push hook: core compile, scalafix, unit tests, command compilation all pass.

Follow-up

The stale resolveIssueId example in docs/api/ReviewStateCliParser.md is filed on #440.

Release notes

See project-management/issues/IW-548/release-notes.md.

🤖 Generated with Claude Code

Closes #548

## Summary A valued flag that is not declared repeatable and is given twice now resolves by one rule everywhere: the **last value wins** (decision on the issue: "1: a, 2: yes, same rules"). ## Defects fixed - **Phase 1 (#784):** `CommandArgParser` already kept the last value, but no test pinned it and no document stated it. Tests in `CommandArgParserTest` now pin last-wins for `Flag.Required`, `Flag.Valued` and `Flag.Resolved`; the `parse` doc comment and `docs/api/CommandArgParser.md` state the rule. - **Phase 2 (#785):** `review-state write` and `review-state update` read scalar flags with `ReviewStateCliParser.extractFlag`, which took the first occurrence, while the gate validated the last. So `--version abc --version 3` wrote version 2, and `--issue-id IW-1 --issue-id IW-2` updated the IW-1 card. `extractFlag` now takes the last occurrence; `docs/api/ReviewStateCliParser.md` is updated. Repeatable flags and presence switches are unchanged. ## Testing - Unit: `CommandArgParserTest`, `ReviewStateCliParserTest`, `ReviewStateHarnessTest`. - E2E: `test/review-state.bats` (a flag given twice on `update` stores the last value). - Pre-push hook: core compile, scalafix, unit tests, command compilation all pass. ## Follow-up The stale `resolveIssueId` example in `docs/api/ReviewStateCliParser.md` is filed on #440. ## Release notes See `project-management/issues/IW-548/release-notes.md`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Closes #548
CommandArgParser: no test for a non-repeated flag given twice, and last-wins reverses the previous first-wins

Artifacts:
- analysis.md
- issue.md

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018fPBZaKwU97SaaHzVo3ePq
CommandArgParser: no test for a non-repeated flag given twice, and last-wins reverses the previous first-wins

Artifacts:
- tasks.md

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018fPBZaKwU97SaaHzVo3ePq
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018fPBZaKwU97SaaHzVo3ePq
Issue: IW-548
Phase: 1 - The last-wins rule for a non-repeatable valued flag is not pinned by a test or stated in a document

This commit marks the checkpoint for phase 1 context generation.
Use dx-fix IW-548 to return to this point.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The last-wins rule for a non-repeatable valued flag is not pinned by a test or stated in a document

Artifacts:
- phase-01-tasks.md

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Issue: IW-548
Phase: 2 - review-state write/update take the first occurrence of a scalar flag

This commit marks the checkpoint for phase 2 context generation.
Use dx-fix IW-548 to return to this point.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
review-state write/update take the first occurrence of a scalar flag

Artifacts:
- phase-02-tasks.md

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs(IW-548): add release notes
All checks were successful
CI / changes (pull_request) Successful in 5s
CI / contract (pull_request) Has been skipped
CI / format (pull_request) Successful in 10s
CI / lint (pull_request) Successful in 13s
CI / compile (pull_request) Successful in 1m39s
CI / dashboard-build (pull_request) Successful in 1m27s
CI / test (pull_request) Successful in 19m46s
bb4ef1c82d
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mph merged commit 6240265cc0 into main 2026-10-11 07:08:12 +00:00
Sign in to join this conversation.
No description provided.