Skip to content

fix(rust): name the trait-dispatch ambiguity for a helper called from implicit-dispatch trait impls (#11719) - #11804

Merged
EffortlessSteven merged 4 commits into
mainfrom
claude/trait-dispatch-reach
Oct 31, 2026
Merged

EffortlessSteven merged 4 commits into
mainfrom
claude/trait-dispatch-reach

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

Requested by Steven · project thread
Governing issue or accepted claim: #11719
Acceptance delta (one sentence): a helper called from implicit-dispatch trait impls (dtolnay/semver display::pad) reads a named trait-dispatch ambiguity limitation instead of a bare "no related test was found".

Summary

  • A no_static_path finding whose owner is called from an impl Trait for X method with an implicit-dispatch name (fmt, eq, ...) that the crate implements more than once now carries a rust_transitive_reach_unresolved limitation naming the trait-dispatch ambiguity, with the calling impls as bounded candidates.
  • Class (no_static_path), reach (no), related tests and actionability are unchanged; no runtime claim. It is the last arm of the witness chain, after the proof-harness arm, so no traced or structural witness is displaced.
  • Review follow-ups: a #[cfg(test)] impl block is neither an impl nor a caller (read via cfg_predicates::attribute_requires_test); inherent fmt methods do not count; Self::pad(..) reads the same as a plain call (pinned); the non-claim now reads "cannot tell whether any test reaches one of these impls".

Governing issue acceptance was amended in an issue comment on #11719.

End-to-end: dtolnay/semver pad (len >= min_width -> len > min_width), ripr check --format human-full

Measured on the first commit (2c48952); the follow-up commit only rewords one sentence and excludes cfg(test) impls, which semver does not have.

Before (main 8f0e1b0): no_static_path (warning, confidence 0.48), reach no, infection unknown: No tests were found, ..., no Static limitation block, a gap id line.

After: still no_static_path (warning, confidence 0.48), reach no. Added Static limitation: rust_transitive_reach_unresolved, last established edge: trait-impl method fmt (Version) -> owner pad, first unresolved edge: test -> one of 13 fmt impls ..., non-claim: named limitation only, and the evidence line "owner pad is called from 1 impl of fmt (Version), one of 13 fmt impls in this crate".

Rule as shipped: fires with >= 2 production same-named trait impls in the crate and >= 1 calling impl (semver pad has exactly one caller), only on no_static_path findings with no other witness and at least one crate test. This differs from the issue's literal "2+ calling impls" text, amended in the issue comment. The gap id (for scripts) line is absent after the change (limited findings drop it, as with the other static-limit kinds).

Proof at head ea0b5c8 (exit codes; flock on every cargo command, CARGO_INCREMENTAL=0)

All exit 0:

  • cargo test -p ripr --lib proximity_reach (40 passed), --lib transitive_reach (96 passed)
  • cargo fmt --check
  • cargo xtask goldens check (after goldens prepare), cargo xtask fixtures
  • cargo clippy -p ripr --all-targets -- -D warnings
  • check-doc-artifacts, check-traceability, check-output-contracts, check-no-panic-family, check-rust-source-role-authority (main's red state fixed by fix(repair): unbreak main after #11596 (role-authority sniff, stale refusal assertions) #11734, merged into this branch)

New negatives: cfg(test)-only impl, inherent fmt (both and mixed), Self::pad call form equal to the plain call.

Independent read-only review of head 2c48952 found no blockers; its follow-ups are in ea0b5c8.

Not run

  • Full cargo xtask precommit after the follow-up, check-pr, dogfood, workspace-wide tests.
  • semver end-to-end was not re-run on the follow-up commit.

🤖 Generated with Claude Code

https://claude.ai/code/session_01YVdGzVWk9FoK366FfhytUg

… implicit-dispatch trait impls (#11719)

A no_static_path finding whose owner is called from an `impl Trait for X`
method with an implicit-dispatch name (fmt, eq, ...) that the crate
implements more than once now names a rust_transitive_reach_unresolved
limitation with the calling impls as bounded candidates. Class, reach,
related tests and actionability are unchanged; no runtime claim.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YVdGzVWk9FoK366FfhytUg
@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 31, 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 36 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 150 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: f033b655-eabf-41c9-9bde-5c06aefe3097
Commits

Reviewing files that changed from the base of the PR and between ca39083 and 6076ee8.

Files selected for processing: 6
  • changelog.d/11719-trait-dispatch-ambiguity-limit.md
  • crates/ripr/src/analysis/classify/mod.rs
  • crates/ripr/src/analysis/classify/transitive_reach.rs
  • crates/ripr/src/analysis/language/rust/mod.rs
  • crates/ripr/src/analysis/language/rust/proximity_reach_tests.rs
  • docs/specs/RIPR-SPEC-0114-rust-transitive-reach-limitation.md
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

…-claim (#11719)

A #[cfg(test)] impl block no longer counts as an impl or a caller (read
through the shared cfg_predicates authority). Pin inherent fmt and the
Self::pad call form. The evidence now says ripr cannot tell whether any
test reaches one of these impls.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YVdGzVWk9FoK366FfhytUg
@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 31, 2026 18:32
@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.

Decision

  • Needs reviewer attention before upstream: findings remain.

Confirmed findings

  • The ambiguity pointer says the owner is called from multiple impls even though the implementation may select one calling impl.

Verification questions

  • Confirm the ambiguity candidate list includes only calling impls, while the unresolved-edge line says the test may reach any of all same-named trait impls.
  • Confirm direct calls from production trait impls are matched by owner name, while cfg(test) trait impls and inherent methods are excluded.
  • Confirm the implementation requires at least two impls of the implicit-dispatch method and at least one direct caller, which differs from the issue's literal two-caller wording.
  • Confirm the implementation admits a single calling impl when the crate has multiple same-named trait impls, whereas the specification says the owner is called from “several impls” and the comment describes a “several impls” case.
  • Confirm the new rule intentionally differs from the issue’s literal '2+ calling trait-impl methods' wording by requiring 2+ implementations of the implicit-dispatch name and at least one caller.

Refuted

  • The implementation and docs intentionally differ from the issue's literal two-or-more-calling-impl rule by allowing one caller among multiple same-named trait impls.

Parked follow-ups

  • Only direct non-macro calls from same-named trait impls are recognized, so indirect helper chains do not produce this limitation.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.
  • The packet has no completed cargo-test receipt, despite Rust behavior and tests being changed.

Copy link
Copy Markdown
Member Author

Review of record, head 6076ee861564c9243f40577fcdb8e840f9c6a92a (author work plus a clean merge of current main).

Angles: correctness, tests, spec/contract, perf/security.

  • Correctness: the ambiguity arm is the last branch of the witness chain, so a traced or structural witness is never displaced. trait_dispatch_ambiguity needs at least two production trait impls of one implicit-dispatch method name, at least one production impl calling the owner, and at least one test in the index. #[cfg(test)] impl blocks count as neither impl nor caller (shared cfg_predicates::attribute_requires_test), inherent methods do not count, and an owner that is itself an implicit-dispatch method returns None. Class (no_static_path), reach (no) and actionability are unchanged; no test is named, so nothing is credited and no repair start is offered.
  • Tests: proximity_reach_tests.rs (+257) covers the semver pad shape, single-impl (unique-impl rule) negative, cfg(test)-only impl, inherent fmt, mixed, Self::pad(..) equals the plain call, and the candidate bound.
  • Spec/contract: RIPR-SPEC-0114 extended; acceptance wording amended on rust: a private helper called from several impl Trait for X { fn fmt } reads bare no_static_path; name the trait-dispatch ambiguity (follow-up to #11481) #11719 (one calling impl suffices, which is how semver pad appears). The non-claim states the ripr cannot tell whether any test reaches one of these impls, so static vocabulary stays conservative.
  • Perf/security: one scan of the per-name function lists, only when the earlier arms found nothing.

Finding (non-blocking, hosted CI decides): the PR body says the full precommit was not rerun after the follow-up commit, so check-static-language and user-text ratchets are covered only by the hosted run on this head.

Merge is gated on a green Ripr Rust Small Result on this exact head.


Generated by Claude Code

@EffortlessSteven
EffortlessSteven merged commit 3c8b87f into main Oct 31, 2026
61 checks passed
@EffortlessSteven
EffortlessSteven deleted the claude/trait-dispatch-reach branch October 31, 2026 20:57
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.

2 participants