Repository navigation
feat(analysis): relate a test that enters a hop chain through a method forwarder (#9638) - #10628
Conversation
…d forwarder (#9638) A receiver call of a unique inherent forwarder method now relates the test to the owner behind it as helper_owner_call, anchored to the unique indexed workspace callee. Forwarding, shadowing, name-collision and multi-candidate refusals are unchanged and stay fail-closed. Adds the authored forwarder-hop corpus cases, spec text and focused regression tests. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018HD9fbAVQpnXMUzif6Y2oh
…beling observation (#9638) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018HD9fbAVQpnXMUzif6Y2oh
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018HD9fbAVQpnXMUzif6Y2oh
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Next included review available in 11 minutes. View limit details
Comment |
There was a problem hiding this comment.
Code Review
This pull request implements support for resolving same-impl forwarder methods called with a receiver (e.g., pool.grow(4) forwarding to try_grow). It adds the test_calls_method_entry helper to check for these receiver calls, integrates it into the related tests classification pipeline, and includes comprehensive test cases, specification updates, and test fixtures. The review feedback suggests a low-severity improvement to also match mut self as a valid receiver type in the signature parameter checks.
…entry (#9638) A receiver call of a unique forwarder method relates the test only when the receiver is a value of the forwarder's own impl type, read by the owner-pin receiver reader (constructor, struct literal or annotated let). std and external receivers named like the forwarder (Vec::len, HashSet::insert, String::is_empty, an iterator's next) no longer relate. Refuses a forwarder in a cfg(test) impl, pins each production-side guard with a negative, and adds std-receiver corpus rows. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018HD9fbAVQpnXMUzif6Y2oh
…w observation commit (#9638) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018HD9fbAVQpnXMUzif6Y2oh
…and trace the new tests (#9638) Rewords static-language terms, records which checks come from chain construction, lists the forwarder_method_* tests in the RIPR-SPEC-0159 behavior block and clarifies acceptance example 4. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018HD9fbAVQpnXMUzif6Y2oh
…d more than once (#9638) The receiver reader resolves a bare type name, so a sibling-module type of the same name imported into the test (alt::Pool over the real Pool) read as the forwarder's own type. Require exactly one workspace type of that name. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018HD9fbAVQpnXMUzif6Y2oh
There was a problem hiding this comment.
Refuted
- The new receiver parsing could cause a use-after-free or dangling lifetime because it parses source text returned from the index.; refuted because: The parsed receiver is copied into an owned String, while the source/index references are ordinary Rust borrows that cannot outlive their owners.
- The new receiver inspection has an active-view or backing-store lifetime defect.; refuted because: The implementation only scans Rust source strings and indexes character-safe byte ranges; it does not allocate or resize a native buffer, detach or transfer a view, or retain a stale length snapshot.
- The new receiver-type analysis may introduce a worker, async, GC, detach, or transfer-boundary lifetime hazard.; refuted because: The changed implementation is synchronous Rust text/index analysis with owned return values and no JavaScript, async, concurrency, GC, detach, or transfer APIs.
- The method-entry route should broaden to
mut selfand other forwarder variants now.; refuted because: The seeded thread and spec deliberately keep by-value and typed-self receivers fail-closed, while transformed results and state-only observation are explicitly parked for separate rules. - The parser could perform an out-of-bounds slice or panic on malformed receiver text.; refuted because: All slices are within the original string, UTF-8 boundaries are preserved by char_indices, depth uses checked_sub, and unsupported/malformed expressions return None.
- A method name alone can create false relation to a changed owner.; refuted because: The test must contain only receiver calls, and every receiver must resolve to the entry's own impl type; explicit std-name and name-collision controls cover this.
Parked follow-ups
- The PR intentionally parks by-value
mut self,self: &mut Self,?/unwrap_or_elsetransforms, cross-file/cross-crate public-API reach, and state-observation-only forwarders.
Evidence gaps
- Compilation and focused runtime behavior were not independently established in this lane because ripr failed and cargo-test was pending late evidence.
- Model proof intent was rejected by deterministic validation.
- The changed Rust tests could not be independently run because the cargo-test receipt was scheduled but absent from the supplied review packet.
- The ripr sensor failed with exit code 2, so the new analyzer route lacks a completed automated receipt in the shared packet; the PR body reports focused and corpus commands but those receipts are not included here.
There was a problem hiding this comment.
Decision
- Needs reviewer attention before upstream: findings remain.
Confirmed findings
- workspace_type_name_count counts keyword-prefixed source matches rather than verified type declarations, so unrelated declarations can make an otherwise unique receiver type appear ambiguous.
Verification questions
- Confirm the receiver parser accepts inline constructor expressions such as Pool { .. } or Pool::default(), but does not establish that the constructor path resolves to the same workspace type when names are qualified or aliased.
- Confirm the new route relies on textual source scanning for receiver mentions and declarations, making correctness sensitive to comments, strings, macro expansion, and unusual Rust syntax not covered by the listed controls.
Refuted
- Parsing receiver expressions from indexed source could create a stale active view or expose backing-store memory.; refuted because: All indexes are bounded against immutable source slices; results are owned Strings. The changed path has no mutable allocation, resize, detach, transfer, raw pointer, or length-cache operation.
- Receiver inspection introduces a dangling lifetime, active-view defect, or unsafe worker/async/GC handoff.; refuted because: The implementation is synchronous Rust text analysis; receiver expressions are copied into owned Strings and no worker, asynchronous, garbage-collected, detached, or transferred object is created.
- The prior request to admit mut self should be implemented in this PR.; refuted because: The seeded thread explicitly rejects it as deliberate fail-closed scope, with a negative control pinning by-value and typed-self refusal; the current diff does not reopen that decision.
- By-value
mut selfshould be admitted as a method receiver.; refuted because: The seeded thread explicitly states that by-value receivers are deliberately fail-closed and pinned by a negative control; this is a scoped design decision, not an unresolved correctness defect.
Parked follow-ups
- The changed rule does not broaden to transformed results, by-value or typed-self receivers, trait implementations, cross-package tests, or ambiguous workspace names; these are explicit refusal/parked shapes rather than sibling-path omissions.
Evidence gaps
- The changed route and package gate are exercised end-to-end, but sensor ripr failed and cargo-test evidence was only scheduled, leaving centralized executable confirmation incomplete at review time.
- Model proof intent was rejected by deterministic validation.
|
Review of record at head de4a4e1. Angles, each by an independent read-only reviewer on a committed head:
Resolutions: Gemini's Proof on the head: Not established: hosted qualification, the goldens comparison for Generated by Claude Code |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
…ckage and cache type-name counts (#9638) A root-package owner has no package prefix, so a workspace member's test passed the in-package check. Fail closed unless the test is itself outside every member package. The per-name type declaration counts are built once per index instead of re-masking every file per receiver check. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018HD9fbAVQpnXMUzif6Y2oh
|
Review-of-record addendum for head 7f42379 (supplements the review at de4a4e1). Delta: Devin found two issues after the final delta review, both fixed in 7f42379.
Both changes tighten credit or preserve behavior. This delta was reviewed by the implementer's mutation check, not by a fresh independent reviewer. The Proof at 7f42379: Generated by Claude Code |
There was a problem hiding this comment.
Decision
- Needs verification checks before upstream.
Verification questions
- Confirm the receiver-unestablished negative combines an external HashSet receiver, a function-returned Pool, and a rebound Pool, so it does not independently isolate the unsupported constructor-return or shadowing cases.
- Confirm the root-package/member negative verifies that the member lacks helper_owner_call but does not assert that the member is absent from all related-test classifications; the intended relation-specific scope is nevertheless clear from the test name and implementation.
- Confirm no broad scan proves the receiver-call route has no relevant sibling entry points or uncommon syntax variants outside the checked free-call and method-call surfaces.
- Confirm package-boundary sibling routes appear closed for member tests, but the root-package guard is defense-in-depth rather than independently mutation-pinned.
Refuted
- The receiver/type-count changes introduce unsafe pointer ownership, aliasing, or concurrency hazards.; refuted because: The implementation uses immutable source references, standard owned collections, and OnceLock-backed lazy initialization with no raw pointers, mutable aliasing, unsafe blocks, or custom synchronization.
- The receiver parser or type-count cache could expose length or pointer state invalidated by later buffer mutation.; refuted because: No mutable allocation or native buffer is involved. The cache contains only owned name/count data, and each source-derived substring is copied into an owned String before use.
- The new route crosses a worker, async, GC, detach, or transfer boundary.; refuted because: The implementation is synchronous Rust classification over immutable index data and contains no worker spawn, future, JS/GC object, detach, transfer-list, raw pointer, or thread-boundary operation.
Parked follow-ups
- Broader by-value
mut self, transformed-result, and state-only forwarder behavior is intentionally outside this rule and should remain a separate follow-up.
Evidence gaps
- The initial ripr sensor failed and cargo-test is only scheduled-late, so current execution evidence is incomplete even though author-reported focused tests and corpus replay pass.
- Model proof intent was rejected by deterministic validation.
|
Convergence note: required check red on run 40388346541 is an inherited stale-merge-ref artifact, not this branch's delta.
Update 20:4xZ — convergence yielded to the active lane. While the refresh was in flight, the author's automation pushed |
There was a problem hiding this comment.
Decision
- Needs verification checks before upstream.
Verification questions
- Confirm receiver recognition is textual and bounded to identifiers, inline constructors, and struct-literal-style constructors; uncommon valid receiver syntax can cause missed credit.
- Confirm method-call entry has broad receiver-identity controls but no exhaustive sibling coverage for qualified, aliased, imported, macro-generated, or unusual constructor call shapes.
- Confirm the workspace type-name count is intended to detect struct, enum, union, and alias declarations, but its keyword scan may be broader than actual declaration syntax.
Refuted
- The new source parsing introduces a dangling lifetime, stale active view, or backing-store exposure.; refuted because: All analyzed data remains borrowed from immutable Rust sources or copied into owned Strings and owned collections. There is no mutable backing buffer, resize, detach, transfer, raw pointer, or length snapshot.
- The receiver/type memoization introduces a worker handoff, detach, transfer, or concurrency lifetime hazard.; refuted because: The implementation uses a standard OnceLock holding an owned BTreeMap and performs no cross-thread handoff, detach, or transfer operation.
- A std or external receiver sharing a forwarder method name can produce false exposed credit.; refuted because: Receiver identity must match the entry impl type; external and std receivers fail type establishment, while same-name workspace types are conservatively treated as ambiguous.
Evidence gaps
- Model proof intent was rejected by deterministic validation.
- The proof set is incomplete in this lane because the ripr sensor failed and cargo-test was scheduled late; corpus and focused-test claims still require broker confirmation at the reviewed head.
|
Merged as Generated by Claude Code |
EffortlessSteven
left a comment
There was a problem hiding this comment.
Review of record (exact-head sweep, head c4e39222a5b68e01bb15b2e798237b55b7ed59e7)
The only earlier review on this head is the automated verification-questions notice (review 5658937002); the substantive automated review (5651005854) was submitted at a different head (de4a4e13). This is the substantive review of record for the merged head, posted post-merge as COMMENT; findings below are follow-through items, none assessed as merge-blocking.
Verified
Observed (REST reads at head c4e3922, this session):
- Full 31-file patch read via
GET /pulls/10628/files(paginated): analyzer delta incrates/ripr/src/analysis/classify/helper_transfer.rs(+151:test_calls_method_entry,receivers_are_entry_type,receiver_expression),owner_pin.rs(+84:test_receiver_named_type,workspace_type_name_count),call_identity.rs(+14: memoized type-name counts),related_tests.rs(+25/-1: thecalls_method_entrygate); corpus (6 cases/rows, subjectauthored-forwarder-hop), spec RIPR-SPEC-0159,.ripr/traceability.toml, changelog fragment. - Head sources re-read at
c4e3922for the machinery the new rule leans on:mentions_only_as_receiver_call(helper_transfer.rs:1152),HelperChainhop ordering (owner-first;entry_nameis the last hop's caller, sohops[..=at]is owner-to-entry as documented),package_prefix(related_tests.rs:3562, trailing-slash prefixes, so thecrates/riprvscrates/ripr-fooprefix collision cannot occur), the receiver reader (owner_pin.rs:10132test_receiver_type,12936binding_type,12876binds_outside_let,13573shadow checks), andimpl_self_type(helper_transfer.rs:656). - The diff matches the body's claimed scope (same-impl forwarder entry; credit-or-unknown; corpus plus spec examples 10/11) with one accuracy exception noted below.
- Counted: 16 new
forwarder_method_*tests inhelper_wrapper_reach.rs= 16 new.ripr/traceability.tomlrows.fixtures/rust-verdict-corpus/missed-credit.tomlis absent from the changed-file list, matching the body's "no entry deleted" claim. - Check runs at head: 104 runs - 40 success, 57 skipped, 6 cancelled, 1 failure (
Ripr Rust Small Resultaggregate). The PR merged through the protected path; the aggregate failure is recorded as observed state, not diagnosed here. - Dedupe:
GET /pulls/10628/reviews(10 reviews) - no substantive review of record existed on this head.
Reported (PR body, not re-run here): cargo xtask precommit exit 0; verdict-corpus check 717 cases / 0 drift; focused-test counts; the oracle-grip removal experiment on the shadow check; baseline attribution (limited/no_static_path -> credited/exposed).
Not verified (no local runs): the local checkout at F:\code\Rust\ripr-swarm is not a usable worktree (git rev-parse --show-toplevel fails; git log is stale at 36d46845b4), so no cargo/xtask command was executed in this review. The static analysis stands on the head-SHA sources listed above.
Findings
[P2] Spec and rule doc claim a parameter receiver never relates, but the reader admits a typed test parameter (inline at helper_transfer.rs:1195)
- Failure mode: a receiver bound only as a typed test parameter (
fn grow_pins(mut pool: Pool), nolet, owned pattern, single-fn body) resolves throughtest_receiver_named_type->test_receiver_type(owner_pin.rs:10141-10151):receiver_let_bindingsreturnsNonebecausebinds_outside_let(owner_pin.rs:12876-12893) sees the name in the fn parameter list, and the fallthroughparameter_annotation(owner_pin.rs:10192-10228) returns the annotation, so the method-entry rule credits it.helper_transfer.rs:1194-1195and RIPR-SPEC-0159 line 110 both state "a parameter ... never relates the test". The credited case is not obviously a false credit (the annotation names the unique workspace type; the reader's #6578 rstest parameter support is deliberate), but the enforced rule is broader than the documented one, and no test or corpus row pins the typed-parameter shape in either direction, so future reader changes can move it silently. - Fix direction: either correct
helper_transfer.rs:1194-1195and spec line 110 to say an owned, single-fn typed test parameter does establish identity, and pin it with a positivehelper_wrapper_reachcase plus a corpus row; or make this caller refuse the parameter path and pin the refusal. - Validation:
cargo test --test helper_wrapper_reach forwarder_methodandcargo xtask verdict-corpus checkafter either repair. - Confidence: High on the code path (read at head); High on the doc/spec mismatch.
[P2] workspace_type_name_count counts keyword-prefixed words, not parsed declarations (carried) (inline at owner_pin.rs:13466)
- Failure mode: an over-count of a receiver type name (whole-word
struct/enum/union/typematches in masked source,owner_pin.rs:13466-13490) makes an otherwise-unique receiver type read ambiguous, so a true positive fails closed as missed credit. Never a false credit. - Why here: recorded as a confirmed finding by the automated review at the earlier head
de4a4e13(review 5651005854) and as a verification question at this head (5658937002); the code is unchanged, so it stays open on the merged head. - Fix direction: derive the counts from the indexed syntax declarations instead of the whole-word keyword scan.
- Validation:
cargo xtask verdict-corpus check; theforwarder-hop-std-named-owner-typecredit rows are the sensitive positives. - Confidence: Medium - no concrete over-count fixture was constructed in this review.
Note (scope accuracy, record-only): the PR body says "four cases" and "six new forwarder_method_*"; the merged diff carries six corpus cases and 16 new tests. The body also reports goldens check INCOMPLETE for owner_return_pin_fallible_literal as a known environment gap. Recorded so the merge receipt does not understate the diff; body edits are outside this review lane.
What holds up
Strongest positive: the corpus discipline. Six authored rows carry runtime-mutant truth replayed with zero drift (reported), including two credit-direction rows (forwarder-hop-forwarded-hit, and forwarder-hop-std-named-owner-type, which credits a std-colliding name only through a receiver of the owner's own type) and four abstention traps. Of the 16 new helper_wrapper_reach tests, three carry credit-direction assertions and the rest target one guard each (shadow, path/value call, cfg(test) impl/module, no-self/mut-self/typed-self, macro hop, external trait impl, unestablished/same-named receivers, cross-package, root-package member). The shadow negative's remaining receiver call pool.grow(4) passes every other method-entry guard as read, so only the shadow check refuses it - that control discriminates. The root-package fixture pins member-test refusal and root-test credit in one workspace, and the package gate rides trailing-slash prefixes, so near-miss crate names cannot slip through.
Residual risk: receiver recognition is textual (documented): spaced call syntax, a turbofish on the entry, and call texts the extractor does not capture are refused as missed credit; a foreign import shadowing the type via cross-file glob re-exports sits outside the reader's file-scoped import check. Neither direction produces false credit on the evidence read here.
Validation signal:
- Observed: the REST reads enumerated above; check-run conclusions at the head SHA.
- Reported: PR-body proof commands and counts (precommit, verdict-corpus 717/0, focused tests, oracle-grip removal, missed-credit accounting).
- Not verified: any local cargo/xtask execution (no usable local worktree).
Disposition: Findings above; none blocking (post-merge review of record; both findings are P2 follow-through).
| /// `let` the test binds only to that type's constructor or struct literal, | ||
| /// or an inline constructor, read by the owner-pin receiver reader. A std | ||
| /// or external receiver, a parameter, a rebound name or a foreign import of | ||
| /// the type never relates the test (`Vec::len` is not a forwarder `len`). |
There was a problem hiding this comment.
[P2] Doc claims a parameter receiver never relates; the reader admits a typed test parameter
Failure mode: for fn grow_pins(mut pool: Pool) (no let, owned pattern, single-fn body), test_receiver_named_type reaches test_receiver_type (owner_pin.rs:10141): receiver_let_bindings returns None because binds_outside_let (owner_pin.rs:12876) sees the name in the fn parameter list, and parameter_annotation (owner_pin.rs:10192) returns Pool, so this rule credits. This doc line and RIPR-SPEC-0159 line 110 say a parameter never relates the test.
Why here: the sentence was written against the let-binding reading; the owner-pin reader's #6578 parameter path deliberately establishes typed parameters, and no test or corpus row pins the typed-parameter shape in either direction.
Fix direction: align this doc and spec line 110 with the reader (typed parameter establishes identity) and pin both directions with a helper_wrapper_reach case and a corpus row - or refuse the parameter path for this caller and pin the refusal.
Validation: cargo test --test helper_wrapper_reach forwarder_method; cargo xtask verdict-corpus check.
Confidence: High (both sides read at head c4e3922).
| /// How many `struct`, `enum`, `union` or `type` items named `name` the | ||
| /// workspace declares, across every module and file. The per-name table is | ||
| /// built once per index (every file masked once), then looked up. | ||
| fn workspace_type_name_count(name: &str, index: &RustIndex) -> usize { |
There was a problem hiding this comment.
[P2] Keyword-scan declaration count can over-count a unique type name (carried)
Failure mode: whole-word struct/enum/union/type matches in masked source count as declarations, so a non-declaration word match of a receiver type's name anywhere in the workspace makes the name ambiguous and a true positive fails closed as missed credit (never a false credit).
Why here: recorded as a confirmed finding by the automated review at head de4a4e13 (review 5651005854) and as a verification question at this head (5658937002); the code is unchanged here, so it remains open post-merge.
Fix direction: derive the counts from indexed syntax declarations instead of the whole-word keyword scan.
Validation: cargo xtask verdict-corpus check; the forwarder-hop-std-named-owner-type credit rows are the sensitive positives.
Confidence: Medium (no over-count fixture constructed in this review).
Summary
pool.grow(4)forfn grow(&mut self, ..) { self.try_grow(..) }) now relates to the owner behind it (helper_owner_call), so a discriminated boundary intry_growreadsexposedinstead ofno_static_pathwithtransitive_reach_unresolved. This is the same-impl one-hop forwarder from the smallvec specimen in Missed credit: Rust forwarded-result and public-API reach (propagation_unknown, transitive_reach_unresolved) #9638; feat(analysis): pair a check helper's assertion on a forwarded method-hop result (#9329) #9642 landed the forwarded-result half.self/&self/&mut selfin production source and the one workspace function of its name; hops beneath it must be direct or identity-boundself.hops; the test's only mentions must be receiver calls; no test-local binding/nested fn/foreign import shadows the name; the test must be in the owner's package. Forwarding, infection and observation are unchanged, so a forwarder that drops or transforms the owner's result stayspropagation_unknown.authored-forwarder-hopsubject with four cases (positive plus swallowed result, name collision, multi-candidate owner), truth replayed withverdict-corpus relabel(0 drift).Swarm / Source Boundary
ripr-swarmSource-of-truth Links
Spec: RIPR-SPEC-0159
Governing issue or accepted claim: #9638
Acceptance delta (one sentence): a test that reaches a changed inherent owner through a unique, result-forwarding same-impl method now credits the discriminating assertion, while swallowed results, shared names and multi-candidate owners still abstain.
Candidate Relationships
Candidate branch: claude/missed-credit-reach-9638
Stack parent or prerequisite PR (if any): none (based on main c8af153)
Scope
helper_transfer::test_calls_method_entryand its use in thefind_related_testsrelation branch (related_tests.rs).Proof
cargo xtask precommit: exit 0.goldens checkreported INCOMPLETE (known environment gap forowner_return_pin_fallible_literal; hosted CI owns it).cargo xtask verdict-corpus check(Rust): 717 cases, false verdicts 0/717, contradictions 0/899, spec examples 288/288, traps credited 0/43. Only the four new rows are added; no existing row moved.helper_wrapper_reach(41, six newforwarder_method_*),method_helper_reach(55),crate_qualified_entry_reach(12),--lib classify::(1756). Removing the shadow check makes the shared-name and shadowed controls fail (oracle grip).forwarder-hop-forwarded-hitreadslimited/no_static_path(a missed credit); with the change it readscredited/exposed.Missed-credit accounting
The Rust missed-credit list (
fixtures/rust-verdict-corpus/missed-credit.toml, which replaced themissed_credit_ceilingline in #10222) is 160 entries on main and 160 here. This PR does not flip any existing abstained row (the 13transitive_reach_unresolvedrows are integration/public-API shapes in other files or crates, not same-impl method forwarders), so no entry is deleted. Counting the new positive row at baseline it would have been 161, so the slice removes a missed credit of its own shape without lowering the standing list.Remainder of #9638 (not in this PR)
.unwrap_or_else(SmallVecError::handle)tail is treated as a transform and still abstains; admitting it needs a rule for a diverging handler and unit-returning forwarders whose effect is observed on state.semver-*,rusqlite-*andtokens-base-six-hop-chainrows is unchanged.Generated by Claude Code