Skip to content

feat(output): start first-pr and pr-summary from a carried review-card repair - #3960

Merged
EffortlessSteven merged 11 commits into
mainfrom
claude/onboarding-first-pr-repair-start
Sep 24, 2026
Merged

EffortlessSteven merged 11 commits into
mainfrom
claude/onboarding-first-pr-repair-start

Conversation

@claude

@claude claude Bot commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

Requested by Steven · project thread

Stacked on #3936. The base is claude/onboarding-gate-repair-route. Once #3936 merges, this retargets to main.

Before: generated CI builds the gap ledger from repo-exposure, and every record in that ledger is repo-scoped. So for a Rust PR ripr first-pr always fell to no_action, even when target/ripr/review/comments.json held a card with a repair start. first-pr only checked that the review-comments file existed. pr-summary had no repair start to show.

After: when the ledger selects nothing, start-here selects the first actionable review card that carries llm_guidance.repair_command. It checks comments[] first, then summary_only[].

  • selected.repair_command carries that command unchanged.
  • The CLI summary, the Markdown and the Bash/PowerShell command block show "Start repair" before Verify.
  • pr-summary copies it into top_repair.repair_command, lists it first under local reproduction, and renders a "start repair" line before verify.
  • When no card is used, the no_action reason says why. When the cards are missing or were rendered from the gap ledger, it also names the seam-level route: ripr review-comments --root … --base … --head … --out ….

How: every field of a card selection comes from that one card, so a card is never mixed with a ledger record, and first-pr never builds agent repair itself. The card is used only when the report has tool = ripr and status = advisory and records this invocation's root, base and head. Otherwise the result fails closed to no_action.

Summary

Swarm / Source Boundary

  • ordinary feature, analyzer, editor, docs, spec, fixture, badge, dependency, or repo-ops development for ripr-swarm

Source-of-truth Links

Spec: RIPR-SPEC-0075 (updated); RIPR-SPEC-0087 §8
Docs: docs/OUTPUT_SCHEMA.md, docs/FIRST_PR_WORKFLOW.md
Issue: #3906 (partial). Parent: #3797

Scope Classification

  • One public contract

Production delta:

  • an additive selected.repair_command on start-here, present only when carried;
  • top_repair.repair_command on pr-summary;
  • the human "Start repair" lines;
  • receipt_path and agent_packet_command become null on a card selection.

Ledger-selected packets are byte-identical to before, so no golden changed.

Single acceptance criterion: start-here and pr-summary offer the repair start exactly when a current review card carries one, and never build one.

Non-goals:

  • no change to ledger selection, which still wins when it finds a gap;
  • no change to the CI template or the VS Code projection (see Follow-ups).

Decisions (overrule on review)

  • selected.state stays top_gap. The VS Code projection reports any unknown state as unsupportedSchema, and pr-summary, the CI jq summary and the xtask consumers all key on top_gap. repair.route is a new fixed label, AgentRepairTransaction, because cards carry no route kind.
  • The command is not in commands. VS Code checks every value in commands against an allowlist (FIRST_PR_SAFE_COMMAND_PREFIXES) and fails the whole packet (unsafeCommand) on anything else. ripr agent repair is not on that list. The card's verify and receipt commands (ripr agent verify, ripr agent receipt) are on it, so the editor still projects a card selection.
  • language is set to rust/stable. It is the one field not read from the card. The card producer only builds a repair start from a classified Rust seam.
  • receipt_path and agent_packet_command are null on a card selection. The card is not a ledger gap, so agent packet --gap-id does not apply, and first-pr does not parse commands for paths.
  • pr-summary never reads review comments. It copies start-here's selected.repair_command, so it cannot pair a card with a different top gap.

Follow-ups (not in this PR)

  • Non-main base PRs. CI runs ripr first-pr without --base, so it uses origin/main, while review-comments uses origin/${{ github.base_ref }}. On PRs whose base is not main, the currentness guard correctly rejects the card and first-pr under-emits with the recovery reason. Fixing it means passing --base in the template, and that step also runs where base_ref is empty. That is a separate template decision.
  • The editor does not show selected.repair_command yet. That needs an allowlist entry and a projection field in editors/vscode.
  • cargo xtask ripr-pr-summary's legacy summary.md path (xtask/src/reports/pr_evidence_summary/render.rs) has its own copy of render_start_here_top_gap and does not print the line. Its JSON goes through the crate and carries the field.

Support-tier Impact

  • changes a README, release, docs, CLI, JSON, editor, CI, or package claim

Claim/proof notes: OUTPUT_SCHEMA.md (the start-here and pr-evidence-summary contracts), FIRST_PR_WORKFLOW.md and RIPR-SPEC-0075's field tables are updated. Both new fields are omitted when absent.

Policy Impact

  • none (no goldens or hash-bound artifacts changed)

Proof

Run on f4910d059 (on #3936's head fcf2e0f72), Linux, CARGO_INCREMENTAL=0:

  • cargo fmt --check: exit 0
  • cargo test -p ripr --lib: 5313 passed
  • cargo test -p ripr --tests: every binary passed on the --no-fail-fast rerun.
  • cargo xtask goldens check, check-output-contracts, check-fixture-contracts: exit 0
  • cargo clippy -p ripr --all-targets -- -D warnings: exit 0
  • cargo xtask precommit: exit 0

New tests:

  • review_card_repair_start_is_carried_when_the_ledger_selects_nothing runs end to end: the real write_first_pr, then build_pr_evidence_summary on the packet it writes.
    • Preconditions checked: the ledger yields no top gap, and card A lacks a command while card B carries one with a non-default --root crates/pricing.
    • Asserts: B's command is copied exactly and every other field is B's. There is no agent_packet and no commands.repair. "Start repair" precedes Verify in all three renderings. pr-summary's top_repair.repair_command and local_reproduction_commands[0] equal the command.
  • review_card_without_repair_start_stays_no_action: an actionable card with a seam id but no command gives no_action, and "agent repair" appears nowhere.
  • ledger_top_gap_keeps_its_route_beside_an_eligible_card: the ledger record still wins, keeps its --gap-id packet and carries no repair_command.
  • review_card_repair_start_fails_closed_on_stale_or_missing_reports covers:
    • a base mismatch;
    • incomplete status;
    • a root mismatch;
    • a report scoped to the gap ledger;
    • a missing file, which names the seam route.
  • start_here_repair_command_is_carried_into_top_repair (pr_summary/json.rs) plus its negative case, where no command is rebuilt from seam_id.
  • start_here_top_gap_leads_with_the_carried_repair_start (pr_summary/render.rs).

Negative controls, each reverted and checked restored with cmp:

  • first-pr's copied value forced to None: the end-to-end test fails.
  • first-pr builds the command from seam_id: 3 tests fail.
  • pr-summary's copied value forced to None: 2 tests fail.
  • pr-summary builds the command from seam_id: 2 tests fail.

Not run: the Windows lane.

Claim Boundary

May claim: first-pr/start-here and pr-summary carry a current review card's repair start and never build one.

Not yet: the non-main-base CI case, the editor projection, and the xtask legacy summary (see Follow-ups). No first_successful_pr corpus fixture covers the card path; the proof is the tests inside the crate.

Rollback

Revert this PR's commit.

Spec-Test-Code Traceability

  • Spec: RIPR-SPEC-0075
  • Tests: listed under Proof
  • Code: crates/ripr/src/output/first_pr.rs, crates/ripr/src/output/first_pr/rendering.rs, crates/ripr/src/app/pr_summary/{model,json,render}.rs

Static Language Check

  • Static output avoids killed, survived, untested, proven, and adequate.

CI Economics

n/a

Engineering Check

  • No new panic, unwrap, expect, todo, or unimplemented in production code.
  • No new panic, unwrap, expect, todo, or unimplemented in tests.
  • Public JSON/schema changes are documented.

Gates

  • cargo fmt --check
  • cargo clippy -p ripr --all-targets -- -D warnings
  • cargo xtask precommit

🤖 Generated with Claude Code

https://claude.ai/code/session_01JR38133FoyEXqWZtnC9UeK


Generated by Claude Code

…outes

Where a review card, gate repair route, or inline PR comment already
names a seam that passes the repair-packet flip, lead with
`ripr agent repair --root . --seam-id <id> --phase before` instead of
the snapshot verify command. The command is computed once in
evidence_record::canonical_repair_command_for, gated on
repair_packet_eligibility(entry).eligible(), and carried (never
derived) by review_comments, the gate repair route, and the inline
comment publisher. Non-actionable routes and gap-record routes emit
nothing and keep the existing verify guidance.

Refs #3906 (outcome 3, gate and repair-card surfaces).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JR38133FoyEXqWZtnC9UeK
…e flip

The repo-exposure evidence record, the dogfood gate-adoption receipts, and
the gate-decision verification fixture now carry repair_command. The
first-useful-action unchanged-after-attempt snapshots are regenerated
through the corpus test's own normalizer, and the verify and receipt
artifacts are rebound to the new snapshot bytes; their movement is
unchanged. The evidence-record test now calls the builder with an
actionable state directly, so removing the eligibility check fails it.

Refs #3906.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JR38133FoyEXqWZtnC9UeK
… CI comments with it

agent repair refuses an edit target outside a test surface, so a seam
whose recommended test lives in an inline #[cfg(test)] module was
offered a repair start it could not use. repair_start_command_for now
also requires the recommended test file to be a test surface, and
canonical_repair_command_for goes through it.

The generated CI's compact inline comment headline read only the Verify
line, so a card carrying "Start the repair:" still led with Verify. The
jq now captures the repair start and leads with it when present.

Refs #3906

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JR38133FoyEXqWZtnC9UeK
…e-repair-route

# Conflicts:
#	crates/ripr/src/output/gate/tests.rs
…d repair

Generated CI builds the gap ledger from repo-exposure, whose records are all
repo-scoped, so `ripr first-pr` always fell to no_action for Rust even when
the review-comments file held a card that passed the repair-packet flip. The
review-comments input was only checked for existence.

first-pr: when the ledger yields no top gap, read the review-comments input
and select the first actionable card in comments[] then summary_only[] that
carries a non-empty llm_guidance.repair_command. The command is carried
byte-for-byte; first-pr never builds `agent repair` from a seam, gap, or
probe id. Every selected field comes from that same card (source_artifact is
the review-comments path, repair.route is AgentRepairTransaction, verify and
receipt are the card's), never mixed with a ledger record. The card is used
only when the report is tool=ripr, status=advisory, and names this
invocation's root, base, and head; otherwise it fails closed to no_action.
The selection keeps state top_gap so the editor projection and pr-summary
consume it unchanged. receipt_path and agent_packet_command are null for a
card selection: the card is not a ledger gap and first-pr does not parse
commands for paths. selected.repair_command is present only when carried, so
ledger-selected packets are byte-identical to before.

The repair start is not added to `commands`: the VS Code first-pr projection
fails the whole packet closed (unsafeCommand) on any `commands` value outside
its allowlist, and `ripr agent repair` is not on it.

CLI and Markdown render a "Start repair" line before Verify. A no_action
reason now says why no card supplied a start and, when the cards are missing
or were rendered from the gap ledger, names the seam-level
`ripr review-comments --root --base --head --out` route.

pr-summary: carry start-here selected.repair_command into TopRepair (never
read review comments directly, which could mis-pair a card with start-here's
top gap), render a "start repair" line before verify in both Markdown
surfaces, and make it the first local reproduction command when present.

Docs: OUTPUT_SCHEMA start-here and pr-evidence-summary contracts,
FIRST_PR_WORKFLOW, RIPR-SPEC-0075 field tables.

Refs #3906

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JR38133FoyEXqWZtnC9UeK
@coderabbitai

coderabbitai Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 18f788c4-d2f3-4797-aa0b-c3d51a304f6f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Decision

  • Needs reviewer attention before upstream: findings remain.

Confirmed findings

  • cargo-test sensor receipt is scheduled-late; PR-body's claim of -3/-2/-2 failures per negative-control revert is not yet sensor-attested. Trust is deferred until cargo-test receipt lands.

Verification questions

  • Confirm review_card_repair_start_fails_closed_on_stale_or_missing_reports covers base/status/root/scope/missing but skips the head-ref mismatch branch of review_comments_currentness_problem.
  • Confirm selection::TopGap fields agent_packet_command and receipt_path changed from String to Option at first_pr.rs. All in-crate read sites updated (renderers, JSON, to_json). Need confirmation that no out-of-crate consumer deserializes these fields as String.

Refuted

  • Negative control (pr-summary builds repair_command from seam_id) cannot actually fire — derive_local_reproduction_commands only prepends from top_repair.repair_command, which derive_top_repair only reads from start-here's selected.repair_command; there is no seam_id derivation path to revert.
  • pr-summary might re-derive a repair command from seam_id or other card-derived field instead of carrying start-here's selected.repair_command; refuted because: derive_top_repair only reads value_path(sel, ["repair_command"]) via a non-empty trim filter; the negative case in start_here_repair_command_is_carried_into_top_repair asserts no repair_command is rebuilt from seam_id and that 'agent repair' never appears in JSON/MD when absent.
  • markdown command block could corrupt a repair_command containing backticks/newlines; refuted because: format!-based rendering wraps command in backticks; review_card_repair_start_is_carried_When_the_ledger_selects_nothing uses literal command without metacharacters; carry-only invariant keeps producer responsible for content.

Parked follow-ups

  • Non-main-base CI path is explicitly parked; currentness will reject cards causing under-emission.

Evidence gaps

  • PR-body negative controls enumerated six revert/restore cases (first-pr copied value None, first-pr builds from seam_id 3 failures, pr-summary copied None 2 failures, pr-summary builds from seam_id 2 failures); receipts confirm shape but no receipt artifact in sensors/.
  • Model proof intent was rejected by deterministic validation.
  • Negative controls in PR body claim each reverted and cmp-restored; artifact-verifier failed exit 2, no receipt.

…r starts

The fail-closed test covered base, status, root, scope and a missing
report but not a report generated for another head. Removing the head
check from review_comments_currentness_problem now fails it.

Refs #3906

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JR38133FoyEXqWZtnC9UeK
@claude

claude Bot commented Sep 23, 2026

Copy link
Copy Markdown
Contributor Author

Replies to the ub-review questions:

  • Head-mismatch branch: it was not covered, and now is. 09fad4c adds a head row to review_card_repair_start_fails_closed_on_stale_or_missing_reports: a report generated for feature-tip is refused with "generated for head feature-tip, not HEAD". As a negative control, dropping head from review_comments_currentness_problem's loop fails the test (panic at first_pr.rs:3479). Restored afterwards.
  • Option<String> for agent_packet_command / receipt_path: these fields stay in the JSON, and a card selection writes null for them. Ledger selections are byte-identical, and no golden changed. Out-of-crate readers:
    • VS Code firstPrProjection.ts reads both with stringField and filters out undefined.
    • pr-summary reads through value_path.
    • xtask ripr_swarm.rs already deserializes receipt_path as Option<String>.
  • "pr-summary builds from seam_id" control cannot fire: it was a mutation, not a revert. The control temporarily added a seam_id-based builder in derive_top_repair, and 2 tests failed against it. The point is that the tests would catch someone adding that path.

Generated by Claude Code

…st-pr-repair-start

# Conflicts:
#	docs/OUTPUT_SCHEMA.md
#	docs/specs/RIPR-SPEC-0075-pr-evidence-summary.md
`cargo test -p ripr --lib` does not compile on main since 64f3b92.
#3936 added `repair_route_leads_with_the_repair_start_when_carried`,
which calls `push_repair_route(out, route)`. #3968, branched before
#3936 landed, added a third `changed_line_anchored: bool` parameter.
Each PR was green on its own base; the combined tree fails with E0061
at output/gate/presentation.rs:630 and :642.

The test now passes `true`. The start-repair line it pins does not
depend on the flag.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JR38133FoyEXqWZtnC9UeK
(cherry picked from commit 9884f9b)
…single Start here block

#4011 made dogfood_report_packet_index_scenarios_have_checked_receipts render
the corpus instead of comparing two goldens, and #3973 removed the second
"Start here:" block from the rendered index. Each merged green against a
main without the other, so main now fails that required xtask test on its
first case. Regenerated all seven cases with the corpus canonical_command.
Six index.md files lose the duplicate block; every index.json is unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JR38133FoyEXqWZtnC9UeK
(cherry picked from commit 3a0d679)
…lt-base change

#4002 made CheckInput::default().base None and reblessed every --diff
fixture on its base. #3944 (python_src_layout_package_import) and #3985
(tail_comparison_boundary) were blessed on bases without #4002, so each
merged with "base": "origin/main" and base_revision "origin/main", and
`cargo xtask goldens check` on main reports both as drift. Reblessed with
a RIPR-SPEC-0084 reason; only base/base_revision change, the same delta
#4002 applied to the other fixtures. goldens check: 0 drift entries.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JR38133FoyEXqWZtnC9UeK
(cherry picked from commit 7930fef)
Keeps #3962 (stacked on this branch) measurable: #3962 already carries
main, so while this base lacked it, #3962's PR-evidence diff counted all
of main's recent changes (8191 changed Rust lines against the 7500
budget) and the Rust gates job failed. Clean merge.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JR38133FoyEXqWZtnC9UeK
claude Bot pushed a commit that referenced this pull request Sep 24, 2026
Tree unchanged: this branch already carried main. The merge makes the
base contain main too, so the PR-evidence diff measures only this PR's
own delta again.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JR38133FoyEXqWZtnC9UeK
claude Bot pushed a commit that referenced this pull request Sep 24, 2026
Keeps this stacked branch's base current so its PR-evidence diff
measures only its own change.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JR38133FoyEXqWZtnC9UeK
@EffortlessSteven
EffortlessSteven marked this pull request as ready for review September 24, 2026 14:54

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Decision

  • Needs one verification check before upstream.

Verification questions

  • Confirm artifact-verifier failed with exit code 2; trust is deferred until cargo-test late receipt lands and artifact-verifier re-runs or is explained. Not a code-correctness blocker for the carried-repair-start contract; the receipts concern the build/proof pipeline, not the behavioral change.

Refuted

  • pr-summary could re-derive repair_command from seam_id or other card field, bypassing the carried-only rule; refuted because: derive_top_repair reads only start_here_value via value_path(sel, &["repair_command"]); derive_local_reproduction_commands takes only the Option<&str>; no seam_id or card path enters either function. PR-body negative control (rebuilt from seam_id) fails 2 tests.
  • language forced to rust/stable on every card selection would corrupt preview-language PRs; refuted because: Card projection is reached only after the review-comments fail-closed guard; preview roots are skipped via uses_check_output_gap_ledger short-circuit. Hardcoding language is a deliberate boundary until the card producer grows non-Rust card types.

Parked follow-ups

  • Option for agent_packet_command and receipt_path: in-crate read sites use .as_str/.as_deref/serde Option; out-of-crate consumers (VS Code stringField+undefined filter, xtask Option deser, pr-summary value_path) tolerate null per PR-body reply.
  • Sibling surfaces (xtask legacy summary.md, VS Code firstPrProjection.ts) are NOT updated in this PR — author explicitly defers them as parked follow-ups. No silent mixing.
  • Route label is fixed AgentRepairTransaction and does not reuse a ledger kind; VS Code projection (outside diff) allowlists commands values, so placing repair_command on selected only and omitting it from commands is the correct boundary — the diff is structurally consistent with the PR body's Decisions bullet. Out-of-crate readers handled per PR body's StringField/Option<String> argument and refuted in the seeded thread.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.
  • Option for agent_packet_command and receipt_path risk out-of-crate String deserializers; PR thread claims VS Code stringField, pr-summary value_path, and xtask Option all tolerate null.

@EffortlessSteven
EffortlessSteven merged commit f9ad566 into main Sep 24, 2026
25 checks passed
@EffortlessSteven
EffortlessSteven deleted the claude/onboarding-first-pr-repair-start branch September 24, 2026 15:26
claude Bot pushed a commit that referenced this pull request Sep 24, 2026
…anch

#3960 landed as one squash commit, so this branch's copy of its history
no longer matches main. Replayed only this PR's own changes (the diff
from #3960's last head to this branch) onto current main, which also
carries #3962; they applied cleanly.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JR38133FoyEXqWZtnC9UeK
EffortlessSteven added a commit that referenced this pull request Sep 24, 2026
Resolve the post-squash stack dissolution: landed #3960/#3962 content
(main) replaces the carried stack text; the #3987 init generated-CI
runnable-next-steps delta survives (init.rs, generated workflow template,
labels, goldens, replay test), with main's #4005/#4012/#4014 movement and
shared fixture-git helpers retained. process_allowlist counts recomputed
against the merged files (cli_smoke 12, generated_review_workflow 9).
claude Bot pushed a commit that referenced this pull request Sep 24, 2026
#3987 was brought onto main by a merge that replaced the stacked
history this branch carried. Replayed only this PR's own changes (the
diff from the #3987 head last merged here to this branch) onto #3987's
new head; they applied cleanly.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JR38133FoyEXqWZtnC9UeK
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.

ux(agent): follow-up guidance routes to the low-level loop instead of agent repair

2 participants