Skip to content

slice(#2664-A): allow cross-crate test match when calls_owner signal is true (minimal fix) #2971

Description

@EffortlessSteven

Parent

Scope

Minimal fix: allow cross-crate test matching when the calls_owner signal is true, via a two-pass reordering. Does not require #2665's dep graph.

Activity

  1. added
    status/needs-work
    on Aug 6, 2026
  2. EffortlessSteven commented on Aug 7, 2026

    @EffortlessSteven
    MemberAuthor

    Implementation plan: cross-crate calls_owner match (STARTABLE NOW)

    The fix

    In related_tests.rs:43-48, the package-prefix guard runs BEFORE calls_owner is computed (L55-57). A cross-crate test that genuinely calls the owner is filtered out before the strong signal can save it.

    Minimal fix: Move the calls_owner / assertions_reference_owner computation (L55-70) ABOVE the prefix block (L44-54), then change the guard to only suppress weak signals:

    if let Some(prefix) = &owner_package_prefix
        && !normalize_path(&test.file).starts_with(prefix)
        && !calls_owner
    {
        continue;
    }
    

    Test update required

    related_tests.rs:177-201 (given_owner_function_when_tests_share_name_across_packages) currently asserts len()==1. Under the fix, a crate_b test whose body calls 'score' would now match. Update the test: either (a) remove the calls_owner trigger from the decoy test (preserving the same-name false-positive guard intent), or (b) assert len()==2 and rename to reflect cross-crate callers are now related.

    Positive test to add

    Cross-crate test that calls the owner -> related with RelationReason::DirectOwnerCall.

  3. removed
    status/needs-work
    on Aug 8, 2026
  4. EffortlessSteven commented on Aug 8, 2026

    @EffortlessSteven
    MemberAuthor

    Reopening — the #3014 implementation credits name-token coincidence across crates

    Evidence (verified on clean main 992e594e, 2026-08-08):

    • cargo test -p ripr --lib given_owner_symbol_when_resolving_owner fails on main: assertion failed: left: 2, right: 1 at crates/ripr/src/analysis/classifier.rs:84.
    • The fixture has score in both crate_a and crate_b; crate_b_score_test calls score(2) — crate_b's score, not the probe owner (crates/crate_a/src/lib.rs::score). The test exists to prove full-identity alignment wins over name alignment.
    • fix(analysis): allow cross-crate test match when calls_owner is true (#2971) #3014's change computes calls_owner by bare call-name equality (call.name == owner_name) and lets it override the package-prefix guard, so a cross-crate test calling a different same-named function is credited as related to the probe's owner. That is the token-coincidence false-exposed family from AGENTS.md / docs/LEARNINGS.md — the guard the change relaxes is the production discriminator for exactly this case.
    • The same-name decoy the PR updated only covers a cross-crate test with empty calls; any cross-crate test that calls a same-named function still defeats the guard.

    Disposition: the related_tests change is reverted on the main-unblock branch (#3028) to restore the identity-precision invariant and the required gate. #2971's premise is real — a cross-crate test genuinely calling the owner is invisible today — but a correct implementation must align on identity (e.g. receiver/path resolution, or an explicit ambiguity rule when multiple same-named owners exist), not on the bare name token. Restoring status/needs-work; kept target/0.13 + target/conditional.

  5. added
    status/needs-work
    and removed on Aug 8, 2026
  6. EffortlessSteven commented on Aug 8, 2026

    @EffortlessSteven
    MemberAuthor

    Reopened after post-merge review

    PR #3014 landed the intended production reorder, but its test change is not discriminating: the cross-crate decoy now has no relation signal and would be dropped even if the package-prefix guard were broken, while no positive cross-crate direct-owner-call fixture proves the new path.

    #3033 owns the bounded positive/negative oracle repair and removal experiments. This issue is therefore status/partial, not completed. Close it only after #3033 proves both the direct-call exception and the weak-signal false-positive guard.

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

    status/needs-work

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions