Skip to content

fix(rust): credit a Display write! tail pinned by an exact to_string assertion - #9682

Merged
EffortlessSteven merged 6 commits into
mainfrom
claude/project-thread-9lsalp
Oct 22, 2026
Merged

EffortlessSteven merged 6 commits into
mainfrom
claude/project-thread-9lsalp

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Summary

Fixes #9608. idiom-display-string-pin (impl Display for Temp with write!(f, "{}°C", self.0), pinned by assert_eq!(Temp(21).to_string(), "21°C")) read weakly_exposed although both runtime mutants fail the test. It now reads exposed/credited. Two links were missing, both closed conservatively:

  1. Propagation. format_tail_witness also reads a fmt whose whole body is one write! into its own formatter parameter (string-literal format, plain arguments, no format!/write! rebinding in the file), tagged fmt_write_owner_tail.
  2. Observation. assertion_pins_display_string admits an exact-value assert_eq! with one string-literal side and one value.to_string() side, where value is typed as the owner's self type, the owner is Display, no inherent to_string competes, and the test reaches fmt by dispatch. The write-tail credit applies only when the probe changes string-literal text alone (changes_only_string_literals), so an argument change invisible at the test value stays weak.

No actionability widening. The seam cache schema advances to 1.93 / 0.100 (fixture content hashes and receipts recommitted).

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-0297 (new "Pinned Display output" section)
Governing issue or accepted claim: #9608
Acceptance delta (one sentence): idiom-display-string-pin moves from false actionable to credited, its known-false file is removed, and no other corpus row moves.

Candidate Relationships

