Forge-cli v1 Sprint 6: pr.deliver macro + per-atom compute helpers#397
Merged
Conversation
- 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.
CoverageTotal line coverage: 85.35% (75343/88276 lines hit). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Sprint 6 of the forge-cli v1 plan lands the
pr delivermacro that composes Sprints 1–5's atoms into the canonical "open draft → CI green → ready → merge" flow. Each step calls the underlying atom'scompute()helper (no subprocess re-spawn through a child binary) and the macro accumulates per-step envelopes underdata.steps[].Changes
compute()helpers — added toauth.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_withkeeps callingcompute()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 todata.steps[] = { step, ok, schema_version, payload }. A failing step short-circuits — later steps are omitted fromdata.steps[]and the outer exit code equals the failing atom's exit code (no remapping).--no-mergeskipspr.ready+pr.merge.--dry-runrendersdata.plan_steps[]listing every atom that would run; no backend is spawned.pr deliver --kind feature|bug --title --body --body-file --head --base --method --reviewer --timeout --no-merge --allow-non-default-base. Regenerated bash + zsh completions.docs/plans/forge-cli/forge-cli-execution-state.mdrecords Tasks 6.1 + 6.2 with commit-SHA evidence; only Sprint 7 (parity harness) and Sprint 8 (wrapper + brew + tap) remain.Test-First Evidence
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).Testing
cargo test -p nils-forge-cli(286 total).cargo clippy -p nils-forge-cli --all-targets -- -D warnings.Risk / Notes
compute()helpers expose internal types that previously lived behindrun_withenvelope emission. They'repubso the macro can call them, but downstream callers should still prefer therun_with/runentrypoints —computeis documented as the macro's internal seam.--timeoutfrom PrDeliverArgs topr.wait-checksand uses a fixed 20-second polling interval. Sprint 7's parity harness will tighten the interval contract if needed.