IW-712: review-state card location: route on the key kind, report pointer read errors, keep the routing pure #774

Merged
mph merged 10 commits from IW-712 into main 2026-10-10 18:38:06 +00:00
Member

Summary

iw review-state path, write, update and iw ci-gate now find the review-state card with one pure rule, ReviewStateLocation.cardLocations (core/model). The rule routes on the key kind (issue or effort), --slice and the .active-slice pointer. The cwd is no longer an input.

Changes

  • write/update --issue-id <effort-slug> always use the effort's active slice card. When there is no active slice, they exit 1 and do not write issues/<slug>.json.
  • A .active-slice that exists but cannot be read gives "Cannot read project-management/.active-slice: " and a remedy, not "missing or empty".
  • ci-gate --issue-id without --input parses the key in the same way as review-state (iw-42 → IW-42; a value that is not a key exits 1). With --input, the behavior does not change.
  • The path subcommand moves to its own object (ReviewStatePathCommand). Its CLI contract (stdout, stderr, exit codes, docs) does not change.
  • WorktreeKeyResolver.fromFlagOrBranch holds the shared key parsing.

Out of scope, filed: the dashboard's own copy of the rule (#773); four small core fixes (comment on #762).

Testing

  • Unit: 11 cardLocations tests in ReviewStateLocationTest.
  • Harness: 7 in ReviewStateHarnessTest, 3 in CiGateCommandHarnessTest.
  • E2E: 1 in test/review-state.bats.
  • Phase PR #772 passed CI on the full suite.

Review packet: project-management/issues/IW-712/review-packet.md.

Release notes

Jedno pravidlo pro nalezení karty stavu práce

Issue: IW-712
Datum: 2026-10-08

Příkazy iw review-state write, iw review-state update, iw review-state path a iw ci-gate hledaly kartu stavu práce každý trochu jinak. Výsledek mohl záviset i na tom, v jakém adresáři byl příkaz spuštěn. Nyní všechny čtyři používají jedno společné pravidlo, které se řídí pouze klíčem práce (číslo úkolu, nebo název efortu) a případně zadaným dílem (slice).

Co se mění pro uživatele:

  • write, update a ci-gate s --issue-id <název-efortu> vždy použijí kartu aktivního dílu tohoto efortu. Pokud pro daný efort není nalezen aktivní díl, příkaz skončí chybou (exit 1). Už nikdy nezapíše kartu issues/<název-efortu>.json.
  • Soubor .active-slice, který existuje, ale nejde přečíst, se nově hlásí jako „Cannot read project-management/.active-slice“ i s důvodem, ne jako „missing or empty“.
  • ci-gate --issue-id bez --input se zpracuje stejně jako v review-state: iw-42 se změní na IW-42 a hodnota, která není klíčem, skončí chybou Invalid --issue-id (exit 1). S --input se nic nemění.
  • Příkaz iw review-state path se navenek nemění: výstup, chybová hlášení a návratové kódy zůstávají stejné, takže nástroje, které karty čtou přes něj (kanon, dev-docs#439), fungují beze změny.

Closes #712

🤖 Generated with Claude Code

## Summary `iw review-state path`, `write`, `update` and `iw ci-gate` now find the review-state card with one pure rule, `ReviewStateLocation.cardLocations` (`core/model`). The rule routes on the key kind (issue or effort), `--slice` and the `.active-slice` pointer. The cwd is no longer an input. ## Changes - `write`/`update --issue-id <effort-slug>` always use the effort's active slice card. When there is no active slice, they exit 1 and do not write `issues/<slug>.json`. - A `.active-slice` that exists but cannot be read gives "Cannot read project-management/.active-slice: <reason>" and a remedy, not "missing or empty". - `ci-gate --issue-id` without `--input` parses the key in the same way as `review-state` (`iw-42` → `IW-42`; a value that is not a key exits 1). With `--input`, the behavior does not change. - The `path` subcommand moves to its own object (`ReviewStatePathCommand`). Its CLI contract (stdout, stderr, exit codes, docs) does not change. - `WorktreeKeyResolver.fromFlagOrBranch` holds the shared key parsing. Out of scope, filed: the dashboard's own copy of the rule (#773); four small core fixes (comment on #762). ## Testing - Unit: 11 `cardLocations` tests in `ReviewStateLocationTest`. - Harness: 7 in `ReviewStateHarnessTest`, 3 in `CiGateCommandHarnessTest`. - E2E: 1 in `test/review-state.bats`. - Phase PR #772 passed CI on the full suite. Review packet: `project-management/issues/IW-712/review-packet.md`. ## Release notes # Jedno pravidlo pro nalezení karty stavu práce **Issue:** IW-712 **Datum:** 2026-10-08 Příkazy `iw review-state write`, `iw review-state update`, `iw review-state path` a `iw ci-gate` hledaly kartu stavu práce každý trochu jinak. Výsledek mohl záviset i na tom, v jakém adresáři byl příkaz spuštěn. Nyní všechny čtyři používají jedno společné pravidlo, které se řídí pouze klíčem práce (číslo úkolu, nebo název efortu) a případně zadaným dílem (slice). Co se mění pro uživatele: - `write`, `update` a `ci-gate` s `--issue-id <název-efortu>` vždy použijí kartu aktivního dílu tohoto efortu. Pokud pro daný efort není nalezen aktivní díl, příkaz skončí chybou (exit 1). Už nikdy nezapíše kartu `issues/<název-efortu>.json`. - Soubor `.active-slice`, který existuje, ale nejde přečíst, se nově hlásí jako „Cannot read project-management/.active-slice“ i s důvodem, ne jako „missing or empty“. - `ci-gate --issue-id` bez `--input` se zpracuje stejně jako v `review-state`: `iw-42` se změní na `IW-42` a hodnota, která není klíčem, skončí chybou `Invalid --issue-id` (exit 1). S `--input` se nic nemění. - Příkaz `iw review-state path` se navenek nemění: výstup, chybová hlášení a návratové kódy zůstávají stejné, takže nástroje, které karty čtou přes něj (kanon, dev-docs#439), fungují beze změny. Closes #712 🤖 Generated with [Claude Code](https://claude.com/claude-code)
review-state card location: route on the key kind, report pointer read errors, keep the routing pure

Artifacts:
- analysis.md
- issue.md

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VuB38s4FzXfyuePZHx32w7
review-state card location: route on the key kind, report pointer read errors, keep the routing pure

Artifacts:
- tasks.md

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VuB38s4FzXfyuePZHx32w7
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VuB38s4FzXfyuePZHx32w7
Issue: IW-712
Phase: 1 - Card location: one pure rule + path command object

This commit marks the checkpoint for phase 1 context generation.
Use wf-implement IW-712 to return to this point.

Context review decisions applied to analysis.md: forKey replaces
resolveFrom (ci-gate handles --input itself); WorktreeKey.md documents
fromFlagOrBranch instead of a separate WorktreeKeyResolver.md page;
the issue + --slice case now reports a state-root failure first.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Card location: one pure rule + path command object

Artifacts:
- phase-01-tasks.md

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Dashboard rule copy -> #773; four small core fixes -> collector #762.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs(IW-712): review packet for the final PR
All checks were successful
CI / changes (pull_request) Successful in 5s
CI / contract (pull_request) Has been skipped
CI / format (pull_request) Successful in 11s
CI / lint (pull_request) Successful in 14s
CI / compile (pull_request) Successful in 1m36s
CI / dashboard-build (pull_request) Successful in 1m24s
CI / test (pull_request) Successful in 19m13s
d1baa8e81b
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mph merged commit 132a5cf0e9 into main 2026-10-10 18:38:06 +00:00
Sign in to join this conversation.
No description provided.