Skip to content

fix(classify): propagate a returned tail comparison to its return value - #3985

Merged
EffortlessSteven merged 2 commits into
mainfrom
claude/language-quality-kairya-rust-xcrate
Sep 24, 2026
Merged

EffortlessSteven merged 2 commits into
mainfrom
claude/language-quality-kairya-rust-xcrate

Conversation

@claude

@claude claude Bot commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

Requested by Steven · project thread

Summary

Before: fn ships_free(items: u32) -> bool { items >= 10 } changed from >. It is reached through a wrapper at 20 and 2 items, and the test uses assert_eq!. The start-here gap said Missing discriminator: No strong discriminator was detected and Replace broad assertions with exact equality…, which is wrong advice for a test that already uses exact equality.

After: the gap says Missing discriminator: items == 10 and Add boundary tests for below, equal, and above the changed threshold with exact assertions. The output is the same whether the test calls the owner directly or through a wrapper, in one crate or across crates.

How: the cause was the tail-expression shape, not the crate boundary. A single-crate direct-call repro produced the same output. The changed comparison produces two probes. The predicate probe had no flow sink, because predicate_flow_sinks in analysis/classify/flow.rs looks only for a return fact, branch or field. So it fell to propagation_unknown 0.66, although it already held a strong oracle and missing items == 10. The duplicate return_value probe then won triage with its generic text.

The new predicate_as_owner_tail treats the changed predicate as the returned value only when all of these hold:

  • the signature has ->;
  • the changed text is the whole probe expression;
  • the line has no ; and does not start with if, let, return, match or while;
  • only the closing } follows.

Predicates retargeted from a changed let initializer keep their RIPR-SPEC-0158 limitation.

Found in the onboarding thread's new-user re-walk (F15-14).

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-0001, which gains the tail rule. RIPR-SPEC-0158 governs the excluded let-retarget case.
Issue: none filed. The re-walk evidence is F15-14.

Scope Classification

  • One production behavior

Single acceptance criterion:

  • A changed comparison that is an owner's entire tail expression flows to the returned value.

Decisions (overrule on review)

  • Narrowed rather than reblessed. The first cut drifted six goldens. binding_value_fail_closed and binding_value_family_matrix became actionable boundary advice despite binding_predicate_non_claim, which would be a wrong promotion. The rule now excludes let-retargeted predicates, and all existing goldens pass unchanged.
  • Dropped change. Giving the return_value probe on a bare comparison the boundary next step was tried and reverted. It told a user whose test already sits on the boundary to add boundary tests, which would be a new false actionable signal.

Support-tier Impact

  • none

Policy Impact

  • none. The predicate probe moves from propagation_unknown to weakly_exposed with a named discriminator.

Proof

At 08a734f:

cargo test -p ripr --lib                            # 5306 passed
cargo xtask goldens check                           # pass, no existing golden changed
cargo xtask fixtures / check-fixture-contracts      # pass
cargo fmt --check; cargo clippy -p ripr --all-targets -- -D warnings   # pass
cargo xtask precommit                               # exit 0
  • Positive test: predicate_that_is_the_owner_tail_flows_to_the_returned_value.
  • Negative test: predicate_tail_sink_fails_closed_off_the_bare_returned_comparison covers a unit owner, a comparison continued by && on the next line, a let-bound comparison and a retargeted-binding predicate.
  • Mutation checks: disabling the tail call fails the positive test, and removing the retarget guard fails the negative test.
  • New fixture tail_comparison_boundary:
    • The wrapper-reached ships_free names items == 10.
    • earns_gift, tested on its boundary, has its predicate probe exposed.
  • Re-walk ws:
    • The summary goes from 1 exposed, 1 weak, 7 unknown to 1 exposed, 2 weak, 6 unknown.
    • pricing and pricing-lit full output is byte-identical to main.

Not established:

Claim Boundary

May claim: a changed tail comparison now names its equality boundary instead of generic assertion advice. Must not claim: returned-bool probes are deduplicated.

Rollback

Revert the commit. The fixture and spec text revert with it.

Spec-Test-Code Traceability

  • Spec: RIPR-SPEC-0001
  • Tests and code: analysis/classify/flow.rs
  • Fixture: fixtures/tail_comparison_boundary/

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 or tests.

🤖 Generated with Claude Code

https://claude.ai/code/session_018QP9k41E538Xgytw8QCSfM


Generated by Claude Code

