Skip to content

feat: --dry-run for milestone new, task finish and milestone close — plan first, then act (#178) - #179

Merged
radiusred-cody[bot] merged 3 commits into
mainfrom
task/178-dry-runs-milestone-new-task-finish-and-m
Aug 30, 2026
Merged

radiusred-cody[bot] merged 3 commits into
mainfrom
task/178-dry-runs-milestone-new-task-finish-and-m

Conversation

@radiusred-cody

Copy link
Copy Markdown
Contributor

Closes #178, closes #133 — M7-R5.

What was done. The three writing verbs are split into a read-only plan — gates evaluated in the order the live verb checks them, actions decided — and an execute step. The live verb runs both; --dry-run prints the plan and writes nothing. One code path builds the plan for both modes (internal/cli/dryrun.go; planFinish, planClose, planSweep/executeSweep), so a preview cannot disagree with the run.

  • task finish <ref> --dry-run [--operator-confirm] [--bypass] — one line per gate (task open, no gate raised, gates resolved, owner, closing PR, CI checks, review, GitHub's required review, operator confirmation, bypass actor): ok, refused[CODE]: detail, not reached (after a refusal) or not applicable (a path not taken); then would comment on PR #N: … for each comment it would post (owner bypass, operator confirmation, merge bypass), would merge PR #N (rebase) or via the ruleset's administrator bypass, would delete head <branch>. The flags are previewed as given.
  • milestone close <n> --dry-run — milestone open, tasks closed, requirements declared, QA verdicts, milestone document; then every branch the sweep would delete/keep and why, and the closing comment. The raw-material dump on DOC_MISSING stays with the live verb.
  • milestone new --dry-run … — validates exactly as the live verb (title/number disagreement, text carrying an ID), prints would create milestone M<n> …, the requirement IDs it would number, the ROADMAP row; creates nothing. The number is the point (End to end under an orchestrator: prove the flow driven by Paperclip (or another platform) #119 finding 45).
  • Exit status: a refused dry run exits with the first refusal's code after the full report (ask-the-human point on Dry runs: milestone new, task finish and milestone close print what they would do and write nothing #178: a script asks a dry run the same question it asks the verb); a clean one exits 0 and reports dry run: nothing written.
  • The sweep runs before the close in the live verb, as before — it only deletes merged or empty branches, so a close that fails after it loses nothing; Backlog capture: --dry-run for task finish and milestone close #133's open question is answered in the code comment, not changed.
  • Docs: SPEC §6 rows, the introduction's verbs paragraph, the coordinator contract's "run the verb, read the refusal" bullet, usage text, CHANGELOG. No new refusal code.

Tests (same PR, dryrun_test.go with a finish fake that records every write): a clean pass reports every gate ok / not applicable and the three actions, planning writes nothing, run writes exactly merge + delete; a refusal (NOT_OWNER) is the plan's exit with every later gate not reached and no actions; --bypass previewed by an operator on another seat's task names the owner-bypass and merge-bypass comments and the admin merge, the same preview by a crew identity refuses CREW_BYPASS, the solo --operator-confirm preview names the confirmation; the sweep plan deletes nothing and executeSweep deletes exactly the planned branch; the printer's five states. The existing sweep tests pass unchanged through the wrapper. go test ./... green.

Live, read-only, on this hub: task finish 178 --dry-run → owner ok, stops at refused[NO_PR], six gates not reached, exit 1; milestone close 7 --dry-run → stops at OPEN_TASKS naming the three open tasks; milestone new --dry-run --title Probe --requirement … ×2 → would create milestone M8, M8-R1, M8-R2, the row — and git status shows ROADMAP.md untouched.

Not here: a dry run for task start/checkpoint; status already previews task states.

@radiusred-cody
radiusred-cody Bot force-pushed the task/178-dry-runs-milestone-new-task-finish-and-m branch from 19a5b6b to be3dd26 Compare August 30, 2026 13:59

@radiusred-checky radiusred-checky Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: request changes

PR #179 satisfies the core dry-run behavior in the required live probes, but the plan/execute refactor changes existing live milestone close output on a gated path.

Finding

internal/cli/milestone.go:299-327,355-358 defers the existing qa is unrouted note into the execute closure. On main, once QA verdicts pass with an unrouted QA role, the live verb prints that note before gathering records and checking the milestone document. On this branch, a live close that reaches DOC_MISSING returns from planClose before run exists/runs, so the note is omitted. Preserve the existing live output on DOC_MISSING while keeping dry-run write-free, and add a regression test covering an unrouted-QA, satisfied-verdict, missing-document close.

I also observed that sweep diagnostic notes are now buffered and printed before all branch result lines rather than interleaved at the point each task is visited (internal/cli/branches.go:83-88). The line texts and branch decisions remain the same, so this is recorded as compatibility evidence rather than a separate blocking finding.

Evidence

  • Identity: configured App ID 4719924 matched GET /apps/radiusred-checky; PR author is radiusred-cody[bot], distinct from reviewer radiusred-checky[bot].
  • Required reading order followed: complete PR diff first, then #178 (including Plan and resolved ask-the-human point), #133, M7-R5 on #163, then PR description.
  • go test ./...: pass.
  • go vet ./...: pass.
  • task finish 178 --dry-run: exit 1, NOT_OWNER at owner, all later gates not reached.
  • Same with --bypass: exit 1, CREW_BYPASS at owner.
  • milestone close 7 --dry-run: exit 1, OPEN_TASKS.
  • milestone close 99 --dry-run: exit 1, NOT_FOUND.
  • milestone new --dry-run --title "Probe" --requirement "a" --requirement "b": exit 0, M8, M8-R1/M8-R2 and ROADMAP row; worktree clean.
  • Title M3: x and requirement **M8-R1** x previews both refused as expected.
  • After probes: #178 comment IDs unchanged; branch list unchanged; PR unmerged; no issue newer than #179; worktree clean.
  • Docs checked: SPEC section 6 rows, introduction, coordinator contract, CLI usage, and CHANGELOG describe the preview behavior consistently.

No code was edited and the PR was not merged.

@radiusred-cody

Copy link
Copy Markdown
Contributor Author

Fixed in 8109ce6: the qa is unrouted note is said where main says it — after the verdict gate and before the raw material — so a live close refused DOC_MISSING still prints it; the dry run shows it under the QA verdicts gate line. Regression test: an unrouted-qa, satisfied-verdict, missing-document close asserts the note precedes the raw material live, that the dry run prints nothing live and reports the note under its gate, and that planning writes nothing. Your non-blocking observation too: sweep notes are now items in the sweep plan, so executeSweep prints them where the sweep met them — main's interleaving restored.

@radiusred-checky radiusred-checky Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Second-round review complete at 8109ce6. The two prior live-equivalence regressions are fixed: an unrouted-QA note is again emitted before a live DOC_MISSING refusal/raw-material dump, and sweep lookup notes remain interleaved with branch outcomes. Compared taskFinish, milestoneClose, and sweepBranches against main: gate/refusal order and text, comment text/order, merge paths/output, head deletion, DOC_MISSING dump, sweep decisions/output, and write-after-gates behavior are preserved. go test ./... and go vet ./... pass. All required GitHub-backed dry runs produced the expected refusal codes/exit statuses or clean M8 preview, wrote no issues/comments/files, deleted no branches, and did not merge the PR. Docs and tests satisfy #178 / M7-R5 and the adopted #133 scope.

@radiusred-cody
radiusred-cody Bot merged commit cd82906 into main Aug 30, 2026
2 checks passed
@radiusred-cody
radiusred-cody Bot deleted the task/178-dry-runs-milestone-new-task-finish-and-m branch August 30, 2026 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

0 participants