Skip to content

fix(cli): validate an explicit check --root instead of handing back git's argv (#3880) - #3882

Merged
EffortlessSteven merged 2 commits into
mainfrom
claude/ux-polish-doawhf-root
Sep 24, 2026
Merged

EffortlessSteven merged 2 commits into
mainfrom
claude/ux-polish-doawhf-root

Conversation

@claude

@claude claude Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Requested by Steven · project thread

Summary

Before: ripr check --root /no/such/dir reached the diff loader and returned
the whole git invocation to the user.

ripr: failed to run git diff: failed to run git -C /no/such/dir ["-c", "core.quotePath=true", "diff", "--no-ext-diff", "--submodule=short", "--unified=0", "HEAD~1...HEAD"]: No such file or directory (os error 2)

After: ripr: check root /no/such/dir is not a directory.

How: rerun, agent, swarm queue, swarm ingest and config validate
already route an explicit root through
cli::commands_context::ensure_command_root. check did not. It does now, so
no new message shape is invented — this is the existing validator's own text,
already pinned for config validate by
config_validate_rejects_missing_and_file_roots.

Only an explicit --root is validated. Without one, check still walks up from
the current directory to a Cargo.toml carrying [workspace], where an
intermediate path that does not resolve is legitimate until the walk finishes.
The diff loader's own errors are untouched, so the failed to run git diff: ...
text that the context and explain invalid-root contract pins still holds on
their paths.

Swarm / Source Boundary

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

Source-of-truth Links

Proposal:
Spec:
ADR:
Plan item:
Active goal: #2379
Issue: #3880

Scope

  • Explicit-root validation for ripr check.

Scope Classification

  • One production behavior

Production delta:

  • An explicit --root that is not a directory fails before the diff loads,
    naming the path.

Evidence/support delta:

  • One added smoke test, check_rejects_missing_and_file_roots_without_leaking_the_git_invocation,
    covering a missing root and a file-as-root, with two discriminators: the
    offending path must appear, and core.quotePath / failed to run git must
    not. It closes on a negative control proving a real workspace root still
    analyzes, so the check cannot pass by rejecting every explicit root.

Single acceptance criterion:

  • ripr check --root <not-a-directory> names the path and does not print the
    git invocation; a valid explicit root and the implicit workspace walk are
    unaffected.

Non-goals:

  • context and explain keep their current invalid-root behavior; moving those
    means moving the pinned contract.
  • No change to how a valid root is resolved.

Support-tier Impact

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

Claim/proof notes:

  • One CLI error string changes, on a path that previously produced no useful
    output. Exit code is 2 before and after. No JSON or schema field changes.

Policy Impact

  • none

Ledger or exception notes:

  • The added test uses the suite's existing run_ripr / assert_failure
    helpers, which are already covered by the no-panic allowlist; no new entry
    was needed.

Proof

cargo xtask precommit                   # exit 0
cargo clippy -p ripr --all-targets      # exit 0
cargo test -p ripr --test cli_smoke     # 203 passed

Result, failures, or skipped proof:

  • Reproduced the original output by hand on a scratch Cargo fixture, then the
    new message, for both a missing root and a file passed as root, with a valid
    explicit root and a bare ripr check as controls.
  • cargo test --workspace, cargo doc, cargo package, cargo publish --dry-run and check-support-tiers were not run here; they remain for the
    fixed-candidate step.

Claim Boundary

After this PR an unusable explicit --root is legible on check. It may not be
claimed that every command reports an invalid root the same way, nor that the
diff loader no longer surfaces raw git text — it still does on the paths where
the pinned contract requires it.

Rollback

Revert the commit. One call site and one test; no persisted state, schema field
or config key.

Spec-Test-Code Traceability

  • Spec: none
  • Tests: crates/ripr/tests/cli_smoke.rs —
    check_rejects_missing_and_file_roots_without_leaking_the_git_invocation,
    alongside the existing config_validate_rejects_missing_and_file_roots that
    pins the same validator's message
  • Code: crates/ripr/src/cli/commands/check.rs, calling
    crates/ripr/src/cli/commands_context.rs
  • Golden outputs: none affected
  • Metrics: none
  • ADR/learning: none

Static Language Check

  • Static output avoids killed, survived, untested, proven, and adequate.
  • Unknowns include stop reasons where applicable.

CI Economics

n/a — no workflow, policy gate, branch protection, artifact, or lane cost changes.

Engineering Check

  • No new panic, unwrap, expect, todo, or unimplemented in production code.
  • No new panic, unwrap, expect, todo, or unimplemented in tests.
  • New non-Rust programming files are allowlisted with owner, surface, and reason.
  • New generated, dependency, process-spawn, or network surfaces are allowlisted with owner and reason.
  • Errors are reported with actionable context.
  • Public JSON/schema changes are documented.

Gates

Ticked only where the command actually ran for this candidate.

  • cargo fmt --check
  • cargo check --workspace --all-targets
  • cargo test --workspace
  • cargo clippy --workspace --all-targets -- -D warnings (ran -p ripr --all-targets)
  • cargo doc --workspace --no-deps
  • cargo package -p ripr --list
  • cargo publish -p ripr --dry-run
  • cargo xtask check-static-language
  • cargo xtask check-doc-artifacts
  • cargo xtask check-support-tiers
  • cargo xtask check-no-panic-family
  • cargo xtask check-allow-attributes
  • cargo xtask check-local-context
  • cargo xtask check-file-policy
  • cargo xtask check-covered-by
  • cargo xtask check-executable-files
  • cargo xtask check-workflows
  • cargo xtask check-spec-format
  • cargo xtask check-spec-numbering
  • cargo xtask check-fixture-contracts
  • cargo xtask check-generated
  • cargo xtask check-badge-diff-policy
  • cargo xtask check-generated-clean
  • cargo xtask check-dependencies
  • cargo xtask check-process-policy
  • cargo xtask check-network-policy

Extension changes: none.


🤖 Generated with Claude Code

https://claude.ai/code/session_01PTKGFhuph96fcVyfb8vBxK


Generated by Claude Code

…it's argv

`ripr check --root /no/such/dir` reached the diff loader and printed the spawn
failure with the whole invocation:

    ripr: failed to run git diff: failed to run git -C /no/such/dir ["-c",
    "core.quotePath=true", "diff", "--no-ext-diff", "--submodule=short",
    "--unified=0", "HEAD~1...HEAD"]: No such file or directory (os error 2)

`rerun`, `agent`, `swarm queue`, `swarm ingest` and `config validate` already
route an explicit root through `ensure_command_root`; `check` did not. It does
now, so the user is told which path is wrong rather than being handed the
command that failed on it.

Only an explicit `--root` is validated. Without one, `check` still walks up from
the current directory to a `Cargo.toml` carrying `[workspace]`, which is a
legitimately absent path until the walk resolves it.

No message shape is invented: this is the existing validator's text, and the
diff loader's own errors are untouched, so the invalid-root contract that
`context` and `explain` pin still holds on their own paths.

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

coderabbitai Bot commented Sep 22, 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: 852dea75-59e7-41aa-91bd-8035f699214a

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.

Both sides added tests at the same insertion point in cli_smoke.rs: main's
`doctor_reports_present_start_here_packet` and
`doctor_reports_directory_squatting_packet_path_as_not_generated` (#3866),
and this branch's
`check_rejects_missing_and_file_roots_without_leaking_the_git_invocation`.
The conflict is positional only — the tests exercise different commands and
share no state — so both are kept.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PTKGFhuph96fcVyfb8vBxK
@claude claude Bot mentioned this pull request Sep 22, 2026
11 tasks done
@EffortlessSteven
EffortlessSteven marked this pull request as ready for review September 24, 2026 03:23
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Review (exact head 8a0833b)

Surfaces: cli/commands/check.rs (13+1), cli_smoke.rs (51+0).

  • Owner: explicit --root now routes through the existing ensure_command_root validator that rerun/agent/swarm queue/swarm ingest/config validate already share — no new message shape invented; the validator's own text is already pinned elsewhere.
  • Boundary respected: only an explicit --root is validated; the no-flag workspace walk is untouched, and the diff loader's errors are unchanged for legitimate repositories.
  • Stimulus/oracle: smoke tests pin the named-directory error and keep the loader text for the loader's own failures.
  • Validation: published-head required check SUCCESS. Disposition: REVIEW_READY.

@EffortlessSteven
EffortlessSteven merged commit 7e6da7a into main Sep 24, 2026
23 of 25 checks passed
@EffortlessSteven
EffortlessSteven deleted the claude/ux-polish-doawhf-root branch September 24, 2026 03:23

@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

  • Workspace-wide gates cargo test --workspace, cargo doc --workspace, cargo check --workspace, and xtask check-support-tiers were not run for this candidate; PR body acknowledges deferral to fixed-candidate step.

Refuted

  • A symlink-to-directory passed via --root could be incorrectly rejected because it doesn't satisfy a naive is_dir() check; refuted because: ensure_command_root is the shared authority used by rerun/agent/swarm/config-validate; its behavior on symlinks is the existing contract and any change belongs to that helper, not this PR. This PR does not alter ensure_command_root.
  • Using ensure_command_root here is duplication of validation logic rather than reuse of an existing helper.; refuted because: Helper already exists in cli::commands_context and is the shared authority cited by PR body; this is the smallest reuse path, not a duplicate.
  • Missing-root error message might leak argv or quotePath after validation.; refuted because: ensure_command_root is already pinned by config_validate_rejects_missing_and_file_roots to a path-only message; new test asserts absence of 'core.quotePath' and 'failed to run git' discriminators on stderr.

Parked follow-ups

  • Missing-root case passes --base HEAD while the negative-control valid-root case omits --base; not a regression risk because --base is orthogonal to root validation, but asymmetry is undocumented.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.

claude Bot pushed a commit that referenced this pull request Sep 24, 2026
check_rejects_missing_and_file_roots_without_leaking_the_git_invocation
(#3882) ends with a control that runs a bare `ripr check --root <tmp>`.
.cargo/config.toml sets TMPDIR to target/, so that temp dir sits inside
the checkout running the tests, and the bare check diffs the enclosing
branch against its default base. On any branch with more than 2000
changed Rust lines the control fails with diff_scope_oversized, which
says nothing about --root validation. Seen on the #3982 stack (4580 lines
across 14 files).

The control now gives the workspace its own repository and an explicit
`--base HEAD`, so it measures only that a valid root is analyzed.

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
check_rejects_missing_and_file_roots_without_leaking_the_git_invocation
(#3882) ends with a control that runs a bare `ripr check --root <tmp>`.
.cargo/config.toml sets TMPDIR to target/, so that temp dir sits inside
the checkout running the tests, and the bare check diffs the enclosing
branch against its default base. On any branch with more than 2000
changed Rust lines the control fails with diff_scope_oversized, which
says nothing about --root validation. Seen on the #3982 stack (4580 lines
across 14 files).

The control now gives the workspace its own repository and an explicit
`--base HEAD`, so it measures only that a valid root is analyzed.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JR38133FoyEXqWZtnC9UeK
(cherry picked from commit ff64e0d)
EffortlessSteven added a commit that referenced this pull request Sep 24, 2026
* feat(output): carry the agent repair start on repair cards and gate routes

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

* test(output): rebind fixtures to the carried repair start and bind the 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

* feat(output): lead PR-review surfaces with the carried repair start

First-useful-action, the PR-review front panel, the PR evidence ledger,
and RIPR Zero status now lead with `ripr agent repair --root . --seam-id
<id> --phase before` exactly when an input artifact already carries it,
and never synthesize a repair-loop command from a bare seam id. The
fail-closed decision stays with repair_packet_eligibility(..).eligible()
upstream; these surfaces carry the string and do not re-run eligibility.

First-useful-action: a new route ahead of the missing-assistant-proof
route. When no assistant proof exists yet and the first review card
(comments, then summary_only) carries a non-empty
llm_guidance.repair_command, the report is `actionable` /
`write_focused_test` with `commands.repair` set to that string and every
`selected`/`target` field, verify, and receipt command taken from that
same card. A fresh PR no longer asks for post-repair assistant proof
before any repair exists. The same card without the command keeps the
missing_required_artifact route; post-proof routing is unchanged.
`commands.repair` is skipped when absent, so existing goldens are stable.
Markdown adds a `Start Repair` section and a one-screen `Repair start`
line. Generated CI's first-action summary and at-a-glance block print
`.commands.repair` (template, test, and docs/CI.md mirror).

Front panel: `top_issue.repair_command` is carried from first-action
`commands.repair`, a card's `llm_guidance.repair_command`, or an
acknowledged gate route's `repair_route.repair_command`. `agent_command`
is that command, else a carried read-only inspection command
(`commands.context_packet`, `llm_guidance.command`, or the gate route's
`inspection_command`), else null. The three `agent start --seam-id`
syntheses are gone. Markdown shows `Repair start` in the top issue and
the Repair block. The invalid-improved assertion now pins the exact
carried handoff instead of `is_some()`.

Evidence ledger: `top_repair_route.repair_command` is carried from the
card, gate route, or RIPR Zero route; the gap and baseline arms name no
repair start and drop their synthesized `agent start` (verify kept).
Also fixes the card receipt command, which cards put at the root, not
under llm_guidance (kept as fallback), so it was always null.

RIPR Zero status (item 4 decision): the gap-record arm synthesized
`agent start --seam-id <canonical_gap_id>`, a gap id rather than a seam
id; it now names none. The baseline arm carries
`evidence_record.canonical_item.repair_command` when present, else null.

Left in place: test_oracle_assistant_proof handoff. The proof is a
post-attempt artifact (it needs before/after/receipt) and its handoff
records the workflow that produced its --agent-packet input.
assistant_loop_health derives every repair-queue command root from that
field (command_root), so nulling it would regress those roots to `.`.
It needs its own root carrier first; tracked as follow-up.

Goldens: new first-useful-action/repair-start and
pr-review-front-panel/repair-start cases (exact-line card carrying the
command), regenerated through the production renderers. Front-panel
actionable/blocked now show the carried context-packet command,
acknowledged/summary-only show null, and the mixed ledger shows null;
the mixed ripr-zero-status input is rebound to the producer contract.
No hash-bound artifact changed.

Refs #3906.

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

* fix(output): withhold the repair start for inline-test seams and lead 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

* feat(output): start first-pr and pr-summary from a carried review-card 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

* test(first-pr): cover the head-mismatch refusal for review-card repair 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

* fix(init): generated CI prints only runnable next steps

The workflow generated by `ripr init --ci github` ran post-edit repair steps
before any test edit existed. The agent-loop step exited non-zero on every
run and left a 0-byte agent-verify.json. The first-run summary said
"Safe next action command: none" while a repair start was available, and
the review packet printed receipt and assistant-loop proof commands that
fail as printed.

- agent loop: CI now writes only the before side (agent start plus the
  agent packet through mktemp/mv). The after snapshot, verify, receipt
  and outcome steps are post-edit work and are no longer run in CI.
- first-run block: leads with the repair start
  (.selected.repair_command), then the `--phase after` step. Verify and
  receipt become the manual alternative, and the Safe next action falls
  back through the repair command.
- start-here, first-useful-action, front panel and evidence ledger:
  verify and receipt are labelled as steps that run after the test
  edit, or as the manual alternative when a repair start leads.
  JSON fields are unchanged.
- agent status and review summary: a post-edit next command carries
  an explicit "run this after the focused test edit" note.
- report packet index: the assistant-loop proof next command is the
  full-input form, labelled as running after the repair's after phase.
- fixture contract: first successful PR Markdown accepts the new
  verify/receipt labels.
- replay test: runs the generated workflow's steps against a fixture
  PR. It asserts no non-zero step, no empty or invalid JSON, that the
  first block leads with the repair start, and that every printed
  command runs as printed or is labelled post-edit.

Refs #3906

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

* fix(output): lead gate, pr-summary and the CI review packet with the repair transaction

Follow-ups to the generated-CI summary routes (#3906) from the third
onboarding re-walk.

- IX-2/IX-3: the post-edit labelling tests no longer depend on which step
  agent status routes a fixture to. The labeller is checked over every loop
  step on constructed commands (including the select_seam and
  repair_attempt_* routes #3931 adds), the review-summary renderer is driven
  with constructed next commands, and the end-to-end fixtures name their seam
  in the packet so the after snapshot is the next step with or without
  #3931's attempt-aware status.
- N5: before any test edit the CI `Agent review packet` block says no
  receipt is expected before a repair and leads with the carried repair
  start (start-here `.selected.repair_command`) and its after phase, with
  root-relative paths, instead of the post-edit snapshot loop with a
  runner-absolute redirect. The review summary Markdown names the missing
  receipt the same way; JSON is unchanged.
- F60-14: gate-decision.md and the pr-summary Markdown render a carried
  repair start as one transaction: start, the test to add (the review-card
  prompt's closing low-level verify sentence is dropped beside a start), the
  after phase, then verify and receipt as the manual alternative. Without a
  start they read as steps after the test edit. JSON is unchanged.
- One owner for the label text: a shared ProofPathLabels selector in
  first_pr replaces the per-surface copies, and the generated workflow takes
  the labels, the after-phase step and the no-receipt note from the same
  constants through template placeholders.
- F60-2(c): the manual labels name their prerequisites. The manual verify
  compares before and after snapshots taken around the test edit, so on a
  fresh checkout it fails as printed; the label now says so, and the manual
  receipt runs after the manual verify.

Goldens were regenerated through RIPR_UPDATE_FIXTURES=1 (gate matrices,
first-useful-action and front-panel Markdown pins, with new opt-in hooks on
the latter two) and from `cargo xtask dogfood` actual outputs (gate
adoption Markdown).

Refs #3906

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

* docs(schema): keep the front-panel vocabulary sentences in their own bullet

The #3906 repair_command bullet was spliced mid-sentence into the typed
one-screen vocabulary contract: the mirror/evidence-strength sentences
described top_issue.current_evidence_strength and friends, not the new
carried-command fields. Restore them to the vocabulary bullet so the
repair_command bullet ends at the never-synthesize rule.

Reviewed as part of #3962.

* test(check): run the valid-root control in its own repository

check_rejects_missing_and_file_roots_without_leaking_the_git_invocation
(#3882) ends with a control that runs a bare `ripr check --root <tmp>`.
.cargo/config.toml sets TMPDIR to target/, so that temp dir sits inside
the checkout running the tests, and the bare check diffs the enclosing
branch against its default base. On any branch with more than 2000
changed Rust lines the control fails with diff_scope_oversized, which
says nothing about --root validation. Seen on the #3982 stack (4580 lines
across 14 files).

The control now gives the workspace its own repository and an explicit
`--base HEAD`, so it measures only that a valid root is analyzed.

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

* Restore main's landed movement lost by whole-file conflict picks

The #3987 own-claim conflict resolutions used whole-file ours-picks, which
silently dropped main-side movement beyond the carried stack in three
surfaces:

- init.rs template: restore #4005's pinned capture step (no-ext-diff,
  no-textconv, unified=3, base/head SHA resolution, pr-diff receipt with
  byte-count and empty-patch guard); the generated-review-workflow pin
  contract test failed against the stale step.
- docs/CI.md: same pinned capture step in the embedded workflow copy so
  the docs-vs-template test holds.
- docs/OUTPUT_SCHEMA.md: rebuild from main's landed text plus only the two
  #3906 overlay hunks, restoring input-identity v4, base_revision
  agreement, Cargo.lock content-identity wording, and the
  receipt-not-review-evidence contract.

Proof: fmt, check -p ripr, generated_review_workflow (6/6), bin init,
lib first_useful_action/pr_summary, and goldens check all pass; goldens
needed no reblessing.

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Steven Zimmerman, CPA <15812269+EffortlessSteven@users.noreply.github.com>
EffortlessSteven added a commit that referenced this pull request Sep 25, 2026
check_rejects_missing_and_file_roots_without_leaking_the_git_invocation
(#3882) ends with a control that runs a bare `ripr check --root <tmp>`.
.cargo/config.toml sets TMPDIR to target/, so that temp dir sits inside
the checkout running the tests, and the bare check diffs the enclosing
branch against its default base. On any branch with more than 2000
changed Rust lines the control fails with diff_scope_oversized, which
says nothing about --root validation. Seen on the #3982 stack (4580 lines
across 14 files).

The control now gives the workspace its own repository and an explicit
`--base HEAD`, so it measures only that a valid root is analyzed.


Claude-Session: https://claude.ai/code/session_01JR38133FoyEXqWZtnC9UeK

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Steven Zimmerman, CPA <15812269+EffortlessSteven@users.noreply.github.com>
EffortlessSteven added a commit that referenced this pull request Sep 25, 2026
…nner paths (#4017)

* feat(output): carry the agent repair start on repair cards and gate routes

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

* test(output): rebind fixtures to the carried repair start and bind the 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

* feat(output): lead PR-review surfaces with the carried repair start

First-useful-action, the PR-review front panel, the PR evidence ledger,
and RIPR Zero status now lead with `ripr agent repair --root . --seam-id
<id> --phase before` exactly when an input artifact already carries it,
and never synthesize a repair-loop command from a bare seam id. The
fail-closed decision stays with repair_packet_eligibility(..).eligible()
upstream; these surfaces carry the string and do not re-run eligibility.

First-useful-action: a new route ahead of the missing-assistant-proof
route. When no assistant proof exists yet and the first review card
(comments, then summary_only) carries a non-empty
llm_guidance.repair_command, the report is `actionable` /
`write_focused_test` with `commands.repair` set to that string and every
`selected`/`target` field, verify, and receipt command taken from that
same card. A fresh PR no longer asks for post-repair assistant proof
before any repair exists. The same card without the command keeps the
missing_required_artifact route; post-proof routing is unchanged.
`commands.repair` is skipped when absent, so existing goldens are stable.
Markdown adds a `Start Repair` section and a one-screen `Repair start`
line. Generated CI's first-action summary and at-a-glance block print
`.commands.repair` (template, test, and docs/CI.md mirror).

Front panel: `top_issue.repair_command` is carried from first-action
`commands.repair`, a card's `llm_guidance.repair_command`, or an
acknowledged gate route's `repair_route.repair_command`. `agent_command`
is that command, else a carried read-only inspection command
(`commands.context_packet`, `llm_guidance.command`, or the gate route's
`inspection_command`), else null. The three `agent start --seam-id`
syntheses are gone. Markdown shows `Repair start` in the top issue and
the Repair block. The invalid-improved assertion now pins the exact
carried handoff instead of `is_some()`.

Evidence ledger: `top_repair_route.repair_command` is carried from the
card, gate route, or RIPR Zero route; the gap and baseline arms name no
repair start and drop their synthesized `agent start` (verify kept).
Also fixes the card receipt command, which cards put at the root, not
under llm_guidance (kept as fallback), so it was always null.

RIPR Zero status (item 4 decision): the gap-record arm synthesized
`agent start --seam-id <canonical_gap_id>`, a gap id rather than a seam
id; it now names none. The baseline arm carries
`evidence_record.canonical_item.repair_command` when present, else null.

Left in place: test_oracle_assistant_proof handoff. The proof is a
post-attempt artifact (it needs before/after/receipt) and its handoff
records the workflow that produced its --agent-packet input.
assistant_loop_health derives every repair-queue command root from that
field (command_root), so nulling it would regress those roots to `.`.
It needs its own root carrier first; tracked as follow-up.

Goldens: new first-useful-action/repair-start and
pr-review-front-panel/repair-start cases (exact-line card carrying the
command), regenerated through the production renderers. Front-panel
actionable/blocked now show the carried context-packet command,
acknowledged/summary-only show null, and the mixed ledger shows null;
the mixed ripr-zero-status input is rebound to the producer contract.
No hash-bound artifact changed.

Refs #3906.

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

* fix(output): withhold the repair start for inline-test seams and lead 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

* feat(output): start first-pr and pr-summary from a carried review-card 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

* test(first-pr): cover the head-mismatch refusal for review-card repair 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

* fix(init): generated CI prints only runnable next steps

The workflow generated by `ripr init --ci github` ran post-edit repair steps
before any test edit existed. The agent-loop step exited non-zero on every
run and left a 0-byte agent-verify.json. The first-run summary said
"Safe next action command: none" while a repair start was available, and
the review packet printed receipt and assistant-loop proof commands that
fail as printed.

- agent loop: CI now writes only the before side (agent start plus the
  agent packet through mktemp/mv). The after snapshot, verify, receipt
  and outcome steps are post-edit work and are no longer run in CI.
- first-run block: leads with the repair start
  (.selected.repair_command), then the `--phase after` step. Verify and
  receipt become the manual alternative, and the Safe next action falls
  back through the repair command.
- start-here, first-useful-action, front panel and evidence ledger:
  verify and receipt are labelled as steps that run after the test
  edit, or as the manual alternative when a repair start leads.
  JSON fields are unchanged.
- agent status and review summary: a post-edit next command carries
  an explicit "run this after the focused test edit" note.
- report packet index: the assistant-loop proof next command is the
  full-input form, labelled as running after the repair's after phase.
- fixture contract: first successful PR Markdown accepts the new
  verify/receipt labels.
- replay test: runs the generated workflow's steps against a fixture
  PR. It asserts no non-zero step, no empty or invalid JSON, that the
  first block leads with the repair start, and that every printed
  command runs as printed or is labelled post-edit.

Refs #3906

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

* fix(output): lead gate, pr-summary and the CI review packet with the repair transaction

Follow-ups to the generated-CI summary routes (#3906) from the third
onboarding re-walk.

- IX-2/IX-3: the post-edit labelling tests no longer depend on which step
  agent status routes a fixture to. The labeller is checked over every loop
  step on constructed commands (including the select_seam and
  repair_attempt_* routes #3931 adds), the review-summary renderer is driven
  with constructed next commands, and the end-to-end fixtures name their seam
  in the packet so the after snapshot is the next step with or without
  #3931's attempt-aware status.
- N5: before any test edit the CI `Agent review packet` block says no
  receipt is expected before a repair and leads with the carried repair
  start (start-here `.selected.repair_command`) and its after phase, with
  root-relative paths, instead of the post-edit snapshot loop with a
  runner-absolute redirect. The review summary Markdown names the missing
  receipt the same way; JSON is unchanged.
- F60-14: gate-decision.md and the pr-summary Markdown render a carried
  repair start as one transaction: start, the test to add (the review-card
  prompt's closing low-level verify sentence is dropped beside a start), the
  after phase, then verify and receipt as the manual alternative. Without a
  start they read as steps after the test edit. JSON is unchanged.
- One owner for the label text: a shared ProofPathLabels selector in
  first_pr replaces the per-surface copies, and the generated workflow takes
  the labels, the after-phase step and the no-receipt note from the same
  constants through template placeholders.
- F60-2(c): the manual labels name their prerequisites. The manual verify
  compares before and after snapshots taken around the test edit, so on a
  fresh checkout it fails as printed; the label now says so, and the manual
  receipt runs after the manual verify.

Goldens were regenerated through RIPR_UPDATE_FIXTURES=1 (gate matrices,
first-useful-action and front-panel Markdown pins, with new opt-in hooks on
the latter two) and from `cargo xtask dogfood` actual outputs (gate
adoption Markdown).

Refs #3906

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

* fix(ledger): stop printing unmeasured gap counts as zero

Re-walk F60-4. With no baseline debt delta and no RIPR Zero status, the
PR evidence ledger's movement counts fell back to zero, so a blocked gate
with an actionable gap sat beside `| Visible unresolved gaps | 0 |` and a
CI summary line `new_policy_eligible=0 ... visible_unresolved=0`, while
the front panel above it said `new_policy_eligible=1`. A reviewer reads
that zero as clean.

The ledger now records which artifact the counts came from,
`movement.count_source` = `baseline_delta`, `ripr_zero_status`, or
`not_measured` (additive JSON field, documented in OUTPUT_SCHEMA). With
`not_measured` the Markdown says the gap counts were not measured and
renders those four rows as `not measured`; gate-derived rows
(acknowledged, suppressed, blocking) are unchanged. The generated CI
summary prints the same disclosure instead of the zeros.

The panel's count is left as is: it derives "at least one" from the gate
and the first action, which is true.

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

* fix(ci): generated workflow works for non-main bases and leaves no runner paths

Re-walk F60-7 and F60-8, generated `ripr init --ci github` workflow.

- first-pr now gets the PR's base (`origin/${{ github.base_ref ||
  github.event.repository.default_branch }}`) and HEAD. Without it,
  first-pr assumed origin/main, so in a repository whose PRs target any
  other branch the CI start-here was `blocked_artifact: the first-pr base
  origin/main does not resolve`. The workflow replay fixture now targets
  `trunk`, which reproduces that failure on the old workflow.
- Check annotations carry the reason plus the repair start. They used to
  append `ripr agent brief ... > /home/runner/work/.../agent-brief.json`,
  a command that redirects into the runner's checkout and is not the
  repair start every summary leads with.
- The RIPR-source-tree-only operator cockpit step (`cargo xtask
  operator-cockpit`) is removed; adopter repositories have no xtask.
- Each full Markdown report in the job summary sits in a collapsed
  <details> block under its at-a-glance lines. Replay summary: 1089
  lines, 498 visible.
- Each permission now says what uses it and how to drop it.
- docs/CI.md no longer carries an 813-line copy of the workflow that had
  drifted to 806 of the generator's 2176 lines while claiming to match
  it; it points at `ripr init --ci github --dry-run`.

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

* docs(schema): keep the front-panel vocabulary sentences in their own bullet

The #3906 repair_command bullet was spliced mid-sentence into the typed
one-screen vocabulary contract: the mirror/evidence-strength sentences
described top_issue.current_evidence_strength and friends, not the new
carried-command fields. Restore them to the vocabulary bullet so the
repair_command bullet ends at the never-synthesize rule.

Reviewed as part of #3962.

* fix(ci): collapse the policy and preview promotion packets in the job summary

The replay test now checks the collapse the previous commit claimed: every
`Full report` block closes and no report's top-level heading is visible
outside one. It failed at once on the four policy promotion packets, which
were still appended in full (about 290 lines); the preview promotion packets
had the same shape. Both now sit in `<details>` blocks like every other
report, and the replay summary drops to 235 visible lines of 1106.

Under GITHUB_ACTIONS a missing bash, git or jq now fails the replay instead
of skipping it, so a hosted runner cannot quietly drop the check.

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

* test(check): run the valid-root control in its own repository

check_rejects_missing_and_file_roots_without_leaking_the_git_invocation
(#3882) ends with a control that runs a bare `ripr check --root <tmp>`.
.cargo/config.toml sets TMPDIR to target/, so that temp dir sits inside
the checkout running the tests, and the bare check diffs the enclosing
branch against its default base. On any branch with more than 2000
changed Rust lines the control fails with diff_scope_oversized, which
says nothing about --root validation. Seen on the #3982 stack (4580 lines
across 14 files).

The control now gives the workspace its own repository and an explicit
`--base HEAD`, so it measures only that a valid root is analyzed.

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

* Restore main's landed movement lost by whole-file conflict picks

The #3987 own-claim conflict resolutions used whole-file ours-picks, which
silently dropped main-side movement beyond the carried stack in three
surfaces:

- init.rs template: restore #4005's pinned capture step (no-ext-diff,
  no-textconv, unified=3, base/head SHA resolution, pr-diff receipt with
  byte-count and empty-patch guard); the generated-review-workflow pin
  contract test failed against the stale step.
- docs/CI.md: same pinned capture step in the embedded workflow copy so
  the docs-vs-template test holds.
- docs/OUTPUT_SCHEMA.md: rebuild from main's landed text plus only the two
  #3906 overlay hunks, restoring input-identity v4, base_revision
  agreement, Cargo.lock content-identity wording, and the
  receipt-not-review-evidence contract.

Proof: fmt, check -p ripr, generated_review_workflow (6/6), bin init,
lib first_useful_action/pr_summary, and goldens check all pass; goldens
needed no reblessing.

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Steven Zimmerman, CPA <15812269+EffortlessSteven@users.noreply.github.com>
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.

2 participants