You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
rust: a non-import binder (let/closure) of the owner's name still reads direct_owner_call/reach:yes although no test calls the owner (#14508 residual) #14552
The original aliased-import repro below is fixed by #14513 at 751ac6c527 and still fixed at 23c0227137: src/lib.rs::owner reads strongly_gripped / direct_owner_call / [100], and src/lib.rs::unrelated::dt reads activation_unknown / reach: weak / same_test_file with no direct_owner_call. The alias_spelling_binds_other_owner refusal in match_direct_owner_call withholds the by-name credit when every call of the name is bound to a direct-owner import alias of another function.
This issue is rescoped to the non-import binder residual, which is pre-existing (identical at origin/maincc51e23f53) and not repaired by #14513.
Residual repro
Same src/lib.rs, but the test body binds the name with a closure and has no import:
// src/lib.rspubfnowner(x:i32) -> i32{
x - 10}mod unrelated {pubfndt(_x:i32) -> i32{0}}#[cfg(test)]mod tests {#[test]fnclosure_binder(){let dt = |x:i32| x + 1;assert_eq!(dt(100),101);}}
src/lib.rs::owner — ungripped, reach: no, same_test_file. Correct.
src/lib.rs::unrelated::dt — strongly_gripped, reach: yes, direct_owner_call, high confidence, related test closure_binder. The test never calls unrelated::dt; the only call is dt(100) bound to the local closure.
Expected
unrelated::dt should have no related test and no reach: yes from this test.
Cause
The generic same-file call-name relation in match_direct_owner_call (crates/ripr/src/analysis/test_grip_evidence/related_tests.rs, the block above the #14508 alias block) matches a call name against same-file function names without module scope. The alias-table guard cannot see a let/closure binder because there is no alias-table row. The same class covers method-name binders (#5335).
Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.
Create Plan
🧪 Issue enrichment is currently in open beta.
You can configure auto-planning by selecting labels in the issue_enrichment configuration.
To disable automatic issue enrichment, add the following to your .coderabbit.yaml:
issue_enrichment:
auto_enrich:
enabled: false
💬 Have feedback or questions? Drop into our discord!
src/lib.rs::unrelated::dt — activation_unknown, reach: weak, "No test is seen calling dt; tests share only its file or a name token". No direct_owner_call, no reach: yes.
The refusal comes from alias_spelling_binds_other_owner in match_direct_owner_call (crates/ripr/src/analysis/test_grip_evidence/related_tests.rs), which refuses the generic same-file call-name credit when every call of the name is bound to a direct-owner import alias of a different function.
Keeping this open until #14513 lands, then closing it as fixed by that PR.
Reconciliation with current #14513 head 751ac6c52781a1d28fb442929779713e323bdd76: the issue's executable reproduction is reported at 48be3057, not this newer head. Source inspection now finds an alias_spelling_binds_other_owner refusal in the generic named-call branch of match_direct_owner_call, directly before direct-call candidate insertion. The PR body also reports its Probe C leaves the sibling without a direct-owner relation. This may cover this residual; I have not independently rerun the issue fixture, so this is not closure evidence.
Acceptance to preserve on the eventual exact head: genuine owner retains its intended relation/values, while unrelated::dt has no incorrectly credited related test or reach-yes claim. Check the whole relation set, not only grip or removal of DirectOwnerCall. This residual is separate from the unexecuted library-versus-binary compilation-unit concern in #14513 and from #14508's default diff-mode acceptance, which #14513 explicitly excludes. Existing #14513 ownership remains canonical; no duplicate writer or CI request.
changed the title [-]rust: a same-file sibling function of the alias name still reads direct_owner_call/reach:yes although no test calls it (#14508 residual)[/-][+]rust: a non-import binder (let/closure) of the owner's name still reads direct_owner_call/reach:yes although no test calls the owner (#14508 residual)[/+]on Nov 13, 2026
State: reproduced on main at 787884266 (src/lib.rs::unrelated::dt still reads strongly_gripped / direct_owner_call from closure_binder)
Plan: a syntax-backed check that every mention of the owner's name in the test is bound by a test-local let, closure parameter, parameter or nested fn in scope at that mention (block-scoped, so a call in a let's own initializer or after the binding's block ends keeps the credit). When it holds, both the diff-mode relation and the repo seam drop the direct_owner_call row, like the #14069 rename refusal. Anything the tree cannot settle (a qualified mention, an import or glob in an enclosing block, a non-std macro) keeps the current credit.
Delivered by #16298, merged to main as c1a479243b (2026-11-26 06:39 UTC, through the merge queue).
Residual repro.src/lib.rs::unrelated::dt now reads reach: weak with relation same_test_file and no direct_owner_call for closure_binder. Before the fix it read strongly_gripped / reach: yes. This is the same weak same-file row that owner already had, which this issue calls correct. The honesty corpus pins it as rust_repo_exposure_local_binder_named_like_other_function_not_promoted.
Control. When the binder sits in an inner block and the owner is called outside that block, the test keeps direct_owner_call. This is pinned as rust_repo_exposure_local_binder_named_like_owner_block_control.
How it works.every_mention_bound_locally_in_tree in analysis/syntax/name_scope/local_binding.rs handles a test whose every mention of the owner's name is bound by a local of its body. That covers let and closure bindings, closure and function parameters, tuple, slice, reference and match patterns, and a nested fn. Such a test is refused direct credit in two places:
the diff relation, classify/related_tests.rs;
the repo seam relation, test_grip_evidence/related_tests.rs.
Shapes that still keep direct credit:
the call comes before the binding, or inside the binding's own initializer;
the call is qualified (super::dt, or crate::dt inside assert_eq!);
a block imports the name;
the name appears in a macro other than a std macro;
the name appears in a macro operand that spells use, mod or a nested macro.
Generated tests are read from their expanded body.
Activity
coderabbitai commentedon Nov 13, 2026
🔗 Related PRs
#10240 - fix(rust): resolve owner identity for boundary call inputs (
#10046) [closed]📝 Issue Planner
Check the box below or use the
@coderabbitai plancommand to generate an implementation plan and prompts that you can use with your favorite coding assistant.🧪 Issue enrichment is currently in open beta.
You can configure auto-planning by selecting labels in the issue_enrichment configuration.
To disable automatic issue enrichment, add the following to your
.coderabbit.yaml:💬 Have feedback or questions? Drop into our discord!
EffortlessSteven commentedon Nov 13, 2026
Verified fixed at PR #14513 head
751ac6c527(not yet landed on main).With a fresh build from a clean detached worktree at that head, the repro in the issue now reads:
src/lib.rs::owner—strongly_gripped,direct_owner_call, high,observed_values: ["100"].src/lib.rs::unrelated::dt—activation_unknown,reach: weak, "No test is seen calling dt; tests share only its file or a name token". Nodirect_owner_call, noreach: yes.The refusal comes from
alias_spelling_binds_other_ownerinmatch_direct_owner_call(crates/ripr/src/analysis/test_grip_evidence/related_tests.rs), which refuses the generic same-file call-name credit when every call of the name is bound to a direct-owner import alias of a different function.Keeping this open until #14513 lands, then closing it as fixed by that PR.
EffortlessSteven commentedon Nov 13, 2026
Reconciliation with current #14513 head
751ac6c52781a1d28fb442929779713e323bdd76: the issue's executable reproduction is reported at48be3057, not this newer head. Source inspection now finds analias_spelling_binds_other_ownerrefusal in the generic named-call branch ofmatch_direct_owner_call, directly before direct-call candidate insertion. The PR body also reports its Probe C leaves the sibling without a direct-owner relation. This may cover this residual; I have not independently rerun the issue fixture, so this is not closure evidence.Acceptance to preserve on the eventual exact head: genuine
ownerretains its intended relation/values, whileunrelated::dthas no incorrectly credited related test or reach-yes claim. Check the whole relation set, not only grip or removal ofDirectOwnerCall. This residual is separate from the unexecuted library-versus-binary compilation-unit concern in #14513 and from #14508's default diff-mode acceptance, which #14513 explicitly excludes. Existing #14513 ownership remains canonical; no duplicate writer or CI request.[-]rust: a same-file sibling function of the alias name still reads direct_owner_call/reach:yes although no test calls it (#14508 residual)[/-][+]rust: a non-import binder (let/closure) of the owner's name still reads direct_owner_call/reach:yes although no test calls the owner (#14508 residual)[/+]EffortlessSteven commentedon Nov 26, 2026
Claiming the non-import binder residual.
claude/project-thread-jbootmmainat787884266(src/lib.rs::unrelated::dtstill readsstrongly_gripped/direct_owner_callfromclosure_binder)Plan: a syntax-backed check that every mention of the owner's name in the test is bound by a test-local
let, closure parameter, parameter or nestedfnin scope at that mention (block-scoped, so a call in alet's own initializer or after the binding's block ends keeps the credit). When it holds, both the diff-mode relation and the repo seam drop thedirect_owner_callrow, like the #14069 rename refusal. Anything the tree cannot settle (a qualified mention, an import or glob in an enclosing block, a non-std macro) keeps the current credit.Generated by Claude Code
fix(analysis): refuse a macro operand that spells use or mod, skip fi…
fix(analysis): read a macro-generated test's local binders from its e…
test(fixtures): re-bless five shadowed-closure goldens for #14552
fix(analysis): refuse a nested macro in an operand, admit field, slic…
chore(cache): move the local-binder bump to 1.204 / 0.206 after main …
test(honesty): recapture corpus reports at cache generation 1.204 (#1…
fix(analysis): read a split `::` inside a macro as a path separator (#…
EffortlessSteven commentedon Nov 26, 2026
Delivered by #16298, merged to
mainasc1a479243b(2026-11-26 06:39 UTC, through the merge queue).Residual repro.
src/lib.rs::unrelated::dtnow readsreach: weakwith relationsame_test_fileand nodirect_owner_callforclosure_binder. Before the fix it readstrongly_gripped/reach: yes. This is the same weak same-file row thatowneralready had, which this issue calls correct. The honesty corpus pins it asrust_repo_exposure_local_binder_named_like_other_function_not_promoted.Control. When the binder sits in an inner block and the owner is called outside that block, the test keeps
direct_owner_call. This is pinned asrust_repo_exposure_local_binder_named_like_owner_block_control.How it works.
every_mention_bound_locally_in_treeinanalysis/syntax/name_scope/local_binding.rshandles a test whose every mention of the owner's name is bound by a local of its body. That coversletand closure bindings, closure and function parameters, tuple, slice, reference and match patterns, and a nestedfn. Such a test is refused direct credit in two places:classify/related_tests.rs;test_grip_evidence/related_tests.rs.Shapes that still keep direct credit:
super::dt, orcrate::dtinsideassert_eq!);use,modor a nested macro.Generated tests are read from their expanded body.
The cache generation is now 1.204 / 0.206.
The method-name variant stays with #5335.
Generated by Claude Code