Repository navigation
test(macro-names): make the helper-hop macro shadow test discriminate (#8467) - #8616
Conversation
…#8467) The positive was also satisfied by the lexical body scan (the macro text spelled fn order_discount). The macro now names the fn only through an $n:ident binder, with a same-entry-point negative control; the test fails when the macro rule in file_imports_foreign_callee_name is disabled. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q84SqQ7xe9FsNYjVh4x76k
|
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 58 minutes. View limit details
Comment |
There was a problem hiding this comment.
Confirmed findings
- Test discrimination is the substantive concern, not UB/memory. Mutation claim (disabling macro_may_define_item_named makes test fail) is the real correctness gate; cargo-test receipt is scheduled-late and not yet landed at compile time of this lane.
- ub-active-view lane reports no findings: diff is test-only Rust; no ArrayBuffer/TypedArray/resizable-buffer/transfer/detach surface was touched. Active-view invariants are not applicable to this path.
- Lane out of scope: diff is Rust unit-test only, no JS/Worker/SharedArrayBuffer/Transfer/detach/async-crossing surfaces are introduced, modified, or depended upon. No worker-handoff regression risk is created by this PR.
Verification questions
- Confirm control fixture is asymmetric vs prior version: prior control exercised file_imports_foreign_callee_name directly; new control reuses test_call_is_shadowed entry point with mutated macro arg.
- Confirm no public oracle weakness substantiated: assertions are discriminating, control exercises the negative branch through the same entry point, and PR-cited mutation witness (macro rule disabled -> fail) substantiates red/green correctness. Spec credit for finding 6 (#8467) is restored by the change.
- Confirm mutation claim: disabling macro_may_define_item_named causes failure post-fix; passes pre-fix.
Refuted
- Use of str::replace on test.body could introduce dataflow between the two assertions and leak into the negative case.; refuted because: Replacement is performed on an owned String produced from a fresh format!; positive assertion runs against the pre-replacement body, negative case is a separately constructed String. No carry-over of identity or aliasing exists. Not a security primitive; covered.
- A hidden lexical match (e.g., 'fn order_discount' via backslash or raw-string escape) could still satisfy the body scan and trivially pass even without the macro rule.; refuted because: Both shadow and control use format! concatenation of identical shadow prefix; the macro form has no literal 'fn order_discount' so the lexical body scan sees only 'make!(order_discount)', disproving the hypothesis.
- format!("{shadow}{tail}").into() or .replace() on String could detach or resize an ArrayBuffer/TypedArray active view, leaving a stale length snapshot.; refuted because: test.body is String/ArcStr-like; .into() is String→String/Arc conversion, not transfer/detach. No TypedArray, no backing-store resizing, no length-snapshot surface in this diff.
- After rebinding shadow via .replace("make!(order_discount)", "make!(other_name)"), the control could silently degrade if the template ever contained two occurrences (replace would substitute both, and the helper-hop branch would still look unshadowed).; refuted because: The literal shadow template contains the substring make!(order_discount) exactly once, so a single .replace does not mutate any unrelated tail text; the assertion target (body that no longer matches order_discount via either lexical scan or macro rule) is still exercised. The risk is contained to shadow-template edits, not to this PR.
- format!("{shadow}{tail}") builds an extra String allocation per test, risking needless allocator pressure or lifetime confusion in a test body used downstream as a
Stringvalue via.into().; refuted because: test.body is already an owned String-typed field on TestSummary; format! returning String is the idiomatic conversion path. No borrow extension, no dangling ref, no unsafe. Allocation-failure framing per calibration is irrelevant — body construction is infallible String allocation, not Box::from(slice).
Evidence gaps
- Model proof intent was rejected by deterministic validation.
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Self-review of exact head
Marked Ready for hosted qualification; I will inspect the result on this exact head before merging. Generated by Claude Code |
Requested by Steven Zimmerman · project thread
Summary
Before:
helper_transfer::tests::test_call_is_shadowed_by_a_macro_defined_same_named_fnstill passed with the macro rule disabled, because the lexical body scan sawfn order_discountin the macro text, yet it was credited as coverage of the helper-hop macro path.After: the macro names the fn only through an
$n:identbinder, so only the macro rule can shadow the call; amake!(other_name)control asserts the call stays unshadowed through the same entry point.Swarm / Source Boundary
ripr-swarmSource-of-truth Links
Governing issue or accepted claim: #8467 finding 6 (partial; 2, 4, 5 are in #8516; 3 and 7 stay open)
Acceptance delta (one sentence): the helper-hop macro shadow test fails when the macro rule is disabled, so its traceability credit is accurate.
Candidate Relationships
Candidate branch:
claude/project-thread-nx04onStack parent or prerequisite PR (if any): none
Related, not a replacement: #8516 (different findings; edits
macro_item_names.rs, this PR editshelper_transfer.rsonly)Scope
crates/ripr/src/analysis/classify/helper_transfer.rs: one unit test.Scope Classification
Production delta: none
Evidence/support delta: one test made discriminating
Single acceptance criterion: the test fails with the macro rule off
Non-goals: findings 2-5 and 7 of #8467
Support-tier Impact
Policy Impact
Proof
Result: mutation witness recorded. With
macro_may_define_item_nameddisabled infile_imports_foreign_callee_namethe test fails (it passed before this change); change reverted afterward.Claim Boundary
May claim: finding 6 of #8467 is fixed. Must not claim: the issue is complete.
Rollback
Revert the single commit.
Spec-Test-Code Traceability
helper_transfer.rs::tests::test_call_is_shadowed_by_a_macro_defined_same_named_fnStatic Language Check
killed,survived,untested,proven, andadequate.CI Economics
n/a
🤖 Generated with Claude Code
https://claude.ai/code/session_01Q84SqQ7xe9FsNYjVh4x76k