Repository navigation
fix(rust): an uncalled owner cannot be exposed through same-file tests - #3947
Conversation
A Rust function that no test calls was reported `exposed` with confidence 1.00 when the file's inline test module held strong tests for a different function: every test in the same file counted as related, reach was `yes` for any relation, and the classifier's `exposed` branch never checked reach. - Reach is `weak` (low confidence) when every owner-anchored relation is file or name proximity only (same_test_file, same_module, weak_token_substring). Those tests stay listed as the likely place to add a test. - `exposed` now also requires reach `yes`. New fixture rust_uncalled_owner_same_file_tests (main: exposed 1.00, now weakly_exposed 0.66 with a reach summary saying no test calls the owner). Two goldens reblessed where the only relation is weak_token_substring: reach yes->weak, class unchanged. RIPR-SPEC-0001 states the rule. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018QP9k41E538Xgytw8QCSfM
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Decision
- Needs reviewer attention before upstream: findings remain.
Confirmed findings
- cargo-test receipt listed as receipt-absent in UB packet (always-on base); non-blocking because unit/control tests are demonstrated via diff construction and the claim is provable from changed source + goldens +
--doc-hiddenreview posture. Pending late phase will produce a real receipt before gate.
Refuted
- No resizable-buffer/ArrayBuffer/TypedArray/detach/transfer/stale-length concerns in this Rust analyzer diff; the ub-active-view surface is absent.
- New unit tests would not be red on main because reach_evidence currently returns Yes regardless — so adding the assertion is not actually red; refuted because: reach_evidence returns Yes only after the proximity_only branch is added; on main all non-SeamCalleeCall relations still map to Yes, making given_only_proximity_relations assert Weak fail on main. Decision-level test also fails on main because classify required only discriminate&infect&propagate. Both are genuinely red-on-main.
- Other RIPR stages (infect, observe, discriminate, propagate) can independently produce Exposed from same_test_file proximity alone, requiring a parallel gate in decision.rs; refuted because: Decision.rs's new conjunction gates Exposed on all four stages being Yes. Inspecting reach.rs and the changed fixtures, infect/observe/discriminate/propagate only flip to Yes when the related test body contains observable evidence (assertion argument values, exact-value oracles, propagation witnesses). same_test_file alone does not produce that evidence; the fixture's neighbour tests provide strong assertions that legitimately satisfy those stages. The reach gate is sufficient.
- A name-token matched test (WeakTokenSubstring) could be attacker-influenced (e.g., test name contains owner substring) and let proximity reach evade detection, enabling false-negative Exposed classifications in downstream tooling that consumes reach.state; refuted because: WeakTokenSubstring derives from static tokenization of source identifiers authored in the same repo; the threat model for ripr output is trusted-repo advisory, not adversarial input. Reach is gated by owner_anchored non-empty, and the control test pins reach=Yes when DirectOwnerCall co-occurs with proximity relations. No untrusted taint path into the reach summary.
Parked follow-ups
- Sibling reach helper test_grip_evidence.rs is referenced in PR body as unchanged and out-of-scope; PR explicitly limits claim to diff-scoped Rust findings, not repo-scoped seam grip.
- Residual risk: the spec says 'helper chain' but reach.rs proximity-only only treats SameTestFile/SameModule/WeakTokenSubstring as proximity; if a future helper-chain RelationReason is added and inadvertently included in is_proximity_only, an indirect call could be downgraded to Weak and hide real reach. Not exploitable today, watch on additions.
Evidence gaps
- Model proof intent was rejected by deterministic validation.
…_file_tests patch The Rust gates run git diff --check on the PR range, and the single-space blank context lines in diff.patch read as trailing whitespace. The hunk now carries only the three non-blank lines around the change; the golden moves only by input_identity. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018QP9k41E538Xgytw8QCSfM
# Conflicts: # fixtures/assertion_shaped_control_production_caller/expected/CHANGELOG.md # fixtures/rust_constructor_field_observation/expected/CHANGELOG.md
…anded None-default base envelope RIPR-SPEC-0084 (landed on main since the branch was cut) changed the --diff fixture envelope: the top-level base field is omitted and base_revision records null. The new fixture authored on this branch predates that contract. Findings, reach, classes and confidences are unchanged; drift was formatting-only (110 lines, semantic findings byte-identical). Merge resolution note: kept main's landed RIPR-SPEC-0084 rebless entries and renumbered this branch's RIPR-SPEC-0001 entries per fixture to keep pending headings unique (MD024).
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
Decision
- Needs reviewer attention before upstream: findings remain.
Confirmed findings
- The PR is a Rust static-analysis behavior change (reach/classify gating + goldens). It does not touch resizable buffers, active views, ArrayBuffer/TypedArray resize/detach/transfer, or any JS/JS-style stale-length surface. Lane is out of scope.
Refuted
- A separate gate in classify() duplicates the proximity check that is now centralized in reach_evidence.; refuted because: reach_evidence returns StageState::Weak when proximity_only holds, and classify() only gates on that scalar; there is no second proximity pass and no RelationReason branching in classify(). The previous reach-Yes behavior was a single missing guard, not duplicated logic.
- The new Weak branch could be reached with owner_anchored empty and silently downgrade a real reach=Yes path to Weak.; refuted because: Branch is gated by
!owner_anchored.is_empty(); the existing owner_anchored-empty summary path still runs and returns Yes as before. No code path was removed or weakened.
Parked follow-ups
- reach.rs::reach_evidence is the single builder for owner reach; a non-empty SeamCalleeCall relation defers to the existing Yes branch even when only weak tokens are present, so the token
vatcase stays Weak. - Park rather than broaden: same_test_file/same_module proximity should remain Weak (not No), matching Python/TypeScript heuristic rule per PR decisions.
- The two parked candidates (candidate-0004-99a52d8e3ef9 and candidate-0007-3c6f31b6f8bd) belong outside the current PR scope.
Evidence gaps
- Model proof intent was rejected by deterministic validation.
Requested by Steven · project thread
Summary
Before: a Rust function that nothing calls, changed from
(cents + 50) / 100to(cents + 49) / 100, was reportedexposedwith confidence 1.00 and "Related tests appear to reach untested_rounding: discount_applies_at_100, …". Those tests call a different function in the same file. This is the most trust-damaging result from the language walkthrough, becauseexposedtells a reviewer they need not look.After: the same change is
weakly_exposed(0.66), and the reach line says "No test is seen calling untested_rounding; tests share only its file or a name token: discount_applies_at_100, discount_small_unchanged". Those tests remain listed as the likely place to add one.How:
reach_evidencereturnedyesfor any relation, includingsame_test_fileandweak_token_substring, andclassifycould returnExposedwithout checking reach. Reach is nowweak/low confidence when every owner-anchored relation is proximity-only (same_test_file,same_module,weak_token_substring), andExposedalso requires reachyes.Swarm / Source Boundary
ripr-swarmSource-of-truth Links
Spec: RIPR-SPEC-0001 (rule added under Classifications)
Issue: none filed; found in the language-quality walkthrough for 0.11
Scope Classification
Single acceptance criterion:
exposed.Non-goals (separate findings from the same walkthrough):
100count as matching probe tokens in reveal (extract/text.rs:22), so they can still credit a discriminator for a test that really does call the owner.related_tests.rs:463).test_grip_evidence.rs) has its own reach and is unchanged here.Decisions (overrule on review)
weak, notno. Considered making proximity-only reachno(no_static_path). That drops the test file as the suggested place to add a test, and Python and TypeScript already treat heuristic-only links as weak (weakly_exposed). Soweakkeeps the three languages on one rule: proximity is weak, and it is never exposed.owner_named_teststays anchored. A test whose name contains the owner's name but whose call was not captured (for example, called through a macro) is more likely to reach the owner than a file neighbour. Demoting it too would move many more results with less evidence that they are wrong.given_three_character_probe_token_in_test_name_when_owner_is_not_called_then_test_is_relatedpinned reachyesfor a test matched only by the tokenvatin its name. It now pinsweakand not-exposed. The test stays related.Support-tier Impact
Policy Impact
Proof
reach_evidencealways returnsyesfor a non-empty relation list:given_only_proximity_relations_when_building_reach_evidence_then_reach_is_weakclassify_does_not_emit_exposed_when_reach_is_weakgiven_one_calling_test_among_proximity_relations_when_building_reach_evidence_then_reach_is_yes.rust_uncalled_owner_same_file_tests: main's binary reportsexposed 1.0/reachyes; this branch reportsweakly_exposed 0.66/reachweak.weak_token_substring:assertion_shaped_control_production_callerandrust_constructor_field_observation. Class is unchanged in both (propagation_unknown), reach goes fromyestoweak, and one confidence moves from 0.66 to 0.63.pricing: only the uncalled owner's finding changed. The other nine findings are identical.Not run:
cargo xtask dogfood, other integration test binaries, Windows. CI covers them.Claim Boundary
May claim: diff-scoped Rust findings no longer report
exposedfrom proximity-only relations. Must not claim: repo-scoped seam grip uses the same rule.Rollback
Revert the commit; the goldens and the fixture revert with it.
Static Language Check
killed,survived,untested,proven, andadequate.CI Economics
n/a
Engineering Check
panic,unwrap,expect,todo, orunimplementedin production code or tests.🤖 Generated with Claude Code
https://claude.ai/code/session_018QP9k41E538Xgytw8QCSfM
Generated by Claude Code