A changed comparison that is the whole tail expression of a `-> bool`
owner (`items >= 10`) had no flow sink: predicate flow looked only for a
return fact, branch, or field after the changed line, so the predicate
probe fell to propagation_unknown. The parallel return_value probe, whose
assertion-token confirmation cannot match a returned boolean, then won
triage with "No strong discriminator was detected" and the broad-assertion
next step, hiding the missing `items == 10` boundary.

Predicate flow now recognizes the owner tail: a non-unit signature, a
changed line that is exactly the comparison (no `;`, `if`, `let`,
`return`, `match`, `while`), and only the closing brace after it. A
predicate retargeted from a changed `let` initializer is excluded, so its
RIPR-SPEC-0158 operand-value limitation is unchanged.

Adds the tail_comparison_boundary fixture and records the rule in
RIPR-SPEC-0001.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018QP9k41E538Xgytw8QCSfM
@claude
claude Bot requested a review from EffortlessSteven September 23, 2026 11:26
@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: 60fef73d-6e61-4242-96ef-a40dd6c77736

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

  • Parallel return_value probe on the bare returned comparison (probe:src_lib.rs:return_value:b8337f94 / 04f99ee4) still emits the generic Replace broad assertions with exact equality... advice, even though the predicate probe is the correct gap. The PR explicitly defers dedup; carriers should be aware that on -> bool tail owners two findings will report, only one is actionable.

Verification questions

  • Confirm rule gates on body line text equality between masked-body line at probe line and trimmed probe.expression; if a user reformats with trailing comment or whitespace-only differences the tail will silently not match.
  • Confirm mutation claim (disable tail call fails positive; remove retarget guard fails negative) is asserted in PR body but no cargo-mutants receipt — profile disables heavy witnesses. Author's local test claim is the only attestation. Non-blocking because behavioral tests + golden already substantiate the rule, but the mutation story is unverified here.

Refuted

  • Tail-comparison sink rule is reached before nearest_return because predicate_as_owner_tail runs first in predicate_flow_sinks; masked-string check makes it conservative.

Parked follow-ups

  • Offset 0 guard silently drops the sink if the changed line is the signature line; not exercised by any test, but could surprise if a probe maps to line 1.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.

The tail-comparison sink compared the changed line, the probe expression,
and the probe's after text as raw text, so a trailing `// note` on the
returned comparison silently dropped the sink. All three are now compared
after masking comments and strings; the sink text is the code alone.

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

claude Bot commented Sep 23, 2026

Copy link
Copy Markdown
Contributor Author

This is my response to review 5290522343. The fix for one finding is in a82e352.

Fixed: a trailing comment dropped the tail sink. The review's first verification question was correct. predicate_as_owner_tail masked the owner body but compared it with the probe expression and after text as raw strings. So items >= 10 // free-shipping line did not match, and the sink was dropped silently. All three are now compared after mask_rust_comments_and_strings plus trim, and the sink text is the code alone. The new test is predicate_tail_with_a_trailing_comment_still_flows_to_the_returned_value. It fails when the comparison is reverted to raw text (32 passed, 1 failed). SPEC-0001 now says that comments are ignored when the line is matched. Whitespace-only differences were already handled by the trims.

Mutation receipt for the PR body's claim, re-run locally on this head:

Mutant Result
Tail rule disabled (predicate_as_owner_tail(..).filter(|_| false)) Two tail tests fail. Golden tail_comparison_boundary drifts [exposed, weakly_exposed] → [propagation_unknown, weakly_exposed]
Retarget guard removed (the after == expression check) predicate_tail_sink_fails_closed_off_the_bare_returned_comparison fails

Unmutated, 33/33 flow tests pass. goldens check and precommit pass.

Kept as-is:

  • The parallel return_value probe still says "Replace broad assertions" on a -> bool tail owner. This is known and is a named follow-up in the PR body. Dedup belongs to the reveal side, not this sink rule.
  • The offset == 0 guard applies when the changed line is the signature line, as in a single-line fn f(x: u32) -> bool { x > 10 }. The rule then declines and the pre-existing behaviour holds, so it fails closed rather than inventing a sink. I left it deliberately without a test in this PR.

Generated by Claude Code

@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

  • Helper duplication risk: tail_owner mirrors function(...) except returns: Vec::new(). Since returns is not consulted by predicate_as_owner_tail, a shared helper or inline construction would avoid drift if returns ever becomes part of the test.

Verification questions

  • Confirm offset arithmetic probe.location.line.checked_sub(function.start_line) assumes probe lines and function.start_line share a coordinate space. If FunctionSummary.start_line is the signature line (1-based) and probe lines are also 1-based within the same file, the nth(0) on the masked body after taking the signature line still skips the signature. Verify with an integration test where the owner signature is multi-line or the function lives in a module with leading attributes.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.
  • Mutation receipt is asserted in the PR body but no cargo-mutants artifact; behavioral tests + golden are the only attestation.

@EffortlessSteven
EffortlessSteven merged commit a72a75f into main Sep 24, 2026
25 checks passed
@EffortlessSteven
EffortlessSteven deleted the claude/language-quality-kairya-rust-xcrate branch September 24, 2026 04:46
claude Bot pushed a commit that referenced this pull request Sep 24, 2026
…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
claude Bot pushed a commit that referenced this pull request Sep 24, 2026
…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)
claude Bot pushed a commit that referenced this pull request Sep 24, 2026
…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)
claude Bot pushed a commit that referenced this pull request Sep 24, 2026
…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)
claude Bot pushed a commit that referenced this pull request Sep 24, 2026
…lt-base change

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

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)
EffortlessSteven pushed a commit that referenced this pull request Sep 24, 2026
…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)
EffortlessSteven added a commit that referenced this pull request Sep 24, 2026
Forward-only merge of main a4db66c (GREEN). Resolutions:
- fixtures/python_*/expected/CHANGELOG.md (5 files): both appended
  Pending bless sections kept; PR RIPR-SPEC-0028 entry stays (3),
  main's later RIPR-SPEC-0084 entry (#4002) appended as (4), keeping
  headings unique per the accumulated-bless-log design (goldens check
  does not compare CHANGELOG.md bytes).
- expected/check.json auto-merge verified: main's base/base_revision
  None change (#3952) combined with this PR's evidence additions;
  input_identity unchanged per fixture.
- No product-code conflicts; main's flow.rs tail-comparison (#3985) is
  Rust-only and semantically consistent; main's related_tests.rs
  src-layout matching (#3944) only widens the strong-call set this
  PR's boundary rule consumes.
EffortlessSteven pushed a commit that referenced this pull request Sep 24, 2026
…d repair (#3960)

* 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

* 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(test): pass the changed-line flag in the gate repair-start test

`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)

* test(fixtures): regenerate the packet-index Markdown goldens for the 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)

* test(fixtures): rebless two check goldens blessed before the no-default-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)

---------

Co-authored-by: Claude <noreply@anthropic.com>
EffortlessSteven added a commit that referenced this pull request Sep 24, 2026
…el and the evidence ledger (#3962)

* 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

* 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(test): pass the changed-line flag in the gate repair-start test

`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)

* test(fixtures): regenerate the packet-index Markdown goldens for the 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)

* test(fixtures): rebless two check goldens blessed before the no-default-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)

---------

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

* 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

* 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(first-pr): stop on unusable review cards instead of reporting no gap

Re-walk F60-10. On a fresh Rust checkout, following first-pr's own next
commands (repo exposure, then gap ledger) ended in `State: no actionable
gap` with no next command, while the PR had a repair-ready seam. The
repo-exposure ledger holds only repo-scoped records, so first-pr's second
source, the review cards, decides; with the cards missing, first-pr gave
a no-action verdict on evidence it never read.

Now a Rust root stops on the cards instead:
- missing: `missing_artifact` for `PR repair cards`, next command the
  seam-level `ripr review-comments --root . --base <base> --head <head>
  --out target/ripr/review/comments.json`;
- not a RIPR report, or no status/root/base/head: `malformed_artifact`;
- status not advisory: `blocked_artifact`;
- another root: `wrong_root`; another base or head: `stale_artifact`.
Current cards with no repair start, and cards rendered from the gap
ledger, still end in no-action with the reason naming the route.

The `artifacts[]` entry for the cards on a Rust root now names the same
seam-level command. It named the `--gap-ledger` form, whose cards cannot
carry a repair start. Preview-language roots keep the gap-ledger form.

Fresh-checkout re-walk on the pricing repo: repo exposure, gap ledger,
review cards, then `top_gap` with `Start repair: ripr agent repair ...
--phase before`.

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

* fix(test): pass the changed-line flag in the gate repair-start test

`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)

* test(fixtures): regenerate the packet-index Markdown goldens for the 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)

* test(fixtures): rebless two check goldens blessed before the no-default-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)

* test(first-pr): cover the malformed review-card branches in the fail-closed loop

Another tool's report, and reports that do not record their status, root or
head, each stop first-pr as malformed_artifact with the seam-level
regeneration command. Only the stale, blocked, wrong-root and missing cases
were exercised before. Disabling the tool check fails the test.

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

---------

Co-authored-by: Claude <noreply@anthropic.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