Skip to content

Retention plan follow-ups: re-plan hint, -r, rust-only list (server#522) - #179

Merged
rmcdaniel merged 1 commit into
mainfrom
general/cli-522-retention-followups
Nov 26, 2026
Merged

rmcdaniel merged 1 commit into
mainfrom
general/cli-522-retention-followups

Conversation

@rmcdaniel

Copy link
Copy Markdown
Member

This fixes the three non-blocking review items from #178 (durable-workflow/server#522).

  1. The re-plan hint now repeats the attempted proposal. After a stale (409 retention_policy_revision_stale) or mismatched (409 retention_plan_revision_mismatch) namespace:retention-apply, the suggested command used to be a bare dw namespace:retention-plan <name>. Run as written, that plans the current policy against itself.
    • It now includes the apply's --retention-mode and --retention. When the apply came from --plan-file, it uses the plan's proposed policy instead, for example dw namespace:retention-plan billing --retention-mode=bounded --retention=7.
    • ErrorContext has a new retention_replan field, built from the apply's own input by retention_plan::replan_command. It appears both as the human Try: line and as recommendations[0].command in the JSON envelope.
  2. -r works for --retention on both new commands, the same as on namespace:create and namespace:update. Nothing else in either command uses -r. I updated src/catalog.json and parity/catalog-additions.json (shortcut and synopsis) and added a -r example to the plan's help.
  3. The rust/README.md list of commands with no 2.x equivalent is up to date. It now lists every rust_only command with its issue: cli#60, Server #522, #577, #519, #520 and #1131, and Show which open runs still depend on a legacy version branch .github#220. It also notes that test_parity.py checks this list against the catalog.

docs/cli-reference.md now mentions -r and the re-plan hint.

Local checks (Rust 1.99, Docker)

  • cargo fmt --check: pass
  • cargo clippy --locked --all-targets -- -D warnings: pass
  • cargo test --test namespace_retention: 10/10 pass. The new re-plan test covers explicit options with -r, a forever proposal, and bounded and forever plan files, in both human and JSON output. The refusal test now expects the attempted --retention, and there is a new -r plan request.
  • cargo test --bin dw: 139 pass. queues_workers, namespace_list and system_debug: pass.
  • python3 -m unittest test_parity: 27/27 pass.

🤖 Generated with Claude Code

Review follow-ups to #178:

- After a stale or mismatched namespace:retention-apply, the suggested
  re-plan command repeats the proposal the apply tried: its
  --retention-mode and --retention, or the proposed policy in its
  --plan-file. A bare "dw namespace:retention-plan <name>" would plan the
  current policy against itself. ErrorContext carries the command, built
  from the apply's own input.
- namespace:retention-plan and namespace:retention-apply accept -r for
  --retention, as namespace:create and namespace:update do (catalog and
  catalog-additions).
- rust/README lists every Rust-only command with its issue (cli#60,
  Server #522, #577, #519, #520, #1131, .github#220).

Tests: a re-plan hint test (options, -r, forever, and both kinds of plan
file, human and JSON), the refusal test now expects the attempted
--retention, and a -r plan request.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@rmcdaniel

Copy link
Copy Markdown
Member Author

Independent review: PASS at head 56ce9f1

The branch is already up to date with main (it is based on the #178 merge, e6072f3). I reviewed this PR's own changes against e6072f3.

What I verified:

  • Re-plan hint. retention_plan::replan_command builds the suggested dw namespace:retention-plan <name> from the apply's own input. With explicit options it reuses proposal(), so it repeats --retention-mode and --retention exactly as attempted and leaves out what was left out. With --plan-file it reuses plan_file_body(), so it repeats the file's resolved proposal (bounded mode and days, or forever with no days). This is the same parsing the apply sends, so the hint and the request can't drift apart. main.rs sets ErrorContext.retention_replan only for namespace:retention-apply. retention_plan_recommendation uses it for both the stale and the mismatch refusals and falls back to the bare command otherwise. The human Try: line still goes through the existing display escaping. The JSON recommendations[0].command carries the same string. All three ErrorContext constructions set the new field.
  • -r. The shortcut is added to --retention on both commands, identically in src/catalog.json and parity/catalog-additions.json (shortcut, synopsis and one help example). It doesn't collide with any other option on either command. It matches namespace:create and namespace:update.
  • rust/README.md. The Rust-only list now matches every rust_only command in the catalog, the same set test_parity.py asserts, with the right issue for each.
  • Tests. the_replan_hint_repeats_the_proposal_the_apply_tried covers explicit options with -r, explicit forever, and bounded and forever plan files, in both human and JSON output. It asserts the whole command up to the line end, so a hint with an extra or missing option fails. The refusal test now expects --retention=7, and a new case checks that -r 7 sends retention_days: 7. Each of these fails on Add namespace:retention-plan and namespace:retention-apply (server#522) #178's code.
  • docs/cli-reference.md describes -r and the re-plan hint correctly.
  • CI: all 32 checks pass at 56ce9f1.

No findings.

@rmcdaniel
rmcdaniel merged commit e53379b into main Nov 26, 2026
32 checks passed
@rmcdaniel
rmcdaniel deleted the general/cli-522-retention-followups branch November 26, 2026 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant