Skip to content

fix(rust): a comparison macro import must name the macro as a direct item of its crate (#10389) - #10494

Merged
EffortlessSteven merged 4 commits into
mainfrom
claude/project-thread-lpb3vw
Oct 26, 2026
Merged

EffortlessSteven merged 4 commits into
mainfrom
claude/project-thread-lpb3vw

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

Summary

Before: the known-comparison-macro exception for a boolean assert! (#10445) accepted any use float_cmp::... tree that mentioned the macro name, so use float_cmp::other::approx_eq; or use float_cmp::approx_eq::other; counted as importing approx_eq.

After: the name must be a direct item of its crate: use float_cmp::approx_eq; or one entry of use float_cmp::{.., approx_eq, ..};. Deeper or nested paths no longer count, so those assertions withhold the return-value credit.

Source-of-truth Links

Governing issue or accepted claim: #10389 (closed by #10445; this is its tracked residual)
Acceptance delta (one sentence): The nested-comparison-macro exception only applies when the macro is imported as a direct item of its own crate.

Scope

  • classify/owner_pin.rs: imported_comparison_macros parses the use tree instead of testing that it contains the name.
  • classify/owner_pin/tests.rs: comparison_macro_imports_must_name_the_macro_as_a_direct_item_of_its_crate.
  • changelog.d/10389-comparison-macro-import-direct-item.md.
  • No corpus row or golden moves (the Rust corpus check-all passed on the same code before rebasing onto main).

Proof

cargo test --locked -p ripr --lib comparison_macro_imports   # 2 passed
cargo test --locked -p ripr --test dead_context_assertion_admission   # 3 passed
cargo xtask verdict-corpus check-all                          # 4 corpora, exit 0
cargo xtask precommit                                         # exit 0 on the pre-rebase tree

Claim Boundary

May claim: float_cmp::other::approx_eq and similar deeper paths no longer count as importing the known macro. Must not claim: import scope resolution (a use of the name inside an unrelated module is still not scope-resolved; any other use of the name refuses, as in #10445).

Rollback

Revert the squash commit.

Spec-Test-Code Traceability

  • Tests: crates/ripr/src/analysis/classify/owner_pin/tests.rs
  • Code: crates/ripr/src/analysis/classify/owner_pin.rs

Generated by Claude Code


Devin Review

@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!

@coderabbitai

coderabbitai Bot commented Oct 25, 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 30 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 183 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
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: ad8c7bbf-bf71-404d-8df9-bb058dbb7222
Commits

Reviewing files that changed from the base of the PR and between acc616c and ffa5c98.

Files selected for processing: 4
  • changelog.d/10389-comparison-macro-import-direct-item.md
  • crates/ripr/src/analysis/classify/owner_pin.rs
  • crates/ripr/src/analysis/classify/owner_pin/tests.rs
  • crates/ripr/tests/dead_context_assertion_admission.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@devin-ai-integration devin-ai-integration 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.

Devin Review found 2 potential issues.

Devin Review

@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.

Decision

  • Needs one test-proof clarification before upstream.

Verification questions

  • Confirm the PR's cited focused test commands provide the intended red/green proof, but the final cargo-test receipt is not yet present in the packet.

Refuted

  • The new direct-item parser creates a worker/async handoff, ownership-transfer, GC, or detach risk.; refuted because: The diff only parses Rust source text into a BTreeSet and compares synchronous admission-test inputs. It adds no threads, tasks, callbacks, native handles, shared ownership, or transfer operations.
  • The change could create a denial-of-service or crash through malformed use-tree parsing.; refuted because: The parser operates on already-collected lexical use trees and uses bounded string operations; no unbounded recursion, indexing, allocation loop, panic path, or attacker-controlled external input was introduced in this diff.

Parked follow-ups

  • The change does not implement Rust scope resolution; matching is intentionally lexical and the PR claim boundary excludes unrelated-module use statements.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.
  • Full test execution remains pending because cargo-test was scheduled late and the ripr sensor failed with exit code 2; this limits assurance that unrelated classifier paths retain their prior behavior.

Copy link
Copy Markdown
Member Author

Review of record for head ffa5c98. This PR only narrows a lexical import check from #10445, so the review is by angle on that diff.

Open threads all have a fix or an evidence-backed reply. Merging.


Generated by Claude Code

@EffortlessSteven
EffortlessSteven merged commit 7963cfc into main Oct 26, 2026
56 checks passed
@EffortlessSteven
EffortlessSteven deleted the claude/project-thread-lpb3vw branch October 26, 2026 00:19

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Independent exact-head follow-through (2026-10-26 UTC). No actionable source findings emitted within the assigned lexical scope.

reviewed_head_sha: ffa5c98e670b2d8fc3df387024ff5313bf833a0b
integration_basis: PR base acc616cf18d3d582de1bdee526e75b1315dd4c15; hosted merge-test object e814b84470558cdd58c2e6e0037bc671cbf05d70.
landing: GitHub already reported this PR merged at 00:19:50 UTC as 7963cfc73dff12c6c09081acc115aa519fa23b6c before this review began. This pass performed no merge, branch edit, CI request, or external-agent contact.

Inspected surfaces and semantic owners:

  • All four changed files, including the final successor's imported_comparison_macros, its unit rows, the added analyzer integration case, and the changelog.
  • Followed the imported-name set through nested_macros_are_known_comparisons into the MacroOperandExit arm of admits_assertion_family. Return-value admission still requires the other exit-token, attribute, definition-ambiguity, and per-assertion context gates.
  • The final guard rejects a group containing either brace before comma splitting. Thus float_cmp::{inner::{x, approx_eq, y}} cannot expose the middle approx_eq token as a direct item. The dedicated negative unit row is present, alongside deeper-path and nested-without-comma negatives and direct/flat-group positives. As a source-level oracle challenge, removing that brace guard would split the example into inner::{x, approx_eq, y} and contradict the negative assertion. This walkthrough is not a locally executed mutation test.
  • The added deeper_path_use_of_the_macro_name integration case goes through check_workspace, requires a return-value finding, and asserts it receives neither exposed nor weakly_exposed credit. The comma-nested control itself is helper-level, not a separate analyzer integration case.

Observed exact-head proof:

  • Qualification run 40245188753, attempt 1 has API head_sha=ffa5c98e670b2d8fc3df387024ff5313bf833a0b. The actual Rust job checked out the merge-test object above.
  • Rust gates job 121325454550: both import tests and the boolean nested-macro integration test passed; nextest reported 21,644 passed, 5 skipped. All-features check, strict workspace Clippy, evidence-promotion honesty, golden/fixture contracts, and all four verdict corpora completed successfully. Doctests: 2 passed, 1 ignored. Corpus success means its configured thresholds passed; it does not mean zero known false verdicts.
  • Ripr Rust Small Result job 121335900743 is successful. The successfully read main-branch metadata names that required context (GitHub Actions app 15368).
  • The separate Rust-only CI job 121325153514 used the same merge-test identity and shows both import tests and all three admission integration tests passing.
  • No pre-rebase precommit/corpus claim was transferred to this head. The landed helper also matches the helper at observed main 699c248cb3f3a6bc7da7905eb2a38032df33d074; compare metadata confirms the landing is its ancestor. This is source-preservation evidence, not post-merge full-suite proof.

Residual assumptions and missing proof:

  • Matching remains lexical. Unrelated-module import resolution is excluded. Any nested group is conservatively refused, including one beside a direct macro item.
  • The third-party-macro fixture is analyzer input with unresolved macro dependencies; passing the harness does not establish that the generated fixture compiles, expands the real macro, or executes at runtime.
  • Cargo/rustc are unavailable locally, so no local Rust or removal experiment was run. A direct GET of commits/ffa5c98e670b2d8fc3df387024ff5313bf833a0b/check-runs returned Forbidden; that operation was stopped without retry or alternate-route access. The observed workflow/run/job evidence above remains distinct from a complete check-run inventory or historical protection audit.
  • No candidate-introduced source blocker was confirmed. Main compilation repair #10506 remains outside this assignment; inherited mock errors are not attributed to this diff.

disposition: REVIEW_READY for the bounded lexical delta on the independently inspected published head and observed hosted qualification, recorded after its existing landing. This is not a retroactive pre-merge clearance or a claim that this pass executed the merge. Existing writer ownership is preserved; no candidate/worktree/build resources were allocated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants