Repository navigation
fix(repair): keep the repair transaction working across cargo test, a scope-less base, and a committed test - #3986
Conversation
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
|
Negative controls at
Coverage gaps: NC5, NC12 and NC13 are each caught by only one unit test. There is no end-to-end scenario for them. Generated by Claude Code |
|
Test: Validation at Generated by Claude Code |
…ude/onboarding-status-after-attempt #3982 lands after #3986 and absorbs the combined-tree interaction. Conflict resolutions (both behaviors kept): - app/repair_attempt.rs: #3982's record_repair_attempt_after_refusal and bounded_refusal_reason sit beside #3986's AttemptHeadLineage, attempt_head_lineage, analysis_input_changes and is_analysis_input_path. - output/agent_receipt.rs: #3982's agent_receipt_reading_ties_gap_closure_to_status_and_movement and #3986's agent_receipt_recommends_review_only_for_an_advisory_receipt both kept. Semantic interaction (IX-1): #3982's recorded_after_refusal_keeps_the_attempt_resumable_until_finish called the three-argument finish_repair_attempt; #3986 added the HeadMovement argument. The sample attempt is an ordinary, non-trust-bound attempt, so the call passes HeadMovement::AdmitDescendantCommits, the movement the ordinary after phase uses. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JR38133FoyEXqWZtnC9UeK
…s superseded receipts Combined-tree interaction of #3982 (status reports the attempt outcome) with #3986 (descendant-commit admission, receipt-rerun projection). - N1: status compared the current HEAD with the prepared head, so a focused test committed between the phases read `prepared_at_other_head` and routed to a new before phase that cannot find the closed seam, while the recorded after phase would succeed. The attempt authority now owns the after phase's head rule (`after_phase_head_admission`: current, finishes stale for a trust-bound attempt, or refused for rewritten history); the after phase and status both call it. A descendant HEAD stays `resumable` with the recorded `--attempt ... --phase after`; rewritten history reports the after phase's own reset recovery (`DivergedHeadRecovery`, shared text). - N1: a finished attempt is current when HEAD is the head its after phase recorded (which may descend from the prepared head), so `repair_receipt_stale` no longer fires with the same SHA on both sides. - N4: rerunning an after phase on an attempt that is not awaiting its edit names its documented state, says it already finished or ended, names the receipt path, and gives `ripr agent status` / a new before phase as next steps, instead of the Rust Debug state name. - N6: a refused after phase records its printed cause and recovery (changed analysis inputs, rewritten history) with the final error, bounded by the attempt authority, so status repeats the named cause. - N9: status says "static grip improved (receipt advisory)" instead of "shows the gap closed"; dispositions and JSON enums are unchanged. - N3: a workflow receipt bound to another attempt is reported as superseded (`receipt.superseded_by`), not "no receipt issued", and the warning names the restart for that seam if its gap is still open. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JR38133FoyEXqWZtnC9UeK
|
Pushed 6ed90a4, which fixes re-walk finding N10.
Test: the smoke test
Negative control: I put the unconditional clause back and that scenario failed (exit 101,
Generated by Claude Code |
6ed90a4 to
25d3f0f
Compare
|
Both #4022 commits are ported here as 68bdad9 with Generated by Claude Code |
|
Pushed f87226a. It carries three commits, because the rebuild at 25d3f0f lost two reviewed changes and left one fixture out of date. Restored (cherry-picked, content unchanged):
Both had already been reviewed on this branch before the rebuild. If dropping either one was deliberate, revert that commit and tell me why, and I'll leave it out. Fixed: Checks run locally: full Generated by Claude Code |
#3986 was rebuilt at 25d3f0f and then carried the restored receipt and lockfile-untrack commits plus a regenerated unchanged-after-attempt fixture. Conflict resolution: - app/repair_attempt.rs, output/agent_receipt.rs, docs/REPAIR_ATTEMPT.md: keep this branch's additions (refusal record, after_phase_head_admission, receipt reading test); the other side added nothing at those points. - cli/commands/agent.rs: keep this branch's shared head rule and refusal.narrate; drop the rebuilt branch's local repair_after_diverged_head_lines (its text lives in diverged_head_recovery); take the lockfile-only untrack route. - tests/cli_smoke.rs: take the manifest-only scenario that pins the untrack route. - unchanged-after-attempt fixtures: take #3986's regenerated set. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JR38133FoyEXqWZtnC9UeK
… scope-less base, and a committed test Rebased onto current main (afe6b3d): the presentation.rs arity hunk now resolves to main's already-landed fix; the seam_cache overlap with fix(policy) #4015 auto-merged. Branch content otherwise unchanged: untracked build-output admission, tracked-lockfile refusal naming the input, committed-test admission with both heads recorded, receipt rerun without self-tamper, and regenerated unchanged-after-attempt snapshots.
f87226a to
ccc4770
Compare
…oldens The squash-rebased branch carried pre-#4022 copies of python_src_layout_package_import and tail_comparison_boundary goldens; restore main's re-blessed versions so goldens check sees the post-RIPR-SPEC-0084 envelope.
#3986 was rebased onto main as one commit (6638f00), so a plain merge re-added the same repair-loop content on both sides and conflicted in five files. This merge takes the new #3986 tree and re-applies only this branch's own delta (a971c8c minus the old #3986 head f87226a), which applied without conflict. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JR38133FoyEXqWZtnC9UeK
Carries #3986's re-squash onto main and the valid-root control fix (a9d88f5). Clean merge. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JR38133FoyEXqWZtnC9UeK
#4014 now carries #3982's re-squash onto main (via #3986) and the valid-root control fix. This clears the conflict GitHub reported against the base. Clean merge. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JR38133FoyEXqWZtnC9UeK
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
Confirmed findings
- repair_after_input_drift_lines pushes unbounded error text into eprintln when
analysis_input_changesitself errors: a malformed manifest path or a 100KB stderr from a git command would be copied into each recovery line, then concatenated. No memory-safety issue, but stderr is line-bounded only by clippy defaults; thebound_changed_paths.contains(&path)linear scan is O(n*m) on large receipt trees. - Receipt next-step gating (NC5) is caught only by the new unit test in output/agent_receipt.rs; the ordinary flow no longer produces an invalid receipt end to end, so the CLI's forwarding branch for non-advisory receipts is exercised solely by repair_summary_forwards_the_receipt_owned_next_step_for_a_non_advisory_receipt. Acceptable per the author's own weakest-link note, but no cli_smoke path reaches it.
- artifact-verifier failed with exit 2; in this lane it does not affect worker-handoff semantics (no JS artifacts in this PR) but should be retried because it gates the same fixtures the diff regenerates.
Verification questions
- Confirm new public visibility widenings (git_merge_base_is_ancestor, EditCagePolicy::untracked_build_lockfile, AttemptHeadLineage, AttemptDelta.comparable semantics) cross module boundaries but stay inside one Rust process. serde Serialize/Deserialize derives on EditCagePolicy (skip_serializing_if=Option::is_none) keep legacy JSON baselines round-trip-safe, so prior persisted packets decode.
- Confirm trusted-surface diff is anchored at the prepared head, so a committed production change hidden by a later restore still refuses.
Refuted
- A second, parallel head-lineage helper for the receipt-binding path would let the receipt skip the duplicate merge-base invocation and stay in sync with
attempt_head_lineage's error semantics.; refuted because: The two callsites differ: receipt_binding only needs the descendant branch and runs after a finish that already validated lineage, while attempt_head_lineage is used by the CLI pre-flight and analysis_input_changes. Routing receipt_binding through AttemptHeadLineage would couple the receipt binder to the helper's Result type and tocurrent_git_head's second read, which the binder currently does anyway. The duplication is two lines and is parked, not blocking. - PR diff is pure Rust + JSON fixtures + Markdown; no JS, WASM, WebAssembly-bindgen, napi, deno_core, JNI, or Node addon touched. Zero async runtime tokens (async fn, .await, tokio::spawn, JoinHandle, AbortController) in the 8 changed Rust files; all crossings are synchronous serde_json / serde bincode in the same OS thread.
- No ArrayBuffer/TypedArray/active-view region semantics are reachable from this diff; Rust side holds serde_json values and Vec git output, and the policy field untracked_build_lockfile gates Cargo.lock at the path-rule layer, not as a slice over a backing store.
- All 'handoffs' are intra-thread serde_json::Value / typed structs over stdin/stdout or filesystem artifacts (target/ripr/*); no Transferable, ArrayBuffer, SharedArrayBuffer, postMessage, MessageChannel, structured clone, or Atomics primitive is reachable from this diff.
- Async capture or detached worker could outlive the closure passed to workspace_named_file_identities_relative(|lockfiles| git_tracked_lockfiles(...)) and observe a freed PathBuf/Vec.; refuted because: lockfile_scope is an FnOnce invoked synchronously inside workspace_named_file_identities_relative on the calling thread; the returned (PathBuf, Vec) vectors are owned and die with the caller frame. No async block, Future, Box, or background task is constructed, so no captured state can outlive the closure.
Evidence gaps
- Model proof intent was rejected by deterministic validation.
Parked follow-ups
- attempt_head_lineage / analysis_input_changes are new sibling helpers under repair_attempt, used by cli/commands/agent.rs. There is no separate helper to compute lineage for the receipt rerun path; receipt_binding re-reads current_git_head and re-runs merge-base inline rather than going through attempt_head_lineage. Functional, but a parked follow-up to reuse the helper.
Requested by Steven · project thread
Stacked on #3957. The base is
claude/onboarding-repair-cage-build-output, which now includes current main (52288fefd). The diff is this PR's one commit,ef517e3dd. When #3957 merges, this retargets tomain.Before: a new user following the repair start (
ripr agent repair --phase before, write the test,cargo test,--phase after) hit four dead ends in the first 15 minutes, found in the onboarding re-walk:Cargo.lock, the firstcargo testcreates one. The after phase then refused withripr: agent verify artifacts are incomparable: analysis input identities differ, exit 2, and didn't say which input changed.invalid("Analysis outcome artifact base does not match its typed identity."). Since fix(check): record the loader-resolved base in the JSON envelope (#3940) #3958 the scope-less envelope names the resolved base (main), but the typed outcome identity keptbase_revision: null. The CLI still printed "result … improved" and "next: Keep the focused test and include this receipt in review."ripr agent receipt … --out target/ripr/reports/agent-receipt.jsonagain after the after phase failed withrepair attempt after verdict binding is tampered or stale, because the first run's own report write counted as a new change.After, on the same sample repo with
--root .throughout:Cargo.lockcreated bycargo testis treated as build state, and the after phase returns anadvisoryreceipt with movementimproved.Cargo.lockstill refuses. The refusal now names the input (ripr: analysis inputs changed after the before phase: Cargo.lock.), gives thegit checkout <head> -- Cargo.lockrecovery, and leaves the attemptawaiting_edit.advisory, and the top-level base equalsidentity.base_revision.ripr agent statusprintsStatus: complete.advisoryreceipt. Any other status prints why the receipt is not review evidence.git reset --soft <before-head>.--outor on stdout.How: each fix sits at its semantic owner rather than in a renderer.
agent/artifact.rs: the analysis input identity (nowinput:v4) counts only lockfiles Git tracks. If Git fails, every lockfile counts.edit_cage.rs:untracked_build_lockfile(exactlyCargo.lockfor Rust packets);HeadMovement::AdmitDescendantCommits, which foldsgit diff --name-status <before-head> <HEAD>into the same cage rules;without_later_operational_writes, used only by receipt binding.analysis/pipeline.rs::bind_effective_base: binds the loader's resolved base into the typed outcome identity when the caller gave none.Summary
cargo testbetween the phases, a scope-less base, and a committed test.agent repair#3906 (outcome 1, status resumes to completion). Does not close ux(agent): follow-up guidance routes to the low-level loop instead ofagent repair#3906 or ux(0.11): prove a blind installed shift-left agent journey before the swarm cut #3797.Swarm / Source Boundary
ripr-swarmSource-of-truth Links
Spec: RIPR-SPEC-0134 (updated); docs/REPAIR_ATTEMPT.md ("Committing between the phases"); docs/OUTPUT_SCHEMA.md
Issue: #3906 (partial). Parent: #3797
Scope Classification
Production delta:
input:v4, tracked lockfiles only);untracked_build_lockfile;Single acceptance criterion: the repair transaction reaches an
advisoryreceipt andStatus: completeacrosscargo test, a scope-less base, a committed focused test and a receipt rerun, while production edits and tracked-input changes still refuse.Non-goals:
--baseor diff-file run records.Decisions (overrule on review)
check --format jsonartifact rejected by ripr's own outcome validator.changed_paths, and not a rename. The verdict is recomputed from the filtered delta, and the digest comparison is unchanged.input:v4makes a before phase from an older binary incomparable with an after phase from this one. The refusal names the reason and the rerun route. This only matters across an upgrade in the middle of an attempt.Support-tier Impact
Claim/proof notes:
first-useful-action/unchanged-after-attemptfixtures are regenerated for the v4 identity. Their content digest matches production output.Policy Impact
Ledger or exception notes:
fixtures/boundary_gap/expected/first-useful-action/unchanged-after-attempt/{before,after}.repo-exposure.json,agent-verify.json,agent-receipt.json. No other golden changed.Proof
Run on
ef517e3dd(Linux,CARGO_INCREMENTAL=0). The later merge commits change no files relative to it.cargo fmt --check: exit 0cargo test -p ripr --lib: 5315 passedcargo test -p ripr --tests --no-fail-fast: 5635 passed, 0 failedcargo xtask goldens check,check-output-contracts,check-fixture-contracts: each exit 0cargo clippy -p ripr --all-targets -- -D warnings: exit 0cargo xtask precommit: exit 0New end-to-end tests (
cli_smoke):agent_repair_admits_a_cargo_lock_first_generated_between_the_phases: asserts the precondition?? Cargo.lock, the advisory receipt, base equals identity base, and three receipt reruns. As a negative, an unboundnotes.txtmakes the rerun fail.agent_repair_refuses_a_tracked_cargo_lock_change_between_the_phases: covers a modified tracked lockfile and a staged generated lockfile, then the recovery.agent_repair_admits_a_focused_test_committed_between_the_phases: covers a committed test, a committed production change, and an amend.Negative controls: 13, each reverting one production change. The full table is in the first comment on this PR. For example:
bind_effective_basebreaks 4;The weakest: receipt next-step gating (NC5) is caught only by a unit test, because the ordinary flow no longer produces an invalid receipt end to end.
Not run: the Windows lane, and
cargo test -p xtask(it is outside this diff's packages).Claim Boundary
May claim: the repair transaction completes across
cargo test, a scope-less base, a committed focused test and a receipt rerun, and still refuses production edits and tracked-input changes.Not yet, found and left open:
summary.next_action.recommended_actionin the receipt JSON still says "include this receipt in review" for aninvalidreceipt. Only the CLI line is gated.rootas a display string, so a receipt rerun with--root .after phases run with an absolute root (or the reverse) isinvalid. The ordinary flow uses one spelling throughout.changed_pathsstill liststarget/riproperational writes (F15-11).Rollback
Revert this PR's commits. Attempts started with this binary would then be incomparable (
input:v4) and need a fresh before phase.Spec-Test-Code Traceability
edit_cage,repair_attempt,pipeline,artifactandcli::commands::agentcrates/ripr/src/{agent/artifact,analysis/pipeline,analysis/seam_cache,app/repair_attempt,cli/commands/agent,edit_cage}.rsStatic Language Check
killed,survived,untested,proven, andadequate.CI Economics
n/a
Engineering Check
panic,unwrap,expect,todo, orunimplementedin production code.panic,unwrap,expect,todo, orunimplementedin tests.Gates
cargo fmt --checkcargo clippy -p ripr --all-targets -- -D warningscargo xtask precommitMerge interaction: this and #3982 (agent status reports the attempt outcome) both edit
app/repair_attempt.rs, and a trial merge conflicts there. Whichever lands second resolves it. Clean against #3931 and #3876.🤖 Generated with Claude Code
https://claude.ai/code/session_01JR38133FoyEXqWZtnC9UeK