Candidate branch: claude/project-thread-9lsalp
Stack parent or prerequisite PR (if any): none (#9629 merged)

Scope Classification

  • Production change with spec, test and corpus evidence

Proof

cargo test -p ripr --lib display_ write_into_the_formatter   # new tests pass
cargo test -p ripr --test cli_smoke first_useful_action      # pass after hash recommit
cargo xtask verdict-corpus check   # 590 cases, false 15/590, contradictions 0, traps credited 0/33
cargo xtask check-fixture-contracts # pass
cargo xtask precommit              # exit 0

Moved rows: only idiom-display-string-pin. Negative controls cover another receiver type, unknown receiver, computed expected string, no literal side, non-assert_eq!, Debug owner, write! into a non-formatter, non-fmt method, statement before the tail, non-literal format, ? in an argument, and an argument-only change.

Claim Boundary

May claim: a write-only Display::fmt is credited when an exact to_string() assertion pins its whole output. Must not claim: format!/{} pins, computed expectations, or Debug owners are read.

Static Language Check

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

🤖 Generated with Claude Code

https://claude.ai/code/session_01JfeyhVjKnck3hhzL3soJz1

…assertion (#9608)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JfeyhVjKnck3hhzL3soJz1
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

  • Ask an admin to enable usage-based reviews

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Next included review available in 14 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 107 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: c003d54e-8a7e-47a1-9e23-de459e58920b
📥 Commits

Reviewing files that changed from the base of the PR and between cc069d3 and 2973d6c.

📒 Files selected for processing: 21
  • .ripr/traceability.toml
  • changelog.d/9608-display-string-pin-credit.md
  • crates/ripr/src/analysis/classifier/evidence.rs
  • crates/ripr/src/analysis/classify/mod.rs
  • crates/ripr/src/analysis/classify/propagation_witness.rs
  • crates/ripr/src/analysis/classify/related_tests.rs
  • crates/ripr/src/analysis/classify/related_tests/fmt_dispatch.rs
  • crates/ripr/src/analysis/classify/reveal.rs
  • crates/ripr/src/analysis/seam_cache.rs
  • crates/ripr/tests/lsp_lifecycle/gap_corpus_currentness.rs
  • docs/OUTPUT_SCHEMA.md
  • docs/specs/README.md
  • docs/specs/RIPR-SPEC-0297-display-debug-fmt-dispatch-reach.md
  • fixtures/boundary_gap/expected/first-useful-action/unchanged-after-attempt/after.repo-exposure.json
  • fixtures/boundary_gap/expected/first-useful-action/unchanged-after-attempt/agent-receipt.json
  • fixtures/boundary_gap/expected/first-useful-action/unchanged-after-attempt/agent-verify.json
  • fixtures/boundary_gap/expected/first-useful-action/unchanged-after-attempt/before.repo-exposure.json
  • fixtures/rust-verdict-corpus/expected/rows/idiom-display-string-pin.json
  • fixtures/rust-verdict-corpus/known-false/idiom-display-string-pin.toml
  • fixtures/rust-verdict-corpus/spec-coverage.toml
  • xtask/src/tests/rust_corpus_projection.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Verification questions

  • Confirm the literal detector treats any quote-delimited text as a string literal, so malformed Rust syntax such as a prefixed raw string or a non-string byte literal is not exercised or rejected explicitly.
  • Confirm the changed test route covers constructor and local-variable receivers, but does not establish a complete sibling scan for method-call syntax, qualified paths, macro-generated assertions, or alternate direct-output owners.
  • Confirm observation matching duplicates source-offset reconstruction already performed by the fmt-dispatch module and assumes the literal operand text occurs once verbatim in the test body.
  • Confirm literal detection appears delimiter-based rather than AST-based, so valid Rust string literal forms may be rejected inconsistently.
  • Confirm the assertion parser accepts only an exact no-space .to_string() spelling despite valid Rust whitespace before the call parentheses; this is an untested compatibility edge in the newly recognized oracle.

Refuted

  • The PR changes an active-view consumer whose snapshot can become stale after resize, detach, or transfer.; refuted because: The diff is confined to Rust static analysis, syntax parsing, fixtures, and documentation. None of the reviewed code reads or mutates JavaScript buffer state, so this lane has no applicable object-lifetime or active-view transition to review.
  • The change may credit neighboring write!, format!, Debug, or assertion routes that are not the requested exact Display pin.; refuted because: Changed witness and observation guards constrain the route to a sole write into the owner's formatter and an exact literal-versus-typed-to_string assertion; documented exclusions cover the neighboring forms.
  • The new credit path may be gated by ordinary owner-return or fallible-check evidence, making the corpus fixture insufficient.; refuted because: The changed evidence closure explicitly recognizes fmt_write_owner_tail and calls assertion_pins_display_string, so the PR includes a distinct route for this credit.

Evidence gaps

  • Execution-time safety and regression behavior still depend on the scheduled cargo-test receipt; this lane found no static lifetime defect.
  • The implementation leaves the scheduled cargo-test receipt unobserved in this lane.
  • Model proof intent was rejected by deterministic validation.

Parked follow-ups

  • Offset-based recovery of the compared to_string expression could theoretically choose a duplicate textual receiver in a malformed assertion representation.

… the Display pin (#9608 review)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JfeyhVjKnck3hhzL3soJz1
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JfeyhVjKnck3hhzL3soJz1

Copy link
Copy Markdown
Member Author

Review of record, head 683084b (code reviewed at 1f75548, then repaired)

Two independent reviewers inspected the diff from different angles.

Correctness / false credit. Confirmed one real problem: the Display pin admitted any exact to_string() literal pin, so an argument change such as self.0 to self.0 * 2 was credited at a test value of 0 (output stays "0C"), while the equivalent format! owner correctly stayed weak. Repaired: the pin is admitted only when the probe's before and after differ solely inside string literals (changes_only_string_literals). Re-ran the reviewer's repro: now weak; idiom-display-string-pin stays exposed. Other probes fail closed as intended: same-named type in another module, shadowed let, assertion on another type, {:.2} precision, generic impls.

Tests / spec / contract.

  • Cache schema was not bumped: bumped to 1.93 / 0.100 with the lockstep test, docs and portable-snapshot parity updated.
  • Traceability and spec README did not list the new tests, code paths or fixture: added.
  • Test gaps: added negatives for a computed expectation, a doubled literal, a repeated side, write rebinding, writeln!, and the literal-only gate; added an end-to-end fmt_write_owner_tail witness test.
  • callee != "fmt" was broader than its comment: now scoped to Display/Debug impl owners.
  • A literal side is now a single string token; a side repeated in the test body fails closed.
  • Ledger counts rewritten to 15 / 590 (main's row was stale at 17 / 579; the measured count on main is 16 / 590).

Proof (before the final main merge). cargo xtask precommit exit 0; verdict-corpus check 590 cases, 15 false, only idiom-display-string-pin moved; lib tests pass except the known offline-anyhow fixture. Also raised trap_floor to 33 as the check recommended.

State. Main currently fails to compile (E0425, #9701), so I have not applied merge-ready; will apply it after #9701 lands and main is merged in.


Generated by Claude Code

@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 22, 2026 13:57
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@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.

Confirmed findings

  • No unsafe, raw-pointer, native FFI, reference-storage, or thread-sharing seam was introduced; the flagged native-risk surface is consumed advisory-only.
  • The added write-tail parser keeps syntax-tree borrows local and converts syntax text to owned strings before matching or returning.

Verification questions

  • Confirm the exact Display-string oracle uses byte offsets only within the existing masked test-body string and rejects ambiguous occurrences before dispatch.
  • Confirm literal recognition is delimiter-based rather than Rust-AST-based, leaving valid literal forms unsupported and incompletely tested.
  • Confirm the observation parser recognizes only the compact .to_string() spelling.
  • Confirm the observation route is narrower than the PR's broad wording: it requires assert_eq!, exactly two operands, one quote-delimited side, an exact .to_string() spelling, and a uniquely located receiver occurrence.

Refuted

  • A passing static packet is sufficient despite failed ripr evidence.; refuted because: That premise is false: ripr exited 2, so the central late cargo-test receipt and ripr output remain required evidence before a merge verdict.
  • This Rust classifier change may cross a JavaScript worker/GC/detach/transfer lifetime boundary.; refuted because: The inspected production and test paths contain no JavaScript execution, asynchronous handoff, managed-memory conversion, or transfer/detach operation; all new evidence operates on owned Rust source text and indexed facts.
  • The exact to_string oracle could falsely credit a changed argument such as self.0 to self.0 * 2 at test value zero.; refuted because: The evidence requires before/after probe text to differ only inside string literals; an argument-only or mixed change fails closed.
  • The new exact literal oracle broadly credits any exact to_string assertion.; refuted because: It additionally requires Display ownership, typed receiver, dispatch reach, no competing inherent to_string, unique operand occurrence, and literal-only mutation.

Evidence gaps

  • End-to-end execution evidence is incomplete in the supplied packet because rip r failed and cargo-test was only scheduled, although focused negative tests and seeded review evidence address the main concern.
  • Model proof intent was rejected by deterministic validation.

…ma 1.93

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JfeyhVjKnck3hhzL3soJz1
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JfeyhVjKnck3hhzL3soJz1

@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.

Verification questions

  • Confirm the observation oracle silently rejects valid whitespace between to_string and its call parentheses.
  • Confirm the newly added sibling oracle recognizes only compact .to_string() syntax and quote-delimited string literals, leaving valid syntax variants uncredited.
  • Confirm the source route remains syntactically narrower than broad Rust string-literal and method-call parsing, especially for escaped strings and whitespace before to_string parentheses.
  • Confirm the literal-only gate is delimiter-based rather than Rust-syntax-based, so its admitted mutation boundary is narrower and differently shaped than the documentation's generic string-literal terminology.
  • Confirm the seeded parser questions remain coverage boundaries rather than claim violations: the implementation recognizes ordinary quote-delimited literals and the exact compact .to_string() suffix.

Refuted

  • Static evidence is sufficient despite the ripr sensor exiting 2.; refuted because: Not accepted: the failed analyzer receipt and scheduled cargo-test receipt remain required before a merge-level verdict, although this lane found no separate source-route defect.
  • The change introduces a native safety or thread-sharing risk.; refuted because: unsafe-review reported no new/worsened gaps, and the changed logic uses owned strings and local syntax matches without unsafe or FFI additions.
  • No ArrayBuffer, TypedArray, resize, detach, transfer, or stale-length backing-store state is introduced by the changed Rust analyzer paths.
  • The active-view matcher could read beyond a resized or detached view and misclassify a Display pin.; refuted because: No resizable active-view abstraction or asynchronous backing-store lifecycle exists in the changed surfaces. The matcher validates the current masked body and requires a unique operand occurrence; malformed or unsupported syntax fails closed.
  • The native-risk classification could conceal a memory-safety issue.; refuted because: unsafe-review completed with no new gaps, and the changed Rust paths contain no unsafe or raw-pointer operations; syntax borrows remain local and strings are owned before classification.

Evidence gaps

  • Required executable red/green evidence is not closed in the supplied packet because ripr failed and the late cargo-test receipt is absent.
  • Model proof intent was rejected by deterministic validation.

Copy link
Copy Markdown
Member Author

Review of record for head 2973d6c (changes since the reviewed 688cea7 are the main merge, recommitted unchanged-after-attempt fixture hashes and the per-row ledger move).

Angles reviewed by independent agents: correctness and edge cases, tests and regressions, spec and contract, false-credit adversarial probes.
Findings: the argument-change-invisible-at-the-test-value false credit (self.0 to self.0 * 2 at 0) was real and is fixed by the literal-only gate; missing cache schema bump fixed (1.93 / 0.100); the over-broad callee != "fmt" was scoped to Display/Debug impl owners. The github-actions bot's later questions are coverage boundaries of the compact .to_string() / quote-delimited spelling, which fail closed (no credit), not defects.
CI on this head: Ripr Rust Small Result success, feature lane success, 0 unresolved threads. Corpus: 590 cases, false 15/590, contradictions 0.


Generated by Claude Code

@EffortlessSteven
EffortlessSteven merged commit 8fbe8bd into main Oct 22, 2026
51 checks passed
@EffortlessSteven
EffortlessSteven deleted the claude/project-thread-9lsalp branch October 22, 2026 15:43

Copy link
Copy Markdown
Member Author

Post-merge read of #9682 on main (correctness and false-credit angle; read-only, not executed). #9694 is also already merged, so I did not review it.

Finding: changes_only_string_literals also admits a changed format placeholder, which an exact to_string() pin may not see. (classify/related_tests/fmt_dispatch.rs, changes_only_string_literals.)

The function removes string-literal contents and compares what is left, so any edit inside the format string counts as a literal-text change, including the placeholders. For write!(f, "{}°C", self.0) pinned by assert_eq!(Temp(21).to_string(), "21°C"):

  • "{}°C" to "{:?}°C" prints 21°C for an integer; the pin still passes.
  • "{}" to "{0}", "{:}", or "{:<1}" (width no wider than the value) likewise print the same for the chosen value.
  • "{{" / "}}" escape changes can cancel on a value that does not use braces.

The doc comment's argument ("a literal fragment is written whatever the test passes in") holds for text outside {..} but not for the placeholder itself, so the tail is credited exposed where a mutant survives. That is the false-credit direction we fail closed on, though narrow.

Fix. Treat a changed string as literal-only only when the diff leaves every {...} placeholder sequence identical (compare the ordered list of {..} groups after unescaping {{ / }}; refuse if any differ), and add negatives: "{}°C" to "{:?}°C", to "{0}°C", and a {{ escape edit, each staying weakly_exposed; plus a positive where only the °C text changes.

Not established: whether the corpus has a hostile row for this. idiom-display-string-pin itself is unaffected, so no existing row would catch it.


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(rust): a Display impl pinned through to_string() reads as a weak gap

2 participants