Repository navigation
fix(python): bind an import alias to the test that imports it (#8247) - #8323
Conversation
Sink alignment pooled owner import aliases across every test, so an uncalling test importing the owner as `quote` let another test's `assert quote(10) == 30` (a different function) count as observing the owner. The alias credit branch now reads the asserting test's own imports. Related to #8247 (does not close it). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014jMhGfi7oVzwo4DQivjP2y
|
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 20 minutes. View limit details
Comment |
There was a problem hiding this comment.
Decision
- Needs verification checks before upstream.
Verification questions
- Confirm import use-list trim removes
import_module_may_be_ownersfrom both python.rs and sink_alignment.rs with no remaining callers in this diff; verify it is still referenced elsewhere before relying on the trim as dead-code removal. - Confirm per-test alias scope drops legitimate cross-statement calls in the donor test when source facts exist.
- Confirm positive control asserts equality of fixture output, not the fix's reported classification path.
- Confirm cargo-test sensor is
scheduled-late; no witness receipt is in this packet. Until a focusedcargo test --locked -p ripr(or equivalent) receipt lands, red/green proof rests on author attestation plus corpus/goldens.
Refuted
- A different test's
from m import owner as quotecould still let an unrelated method-owner or activation-controlled test count as observing the owner via the pooled alias_tokens used by the None-test fallback; refuted because: Inspected alias_tokens construction: for method owners is_method_owner early-returns empty; for activation-controlled tests activation_control(test).is_some() early-returns empty. The pooled set therefore only contains free-function aliases from non-activation tests, matching the documented fallback. - is_method_owner branch was silently removed and method-class aliases now leak into the free-function alias set.; refuted because: owner_aliases_in early-returns Vec::new() when is_method_owner is true, preserving the previous behavior of skipping method owners for alias pooling. The original code used an
if is_method_owner {...} else {...}inside the loop; the new closure short-circuits earlier but yields the same empty set.
Evidence gaps
- Model proof intent was rejected by deterministic validation.
- ripr sensor failed exit_code=2 in this packet; cargo-test is scheduled-late so RED/GREEN proof of another_tests_owner_alias_does_not_credit_a_different_function is not in evidence yet.
|
Claiming this PR for review and merge convergence (newest-first backlog lane). Backlog-oldest-first thread: please skip #8323. Generated by Claude Code |
…8247 The repair-card corpus gains one orthogonal card from the new fixture, and the human golden follows the compact summary format on main. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XJQ3eTmHZCPmLwyb77Hexw
|
Local proof at head 7e95df9 (includes a merge of current main):
Generated by Claude Code |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
There was a problem hiding this comment.
Decision
- Needs verification checks before upstream.
Verification questions
- Confirm hard
import.alias.len() >= 2filter added inowner_aliases_in(single-letter aliases dropped) and continued into pooled fallback; could miss same-named function bivariance in 1-char alias edge cases not covered by SPEC. - Confirm import_module_may_be_owners removed from both python.rs and sink_alignment.rs use lists in this diff; verify it has no remaining in-crate caller before treating the trim as dead-code.
- Confirm the positive control only asserts assert_shop_fee_exposed(&own); the asserting test's own alias is still observed, which the PR claims is the only way alias credit should attach. Without inspecting assert_shop_fee_exposed it cannot be verified whether 'exposed' here comes from the own-alias branch or from a different rule (e.g. direct imported_or_called identity).
Refuted
- The positive-control branch
assert_shop_fee_exposed(&own)is tautological because it asserts the classification produced by the function under test; refuted because:assert_shop_fee_exposedis an existing helper that pins the classification output against the expected class string; it asserts the rendered result, not the function. Additionally, this branch proves the alias scope change does not over-trim (the asserting test's own alias still credits), which is a distinct invariant from the borrowed-donor branch. - Helper locality is wrong: closure belongs in related_tests.rs next to alias-resolution helpers, not nested in classify_sink_alignment_with_old, which already mixes source_facts, related_tests, and inference.; refuted because: Closure is a one-line projection from (test, owner) used only at two sites in this same function (consumer + pooled flatten). Extracting it now would add indirection without reducing coupling; locality is consistent with the pre-existing pattern of inline closures in this classifier.
Parked follow-ups
- The trimmed import use list removes import_module_may_be_owners from python.rs and sink_alignment.rs but the author note flags confirming it is still referenced elsewhere before relying on trim as dead-code removal.
Evidence gaps
- Model proof intent was rejected by deterministic validation.
- New triple-branch test (
borrowed,renamed_donorcontrol,own_aliaspositive) plus corpus casepy_cross_test_import_alias_not_borrowedconstitute red/green proof for #8247. Without a focusedcargo test --locked -p riprreceipt, proof rests on author attestation plus corpus/goldens.
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Previous hosted Rust gate on 7e95df9 failed only on Generated by Claude Code |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
…ct (#8165) Ported from #8351 so this PR's required goldens check is not red on a base-branch drift it did not cause. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014jMhGfi7oVzwo4DQivjP2y
|
CI status on the previous head: Generated by Claude Code |
# Conflicts: # fixtures/one_hop_field_projection/expected/CHANGELOG.md # fixtures/one_hop_field_projection_discarded/expected/CHANGELOG.md # fixtures/one_hop_field_projection_sibling/expected/CHANGELOG.md # fixtures/one_hop_field_projection_wrong_sink/expected/CHANGELOG.md # fixtures/rust_map_insert_count_empty/expected/CHANGELOG.md # fixtures/rust_map_overwrite_count/expected/CHANGELOG.md # fixtures/seeded_push_after_early_return/expected/CHANGELOG.md # fixtures/typescript_mock_payload_iife_impl/expected/CHANGELOG.md
There was a problem hiding this comment.
Decision
- Needs reviewer attention before upstream: findings remain.
Confirmed findings
- Corpus inventory pin in gap_decision_ledger.rs was bumped orthogonal 13→14 with an inline comment crediting this PR; any future fixture change that also adds an orthogonal card will require re-blessing this pin and a fresh review.
- evidence-promotion-honesty corpus adds py_cross_test_import_alias_not_borrowed with expected_class=weakly_exposed and expected_finding_count=1; assertion
must_not_promoteis the load-bearing one. No run receipt in this packet.
Verification questions
- Confirm import_module_may_be_owners trimmed from python.rs and sink_alignment.rs use lists but the PR text and prior thread flagged 'verify it has no remaining in-crate caller.' Local read of the diff does not show in-crate use; sink_alignment.rs previously called it inside the removed loop only. Symbol still appears in related_tests module (file not fully re-read).
- Confirm import_module_may_be_owners import removed from both python.rs and sink_alignment.rs use lists; dead-code trim appears safe in-crate.
- Confirm positive control in another_tests_owner_alias_does_not_credit_a_different_function relies on assert_shop_fee_exposed; helper semantics and the alias-vs-direct identity split were not inspected by this lane.
- Confirm import_module_may_be_owners removal in python.rs is dead-code trim; verify no other in-crate caller before relying on it.
- Confirm hard
import.alias.len() >= 2filter drops single-letter aliases (e.g.as q) globally, including the asserting test's own alias; this is a behavior tightening not described in SPEC.md or changelog, and could miss a real exposed case in production code.
Refuted
- Positive control 'assert_shop_fee_exposed(&own)' is tautological because it asserts the function-under-test's own output.; refuted because: assert_shop_fee_exposed is an existing classification-pinning helper used throughout this test module. The positive control demonstrates the asserting test's own alias still observes the owner — the intended behavior — without referencing the function under test directly.
- Closure change re-runs the per-test loop N times (one per unit) instead of the original O(all_testsimports) once, leaking quadratic behavior.; refuted because: owner_aliases_in is still O(all_testsimports) when built once via flat_map into alias_tokens; the per-test call site is over unit.test (the single assertion-bearing test of the current unit) plus the pooled fallback for None-test units, so the worst-case is roughly 2x the original aggregation, not quadratic.
Parked follow-ups
- Hard alias.len() >= 2 filter drops single-character aliases globally; edge-case 1-char owner names may under-credit legitimate bivariance.
Evidence gaps
- New test another_tests_owner_alias_does_not_credit_a_different_function covers the cross-test alias case plus renamed-donor control and positive control, but cargo-test is scheduled-late; no receipt in this packet. Until cargo test --locked -p ripr --lib python (or equivalent) lands, red/green proof rests on author attestation.
|
Reply to the github-actions review on this head, source-checked:
Generated by Claude Code |
Related to #8247 (does not close it).
Claim
Sink alignment pooled owner import aliases across every Python test. An uncalling test that imports the owner as
quote(from src.shop import fee as quote) let a different test'sassert quote(10) == 30(wherequoteissrc.fixed.fixed) count as observing the owner, so the finding was reportedexposed / alias. The alias credit branch now reads only the asserting test's own imports. When a unit has no source facts, the pooled set is kept as before.Evidence
another_tests_owner_alias_does_not_credit_a_different_functionfails with the fix reverted and passes with it. It includes a renamed-donor control and a positive control (the asserting test's own alias staysexposed).python_cross_test_import_alias:weakly_exposedwithorthogonalalignment.py_cross_test_import_alias_not_borrowed;cargo xtask check-evidence-promotion-honestypasses.cargo xtask precommitexit 0. All real Python fixtures pass.verdict-corpus checkis unchanged at 13/486 false, 0 contradictions.cargo xtask goldens check(offline cargo cache cannot prepare fixture deps), full workspace tests, hosted CI.Remaining on #8247
Wrong-receiver pooling and the walrus /
match/ module-level stand-in fail-opens stay open.Generated by Claude Code