Skip to content

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

Done

Description

@EffortlessSteven

Status

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/main cc51e23f53) 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.rs
pub fn owner(x: i32) -> i32 {
    x - 10
}

mod unrelated {
    pub fn dt(_x: i32) -> i32 {
        0
    }
}

#[cfg(test)]
mod tests {
    #[test]
    fn closure_binder() {
        let dt = |x: i32| x + 1;
        assert_eq!(dt(100), 101);
    }
}
ripr check --mode draft --format repo-exposure-json --root <fixture>

Observed (at 23c0227137, ripr 0.11.0+23c0227137)

  • 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).

Related

Goal hurt

Trust: a seam that no test reaches is reported as reached, so a real gap is hidden behind a false relation instead of reading as unreached.

Activity

  1. coderabbitai commented on Nov 13, 2026

    @coderabbitai
    🔗 Related PRs

    #10240 - fix(rust): resolve owner identity for boundary call inputs (#10046) [closed]


    📝 Issue Planner

    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!

  2. added
    status/needs-work
    on Nov 13, 2026
  3. EffortlessSteven commented on Nov 13, 2026

    @EffortlessSteven
    MemberAuthor

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

  4. EffortlessSteven commented on Nov 13, 2026

    @EffortlessSteven
    MemberAuthor

    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.

  5. 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
  6. EffortlessSteven commented on Nov 26, 2026

    @EffortlessSteven
    MemberAuthor

    Claiming the non-import binder residual.

    • Branch: claude/project-thread-jbootm
    • PR: to follow
    • 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.


    Generated by Claude Code

  7. EffortlessSteven commented on Nov 26, 2026

    @EffortlessSteven
    MemberAuthor

    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.

    The cache generation is now 1.204 / 0.206.

    The method-name variant stays with #5335.


    Generated by Claude Code

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugfinding-qualityimplementation-slicestatus/needs-worktesting

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions