Skip to content

Forge-cli v1 Sprint 6: pr.deliver macro + per-atom compute helpers#397

Merged
graysurf merged 3 commits into
mainfrom
feat/forge-cli-v1-sprint6-deliver
May 20, 2026
Merged

Forge-cli v1 Sprint 6: pr.deliver macro + per-atom compute helpers#397
graysurf merged 3 commits into
mainfrom
feat/forge-cli-v1-sprint6-deliver

Conversation

@graysurf
Copy link
Copy Markdown
Collaborator

Summary

Sprint 6 of the forge-cli v1 plan lands the pr deliver macro that composes Sprints 1–5's atoms into the canonical "open draft → CI green → ready → merge" flow. Each step calls the underlying atom's compute() helper (no subprocess re-spawn through a child binary) and the macro accumulates per-step envelopes under data.steps[].

Changes

  • Per-atom compute() helpers — added to auth.status / repo.view / pr.create / pr.wait-checks / pr.ready / pr.merge. Each helper runs the atom's pure business logic (validation chain + backend call + payload construction) and returns the typed payload without emitting an envelope. run_with keeps calling compute() internally before emitting so existing CLI behaviour is unchanged.
  • pr_wait_checks::WaitOutcome — new enum (Success / Failed / TimedOut) so the macro can branch on the poll's result instead of going through the envelope emitter. The CLI binary still emits the canonical envelopes; only the macro consumes the typed outcome.
  • crates/forge-cli/src/macros/pr_deliver.rs (new) — six-step orchestration. Each step appends to data.steps[] = { step, ok, schema_version, payload }. A failing step short-circuits — later steps are omitted from data.steps[] and the outer exit code equals the failing atom's exit code (no remapping). --no-merge skips pr.ready + pr.merge. --dry-run renders data.plan_steps[] listing every atom that would run; no backend is spawned.
  • CLI surface — adds pr deliver --kind feature|bug --title --body --body-file --head --base --method --reviewer --timeout --no-merge --allow-non-default-base. Regenerated bash + zsh completions.
  • Execution ledgerdocs/plans/forge-cli/forge-cli-execution-state.md records Tasks 6.1 + 6.2 with commit-SHA evidence; only Sprint 7 (parity harness) and Sprint 8 (wrapper + brew + tap) remain.

Test-First Evidence

  • Change classification: new feature (Sprint 6 macro + supporting refactor).
  • Failing test before fix: not applicable — Sprint 6 is greenfield macro work, not a bugfix.
  • Final validation:
    • cargo test -p nils-forge-cli — 219 lib + 67 integration green (was 216 + 63 at end of Sprint 5).
    • cargo clippy -p nils-forge-cli --all-targets -- -D warnings — clean.
    • bash scripts/ci/completion-flag-parity-audit.sh — pass; bash + zsh regenerated.
    • bash scripts/ci/cli-output-contract-lint.sh — pass.
    • bash scripts/ci/third-party-artifacts-audit.sh --strict — pass (no new deps).
  • Waiver reason: n/a.

Testing

  • pass: cargo test -p nils-forge-cli (286 total).
  • pass: cargo clippy -p nils-forge-cli --all-targets -- -D warnings.
  • pass: workspace CI gates (completion-flag-parity, cli-output-contract, third-party-artifacts-audit).
  • not run (defer to Sprint 7): full chain integration tests for the macro using gh + glab fixture pairs and the parity harness. Sprint 6 ships dry-run plan tests and the help-surface flag audit; full-chain coverage lands with Sprint 7.

Risk / Notes

  • The compute() helpers expose internal types that previously lived behind run_with envelope emission. They're pub so the macro can call them, but downstream callers should still prefer the run_with / run entrypoints — compute is documented as the macro's internal seam.
  • The macro currently passes --timeout from PrDeliverArgs to pr.wait-checks and uses a fixed 20-second polling interval. Sprint 7's parity harness will tighten the interval contract if needed.
  • Sprint 7 (parity harness + exit-code matrix + fixture corpus) is the next milestone and is now unblocked.

graysurf added 3 commits May 20, 2026 10:37
- Add compute() helpers to auth.status / repo.view / pr.create /
  pr.wait-checks / pr.ready / pr.merge so the macro captures each
  step's typed payload without re-spawning forge-cli as a child;
  pr.wait-checks also exposes WaitOutcome so the caller decides
  success / failed / timed_out instead of going through the envelope
  emitters.
- Add crates/forge-cli/src/macros/pr_deliver.rs orchestrating the six
  atoms per spec sequence with short-circuit on failure (later steps
  omitted from data.steps[], outer exit code matches the failing
  atom), plus a dry-run path that lists every step in data.plan_steps.
… ledger

- Update Task 6.1 / 6.2 to completed and refresh the session log so the
  ledger matches HEAD before opening the Sprint 6 PR; Sprint 7 (parity
  harness + exit-code matrix + fixture corpus) is the next milestone.
- Add three integration tests that exercise the macro's execute_sequence
  end to end against a comprehensive gh stub: no-merge (4 steps), full
  chain with merge_sha (6 steps), and short-circuit on pr.create
  title_too_long (DATA 65). Covers the previously test-only dry-run
  path through to the real subprocess wiring so workspace coverage
  stays above the strict 85 percent threshold after Sprint 6's macro
  refactor.
@github-actions
Copy link
Copy Markdown

Coverage

Total line coverage: 85.35% (75343/88276 lines hit).

@graysurf graysurf marked this pull request as ready for review May 20, 2026 02:56
@graysurf graysurf merged commit 15fcc73 into main May 20, 2026
11 checks passed
@graysurf graysurf deleted the feat/forge-cli-v1-sprint6-deliver branch May 20, 2026 02:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant