Skip to content

test(macro-names): make the helper-hop macro shadow test discriminate (#8467) - #8616

Merged
EffortlessSteven merged 1 commit into
mainfrom
claude/project-thread-nx04on
Oct 18, 2026
Merged

EffortlessSteven merged 1 commit into
mainfrom
claude/project-thread-nx04on

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

Requested by Steven Zimmerman · project thread

Summary

Before: helper_transfer::tests::test_call_is_shadowed_by_a_macro_defined_same_named_fn still passed with the macro rule disabled, because the lexical body scan saw fn order_discount in 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:ident binder, so only the macro rule can shadow the call; a make!(other_name) control asserts the call stays unshadowed through the same entry point.

Swarm / Source Boundary

  • ordinary feature, analyzer, editor, docs, spec, fixture, badge, dependency, or repo-ops development for ripr-swarm

Source-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-nx04on
Stack parent or prerequisite PR (if any): none
Related, not a replacement: #8516 (different findings; edits macro_item_names.rs, this PR edits helper_transfer.rs only)

Scope

  • crates/ripr/src/analysis/classify/helper_transfer.rs: one unit test.

Scope Classification

  • Docs/spec/test-only evidence package

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

  • none

Policy Impact

  • none

Proof

cargo test -p ripr --lib test_call_is_shadowed   # 2 passed
cargo xtask precommit                            # exit 0

Result: mutation witness recorded. With macro_may_define_item_named disabled in file_imports_foreign_callee_name the 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

  • Spec: RIPR-SPEC-0229 (credit unchanged and now accurate)
  • Tests: helper_transfer.rs::tests::test_call_is_shadowed_by_a_macro_defined_same_named_fn
  • Code: none changed

Static Language Check

  • Static output avoids killed, survived, untested, proven, and adequate.

CI Economics

n/a

🤖 Generated with Claude Code

https://claude.ai/code/session_01Q84SqQ7xe9FsNYjVh4x76k

…#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
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@EffortlessSteven EffortlessSteven self-assigned this Oct 17, 2026
@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

  • Ask an admin to enable usage-based reviews

Open in CodeRabbit

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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 77 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: 138a45bc-8893-4c28-8edd-0a21495b1381
📥 Commits

Reviewing files that changed from the base of the PR and between fc81995 and 0276ebe.

📒 Files selected for processing: 1
  • crates/ripr/src/analysis/classify/helper_transfer.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 String value 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.

@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 17, 2026 23:26
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

Copy link
Copy Markdown
Member Author

Self-review of exact head 0276ebe9 (COMMENT, author's own PR): REVIEW_READY for the source and oracle dimensions.

  • Inspected: the full diff (one test in helper_transfer.rs, no production change), the semantic owner file_imports_foreign_callee_name and its macro_may_define_item_named call, and the consumers named in .ripr/traceability.toml and RIPR-SPEC-0229 (credit stays accurate, no edit needed).
  • Stimulus: the macro names the fn only via $n:ident, so the lexical body scan cannot see fn order_discount.
  • Oracle: positive assertion plus a same-entry-point negative control (make!(other_name)).
  • Mutation witness: with the macro rule disabled the test fails; before this change it passed. Reverted afterward.
  • Local proof: cargo test -p ripr --lib test_call_is_shadowed 2 passed; cargo xtask precommit exit 0.
  • Provider review: Gemini and CodeRabbit are quota-limited (missing, not clean). The GitHub Actions review bot raised no defects.

Marked Ready for hosted qualification; I will inspect the result on this exact head before merging.


Generated by Claude Code

@EffortlessSteven
EffortlessSteven merged commit 278b651 into main Oct 18, 2026
42 of 44 checks passed
@EffortlessSteven
EffortlessSteven deleted the claude/project-thread-nx04on branch October 18, 2026 00:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants