Repository navigation
fix(rust): import-path affinity for an impl owner must name its type (#16523) - #16557
EffortlessSteven wants to merge 8 commits into
Conversation
…16523) A bare `::name` related an associated function to every test calling any `X::name(..)`; an owner named `new` related to about 7,000 tests. The line that spells `::name` must now name the owner's self type or trait, or `Self` in the owner's file. Owners outside an impl keep the module-path rule. The pool-relation reference now derives from the unscoped relation. Unit proof pending: first local run in progress at commit time. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SvmPmmv8ne82Ko6vufDhTN
… affinity (#16523) A #[test] function is never inside an impl, so Self::name cannot name the owner from a test body. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SvmPmmv8ne82Ko6vufDhTN
) Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SvmPmmv8ne82Ko6vufDhTN
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
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 5 minutes. View limit details
|
…ffinity (#16523) Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SvmPmmv8ne82Ko6vufDhTN
…ts at generation 1.233 (#16523) 61 honesty reports recaptured with the analyzer at cf253b0; only capture metadata lines change. The boundary_gap unchanged-attempt snapshots move to 1.233 with recomputed content commitments and receipt hashes. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SvmPmmv8ne82Ko6vufDhTN
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
EffortlessSteven
left a comment
There was a problem hiding this comment.
SOURCE_REVIEW_READY
Independent source review of exact head b0af2a4 against current main (75 files, +376/-205). I did not author this PR. This is a source and oracle review by reading; I did not build or run this head, and hosted qualification has not run on it.
Read in full: the production diff in test_grip_evidence/related_tests.rs; impl_self_type_name, owner_trait_name and compact_impl_type_name's documented contract in classify/related_tests.rs; relation_establishes_reach cases for this reason; the new tests/associated_import_affinity.rs; the changed reference helper in tests/pool_relation.rs; the three cache generation constants and their pins in seam_cache.rs; the changelog entry. The 61 honesty reports and the boundary_gap snapshots I read by file inventory and sample only, not line by line.
Claims checked
- The narrowed rule only applies where a type is known.
associated_path_qualifiersreturns a value only whenimpl_typeis set, which comes from an::implsegment in the owner id with generics, references and path prefixes stripped. A free owner, a self type that has no compact name, and a non-Rust owner all keep the existing reader. So the change cannot remove a relation from an owner whose type the rule could not spell. - One producer.
match_import_path_affinityis the only producer of this reason for Rust seams, and it serves the full and the compact evidence paths, so there is no second copy to drift. - Direction. This reason does not establish reach (
relation_establishes_reachrefuses it for function and module owners). Removing it can lower a weak relation and can never grant credit. The retained-line predicate is unchanged: the new reader requires::name, which implies the::the retention filter keeps. - Attack point 1, another implementor or a generic.
Beta::build()for an ownerimpl Build for Alpha::buildis dropped, which is right: it does not run this owner.Build::buildand<Alpha as Build>::buildstay.T::build()in a generic helper is dropped with no type on the line; that test keeps any stronger relation, and this one never carried reach. - Attack point 2, the
usebranch. Correct to drop for an associated owner:usecannot bring an associated function into scope, so auseline with a matching last segment names a module or a free item of that name. - Attack point 3, aliases. A renamed import and a path split across lines are lost. Both are named in the changelog and in the function's comment. Their frequency is not measured; the PR says so.
- Attack point 4, generations. Full 1.229 to 1.233, sharded and compact 0.231 to 0.235, each with its pin and the xtask corpus constant moved together. Related sets change on real repositories, so a bump is required. I did not recompute the
boundary_gapcommitments; the hosted fixture and output contract gates decide that.
Oracle grip. By reading the rule on main: other_type (Beta::new) contains ::new and inline_use has a use line whose token is new, so both related before and the first new test fails there. The positives sit in the same test file as the negatives, so the file is indexed when the assertion passes. The pool_relation reference now comes from the unscoped relation, which removes the shared-shortcut weakness I raised on #16096.
Non-blocking suggestions
- Assert the fixture's test count (eight) before the relation claims, so a negative cannot pass because one test stopped being indexed.
- Add the two shapes the rule is meant to keep but the fixture does not hold:
Alpha::build(type path to the trait method) and an owner in a generic impl (impl<T> Wrap<T>), which exercises the stripped self type. - A trait's default method body has no
::implsegment, so it keeps the bare::namerule. Worth one line in the limitation list.
Missing evidence, recorded as missing: hosted qualification on this head; cargo xtask precommit; the related-test count for one new owner before and after (acceptance item on #16523, the author reports the kept-seam count 4,803 to 4,484 instead); CodeRabbit and Gemini are quota-limited, which is absent review.
Public claim. The changelog states the rule and its alias limitation and makes no speed or completion claim, which matches the replay in the PR body.
Generated by Claude Code
EffortlessSteven
left a comment
There was a problem hiding this comment.
SOURCE_REVIEW_READY
This replaces review 6101335236 on the same head, whose wording tripped the admission parser; the content is otherwise the same.
Independent source review of exact head b0af2a4 against current main (75 files, +376/-205). I did not author this PR. This is a source and oracle review by reading; I did not build or run this head, and hosted qualification has not run on it.
Read in full: the production diff in test_grip_evidence/related_tests.rs; impl_self_type_name, owner_trait_name and compact_impl_type_name's documented contract in classify/related_tests.rs; relation_establishes_reach cases for this reason; the new tests/associated_import_affinity.rs; the changed reference helper in tests/pool_relation.rs; the three cache generation constants and their pins in seam_cache.rs; the changelog entry. The 61 honesty reports and the boundary_gap snapshots I read by file inventory and sample only, not line by line.
Claims checked
- The narrowed rule only applies where a type is known.
associated_path_qualifiersreturns a value only whenimpl_typeis set, which comes from an::implsegment in the owner id with generics, references and path prefixes stripped. A free owner, a self type that has no compact name, and a non-Rust owner all keep the existing reader. So the change cannot remove a relation from an owner whose type the rule could not spell. - One producer.
match_import_path_affinityis the only producer of this reason for Rust seams, and it serves the full and the compact evidence paths, so there is no second copy to drift. - Direction. This reason does not establish reach (
relation_establishes_reachrefuses it for function and module owners). Removing it can lower a weak relation and can never grant credit. The retained-line predicate is unchanged: the new reader requires::name, which implies the::the retention filter keeps. - Attack point 1, another implementor or a generic.
Beta::build()for an ownerimpl Build for Alpha::buildis dropped, which is right: it does not run this owner.Build::buildand<Alpha as Build>::buildstay.T::build()in a generic helper is dropped with no type on the line; that test keeps any stronger relation, and this one never carried reach. - Attack point 2, the
usebranch. Correct to drop for an associated owner:usecannot bring an associated function into scope, so auseline with a matching last segment names a module or a free item of that name. - Attack point 3, aliases. A renamed import and a path split across lines are lost. Both are named in the changelog and in the function's comment. Their frequency is not measured; the PR says so.
- Attack point 4, generations. Full 1.229 to 1.233, sharded and compact 0.231 to 0.235, each with its pin and the xtask corpus constant moved together. Related sets change on real repositories, so a bump is required. I did not recompute the
boundary_gapcommitments; the hosted fixture and output contract gates decide that.
Oracle grip. By reading the rule on main: other_type (Beta::new) contains ::new and inline_use has a use line whose token is new, so both related before, and the first new test asserts a list main does not produce. The positives sit in the same test file as the negatives, so the file is indexed when the assertion passes. The pool_relation reference now comes from the unscoped relation, which removes the shared-shortcut weakness I raised on #16096.
Non-blocking suggestions
- Assert the fixture's test count (eight) before the relation claims, so a negative cannot pass because one test stopped being indexed.
- Add the two shapes the rule is meant to keep but the fixture does not hold:
Alpha::build(type path to the trait method) and an owner in a generic impl (impl<T> Wrap<T>), which exercises the stripped self type. - A trait's default method body has no
::implsegment, so it keeps the bare::namerule. Worth one line in the limitation list.
Missing evidence, recorded as missing: hosted qualification on this head; cargo xtask precommit; the related-test count for one new owner before and after (acceptance item on #16523, the author reports the kept-seam count 4,803 to 4,484 instead); CodeRabbit and Gemini are quota-limited, which is absent review.
Public claim. The changelog states the rule and its alias limitation and makes no speed or completion claim, which matches the replay in the PR body.
Generated by Claude Code
…import affinity (#16523) Review repairs on #16557. A grouped import such as use crate::{types::Alpha, support::new} paired a type with an unrelated ::new on one line; use items are now removed before the line is read. A raw type name (r#gen) is compared by its name, as the line scan splits on #. Tests gain the indexed-count precondition, the type path to a trait method, a generic impl owner, and both negatives. Traceability under RIPR-SPEC-0005. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SvmPmmv8ne82Ko6vufDhTN
EffortlessSteven
left a comment
There was a problem hiding this comment.
SOURCE_REVIEW_READY
Independent source review of exact head 51c0543. I did not author this PR. My review 6101335771 covered b0af2a4; this pass covers the one commit added since (three files, +110/-15) and keeps the earlier inspection for everything it did not touch. Read-only; I did not build or run this head, and hosted qualification has not run on it.
Read in full: the delta in test_grip_evidence/related_tests.rs (associated_path_qualifiers, test_names_associated_owner_compact, without_use_items, use_item_start), the delta in tests/associated_import_affinity.rs, and the new traceability file.
Delta claims checked
- A
useitem is not read.without_use_itemsremoves each span from a word-initialusethrough the next;, or to the end of the line when there is none. The word check keepsreuseandcausein place. Offsets are taken from ASCII matches, so the slices stay on character boundaries. Code after the item on the same line is kept, souse crate::types::Alpha; let a = Alpha::new(1);still relates through the call. The only text this can wrongly drop is a macro argument that spellsuseas a word, and that lowers a relation that carries no reach. - A raw type name matches. Qualifiers drop the
r#prefix, and the line scan already yieldsgenfromr#genbecause it splits on#. A baregen::makecannot name a different item, since the raw form exists only because the plain word is reserved. - The limitation list now names the trait default method case in the function comment.
Oracle grip. The fixture asserts 14 indexed tests before any relation is read, so each negative depends on a test that exists. grouped_use is the Devin case and is absent from the inherent owner's list; type_to_trait_method, generic_impl and raw_type are kept shapes with their own negatives (other_pick, other_make). Each list is compared whole, so an extra or a missing relation shows.
Review state. Unresolved threads: 0, read through the review-threads endpoint. The author reports four Devin threads answered and resolved, one declined with a reason; I read the code for the two repairs and agree both findings were real.
Missing evidence, recorded as missing: hosted qualification on this head; cargo xtask precommit; the before and after related-test count for one new owner; CodeRabbit and Gemini are quota-limited, which is absent review.
Generated by Claude Code
…229 (#16523) Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SvmPmmv8ne82Ko6vufDhTN
|
Rust gates failed on Repair on head Generated by Claude Code |
EffortlessSteven
left a comment
There was a problem hiding this comment.
SOURCE_REVIEW_READY
Independent source review of exact head cea9e89. I did not author this PR. Reviews 6101335771 and 6101417498 covered the source through 51c0543; this pass covers what was added since and keeps that inspection. Read-only; no build or run on this head, and hosted qualification has not run on it.
What is new since 51c0543
- Merge commit 2e58ff7, parents 51c0543 and main af1880e. Across the merge,
test_grip_evidence/related_tests.rs, the test module,seam_cache.rsandclassify/related_tests.rsare byte-identical to 51c0543, so main did not touch the code this PR changes and the earlier source review still describes the head. - Commit cea9e89 recaptures two honesty reports that reached main at generation 1.229 (
rust-repo-exposure-guarded-statement-boundaries.json,rust-test-local-rival-import-control.json). Each changes exactly three lines:artifact,source_subject,analysis_inputs. Insideartifactonlygenerated_atandcontent_sha256differ;source_subjectmovescache_schema_versionto 1.233 with the samefiles_content_hash;analysis_inputsrecords the new analyzer revision. No finding line changed in either file.
Checked on the tree. No file under fixtures/ still records generation 1.229 at this head; 63 record 1.233. That is the condition the hosted honesty check refused on the previous head.
Why the previous head went red. The hosted job evaluates the merge with main, and the two reports arrived there after this branch was cut. That is an integration effect of the generation bump, repaired in the same candidate, not a defect in the relation change.
Missing evidence, recorded as missing: hosted qualification on this head, including the honesty check that refused before; cargo xtask precommit; the before and after related-test count for one new owner; CodeRabbit and Gemini are quota-limited, which is absent review. If another report lands on main at an older generation before this merges, the same refusal will recur in the queue run.
Generated by Claude Code
|
|
EffortlessSteven
left a comment
There was a problem hiding this comment.
REVIEW_READY for head cea9e89
Independent native-Windows review of fix(rust): import-path affinity for an impl owner must name its type (#16523) (PR #16557) at cea9e89 (merge-base af1880e is 5 commits behind main — current enough that no stale-base caveat is needed).
Source review (verified against source)
Delta (PR vs merge-base: test_grip_evidence/related_tests.rs +101, new tests/associated_import_affinity.rs +119, tests/pool_relation.rs +13, seam_cache.rs version bumps + comment/test updates, and small expectation updates across the repo-exposure fixture JSONs; no other production surface):
-
The narrowing is correct and well-reasoned:
::namealone names no type — every test that calls anyX::new(..)spells::new— so a bare associated-function path on the test line was overcrediting owners whose only tie was a same-named associated function. The line that spells::namemust now also name one of the owner'sassociated_path_qualifiers(the impl's self type, or the trait for a trait impl). -
The three stated exclusions are each sound: a
useitem cannot import an associated function so its text is not read; a#[test]function is never inside an impl soSelf::namecannot name the owner from a test body; raw identifiers (r#gen) are compared by name with the#split handled. -
The rule stays line-level like the one it narrows (
Other::new(Owner::default())is read precisely as written), and the compact-test path (test_imports_owner_compact) is updated in the same commit, so lib and compact readers cannot disagree. -
Generation-map hygiene is clean and lockstep: full
CACHE_SCHEMA_VERSION1.229 → 1.233, sharded0.231→ 0.235, compact0.231→ 0.235, all three in one commit with the claim comment naming the in-flight holders (1.230–1.232 per #16466). This PR's claim is exactly the next free pair, and the repo-exposure expectation updates are the expected blast radius of a classifier narrowing (previously overcredited fixtures lose the false credit, matching the renamed-other-function / same-named-call-kinds / rival-import controls). -
Native proof (native Windows, worktree wt-16557 at head cea9e89):
cargo test -p ripr --lib test_grip_evidence(exit 0, including the new associated_import_affinity module);cargo xtask goldens check(exit 0 apart from the known pre-existingpython_parent_collected_test_shadownative-Windows fixture drift);cargo xtask check-evidence-promotion-honesty(exit 0);cargo xtask check-traceability(exit 0).
Scope and non-goals
- Reviewed and proven at this head only; a later push restarts review.
- The generation map on #16466 records this PR as holding 1.233/0.235 at this head; markers are head-exact and the writer rebases before merge per convention.
- Merge mechanics belong to the writer; this review is evidence only.
|
For the existing owner’s next integration pass: once the conflict is resolved and GitHub advertises the fresh composition, the already-landed #15651 pre-label check is a fast way to catch a third stale report before requesting hosted qualification: |
Summary
::<name>to also name the owner's self type or trait. A bare::newrelatedAlpha::newto every test that calls anyX::new(..).pool_relationreference answer now derives from the unscoped relation, filtered to the pool, so the pool routes and the package shortcut stay out of their own oracle (review suggestion carried from perf(review): decide second-stage pool relations without resolving every test (#12940) #16096).Swarm / Source Boundary
ripr-swarmSource-of-truth Links
Governing issue or accepted claim: #16523 (split from #12940)
Acceptance delta (one sentence): an associated owner is related by import-path affinity only to tests whose
::<name>line names its type or trait.Candidate Relationships
Candidate branch:
claude/project-thread-xgnffsStack parent or prerequisite PR: none (#16096 is on main)
No equivalent open PR found (searched open PRs for #16523 and the matcher name).
Scope
crates/ripr/src/analysis/test_grip_evidence/related_tests.rs:OwnerContext::associated_path_qualifiers,test_names_associated_owner_compact, one branch inmatch_import_path_affinity.tests/associated_import_affinity.rs; reference helper intests/pool_relation.rs.Scope Classification
Design notes
::<name>must contain the type or trait as a whole identifier.Alpha::<T>::new,module::Alpha::new,<Alpha as Build>::buildandBuild::buildrelate.Other::new(Alpha::default())still relates (same line names the type).useline no longer counts for an associated owner:usecannot import an associated function.Self::<name>is not accepted: a#[test]function is never inside an impl.use a::Alpha as Z; Z::new()) or a path split across lines is not read as naming the type. Corpus count for this shape: none observed (no golden, verdict-corpus or honesty-corpus output changed); I did not count it on a wider repository.Proof (run on
b0af2a4db, the head)cargo test -p ripr --lib --no-default-features --features lang-python,lang-rust -- seam_cache first_useful_action test_grip_evidence::tests::1,017 passed, 0 failed (includes the generation pins and the new module). Reduced features are the only lib-test build that links in this 15 GB container; hosted shards are the full run.cargo test -p ripr --test cli_smoke: 914 passed.--test lsp_lifecycle gap_corpus: 21 passed.cargo test -p xtask rust_corpus_projection: 5 passed.cargo clippy -p ripr --all-targets -- -D warningsandcargo clippy -p xtask --all-targets -- -D warnings: exit 0.cargo xtask goldens check: exit 0, no drift.check-fixture-contracts,check-output-contracts,check-doc-artifacts: pass.cargo xtask verdict-corpus check-all: exit 0, 4 corpora (run on4a932a1a2, before the generation commits; no analysis source changed after it).cargo xtask check-evidence-promotion-honesty: pass before the bump with no report change, and pass after it.review-comments, base52844de5, head7cf9cd6d, release build of4a932a1a2, 4 workers, default 600 s):5994aa08f)limited_timeout, no second-stage window completed4a932a1a2)limited_timeout, no second-stage window completedThe change removes 319 seams from the second stage on this diff. It does not make the command finish, and it does not measurably speed up the second-stage windows that ran (20 seams in 118 s wall against 24 in 170 s; single runs, different seam sets). No completion claim.
Cache generation
Claimed 1.233 / 0.235 on the #16466 map (comment 7249863499); 1.230 to 1.232 are held by #16447, #16162 and #16143. Related-test sets change on real repositories, so entries cached by an older binary must not be reused. No committed finding changed: the 61 recaptured honesty reports differ only in their
artifact,source_subjectandanalysis_inputsmetadata lines, and theboundary_gapunchanged-attempt snapshots move to 1.233 with recomputed content commitments and receipt hashes (algorithm checked against the committed 1.229 state before use).Not established
other_type,inline_use) failing on current main: follows from the old rule by reading (::newsubstring), not executed on main.TargetRoots::newbefore and after (acceptance item on analysis(rust): import-path affinity relates an associated function to every test that calls anyX::<name>(ownernewgets about 7,000 tests) #16523): not measured directly; the kept-seam count above is the observed effect.cargo xtask precommit(exceeds the background time limit in this container).https://claude.ai/code/session_01SvmPmmv8ne82Ko6vufDhTN
Generated by Claude Code