Repository navigation
fix(owner-pin): a std/core/alloc glob import no longer makes every plain assert_eq! "not credited" (#8388) - #8529
Conversation
…sertion A glob import rooted at an unshadowed std, core or alloc (for example the cfg-gated `use core::simd::prelude::*;` in rand) was recorded as a foreign glob site that may rebind every trusted macro for the whole crate, so each plain assert_eq! in that crate was reported "assertion not credited" (rust_assertion_context_unestablished). Such a glob can only import items the standard library defines. The scan now skips it unless a local module, extern-crate alias or `use .. as` takes the root name; globs from any other crate and every real definition or import stay ambiguous. Refs #8388 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Nf95NxBDVr2E4EGJVNg76T
|
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 34 minutes. View limit details
Comment |
There was a problem hiding this comment.
Confirmed findings
refusal_besidecollapsesfindreturning None into?, and the positive-credit loops assertNone == None, which masks a missing assertion row (harness did not index the test, or the cfg branch is off) the same as a genuine credit. Make the premise explicit:let refusal = refusal_beside(sibling); let refusal = refusal.unwrap_or_else(\|\| panic!("missing assertion row for {sibling}")); assert!(!rebound(refusal), "{sibling}");for the credited loop, and a symmetric explicit absence check for the refusal loop. (crates/ripr/src/analysis/classify/owner_pin/tests.rs:10556).
Verification questions
- Confirm pR body self-discloses: cargo xtask goldens check could not run offline and uniform_other.rs:318 test_char_bad_deser remains uncredited. Hosted CI is the proof; security impact is limited to misclassification, not an exploit primitive.
- Confirm new test couples 7 positive (credit) and 8 negative (refusal) cases through a shared closure
refusal_beside, but the closure yieldsOption<AssertionRefusal>; the loop usesassert_eq!(refusal_beside(sibling), None, ...)which will silentlyunwrap()a missing assertion row rather than failing with a useful message - the assertion-row index lookup may be flaky if the harness reorders. - Confirm hostile crate cannot spoof standard glob to bypass ambiguity: drop_in_shadowed already considers workspace packages, local modules, extern crate as, use .. as for these roots.
Refuted
- A sibling non-glob
use std::io::Writeoruse core::simd::Maskcould also withhold assert_eq! credit via macro_binding_ambiguities and the fix should broaden to those.; refuted because: ForeignGlob emission requiresitem.star_token().is_some(); named imports are not glob imports and do not introduce ambiguity for a macro name like assert_eq!. The narrow glob-only guard is the correct scope. - Standard-crate glob skip could break async/JS-backed worker handoff semantics in any downstream consumer.; refuted because: Diff is pure Rust static analysis; no JS/wasm/transferable boundary exists in ripr's changed surface, and ripr does not own any worker or transferable object. Lane focus is out of scope for this PR.
- Skipping the standard-root glob could cause a stale String in some cache keyed by the glob path, leaking into later probes and aliasing analysis.; refuted because: No shared cache keyed on the glob
pathis touched in the modified function; the skipped values never enterMacroBindingAmbiguity::ForeignGlob, and downstream code only consumes the enum variant, not the string contents. - Assigned focus (JS worker handoff / async / GC / detach / transfer) is out of scope: this PR is a Rust source-only change in ripr with markdown changelog; no JS, wasm-bindgen, postMessage, Worker, transferable, or detach surface is touched.
- Patch opens a denial-of-service via many
use core::*lines saturating the glob set in trusted_macro_scan; refuted because: Loop continues without inserting; ForeignGlob insertion only happens for non-skip globs, and standard-root globs are skipped entirely, reducing insertion volume rather than increasing it.
Evidence gaps
riprsensor failed with exit code 2 on this PR; cargo-test receipt is scheduled-late, not yet landed. PR body explicitly disclaimscargo xtask goldens checkoffline failure and full precommit not run. Hosted CI is the only witness for the goldens tightenings (rand 6->1, db14664 28->18).- Failed ripr sensor (exit code 2) plus cargo-test scheduled-late means this lane has no direct red/green witness for the new test; oracle strength claim is anchored to PR-body hosted CI assertion.
- Model proof intent was rejected by deterministic validation.
…or standard globs (#8388) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Nf95NxBDVr2E4EGJVNg76T
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
…st (#8388) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Nf95NxBDVr2E4EGJVNg76T
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
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.
Confirmed findings
rename.name()is called twice without caching; race-free but redundant AST walk duringExternCrate::castrename extraction in two functions. Not a correctness bug, just a style/cost note.
Verification questions
- Confirm
verified_rootroutesalloctounbound_standard_root, which is documented as having no manifest proof and can never return true; PR body and tests confirm this is intended (alloc globs remain foreign), but the dedupe/feedback loop withverifiedfor non-standard crates still relies on the verifier, not an unverified-floor. - Confirm schema bump to
1.44documents thatextern crate x as stdnow contributes binding candidates; the candidate-over-approximation invariant is preserved by widening viaMacroBindingCandidates::Anyinrenames_standard_crateand the newsource.contains("extern")gate. - Confirm fILE_FACT_CACHE_SCHEMA_VERSION bumped 1.43 -> 1.44 with a paired literal-assertion update in seam_cache.rs tests; no new fixture proves the wider binding candidates on a real foreign input.
- Confirm lane scope mismatch: ub-worker-handoff targets JS/async/GC/transfer boundaries; PR #8529 is a pure Rust static-analysis change in ripr with no JS, wasm, async runtime, or worker primitives touched. Lane has nothing to verify on its assigned axis.
- Confirm alloc has no manifest proof per unbound_standard_root; the new glob-skip branch's
&& drop_in_verified(root)clause keeps alloc globs foreign on purpose, but a sibling review should confirm there is no caller path that treatsverified_root(.., "alloc")as truthy by mistake. Checked verified_root routes alloc to unbound_standard_root which returns false on missing proof; no caller flips it. - Confirm new test
a_standard_crate_glob_does_not_rebind_the_standard_assertion_macroscouples credited and refused outcomes through a single closurerefusal_besidethat returns Option. The 5 positive-credit assertions useassert_eq!(refusal_beside(sibling), None, ...)and the 8 refusal cases useassert!(rebound(...)). A missing assertion row (harness/index drift, cfg-off) collapses to None for both, so None==None masks a missing test the same as a real credit. - Confirm integration test
unestablished_plain_assertion_names_its_macro_in_human_and_jsonswapsuse std::prelude::v1::*touse rayon::prelude::*to keep the foreign-glob premise intact after #8388. The asserted JSON field forassertion not credited: ripr could not establish that it runs as the standard macromust still match — this is a coupling between the human-readable name and the JSON key that the prior std-root glob satisfied coincidentally. After #8388, std-root globs credit assertions, so the rayon substitution is necessary, but the test now depends on rayon-style globs remaining foreign-globs; if a future change treats rayon globs as workspace-internal, this test will lose its premise.
Refuted
- The new test silently masks missing assertion rows in both credit and refusal loops; refuted because: The refusal loop uses assert!(rebound(refusal_beside(sibling))) where rebound requires Some(MacroBinding(_)); the premise check explicitly asserts the shadowing fixture refuses first, establishing the test is wired. Only the credit loop has the .find()? + assert_eq!(None) masking pattern, which is bounded to 5 siblings and is a polish concern, not a red/green blocker.
- reseeded-thread concern about refusal_beside collapsing None to a panic-style check is a test-closure issue (tester/oracle lane), not a memory-lifetime issue; closure returns Option by value, no lifetime/ownership concern introduced.
- ub-active-view invariants (resizable buffers, ArrayBuffer/TypedArray resize/detach/transfer, stale length snapshots) are not present in the diff, the seeded thread, or the PR body; the PR only changes static-analysis macro-binding classification for Rust source.
Evidence gaps
- Model proof intent was rejected by deterministic validation.
CI Failure DiagnosticInvestigation of run 39060091247 (job
|
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Nf95NxBDVr2E4EGJVNg76T
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
…ob foreign (#8388) Ports the shadow guard found on #8534; merges main. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V8TkpFLtrPCzSGaPzpf7c3
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
#8534 is closed in favour of this PR. An independent review of #8534 at 19213c5 found gaps in that PR's version of the guard. This PR already covers the Cargo rename, the cross-file extern crate alias, alloc and the cache bump. Please check the rest here:
Not verified by me: whether this PR's head already handles 1 and 3. Generated by Claude Code |
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V8TkpFLtrPCzSGaPzpf7c3
|
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.
Confirmed findings
- Lane scope mismatch: ub-active-view targets JS/async/GC/resizable-buffer/transfer boundaries; PR #8529 is a pure Rust static-analysis change in ripr with no JS, no ArrayBuffer/TypedArray, no resize/detach/transfer, no postMessage, and no buffer ownership transfer. The diff only narrows macro-binding ambiguity for std/core/alloc glob imports and bumps FILE_FACT_CACHE_SCHEMA_VERSION 1.43 -> 1.44. Active-view invariants are not engaged.
- Changelog file 'standard-crate-glob-assertion-credit.md' contains a truncated sentence mid-clause ('
use .. astakes') which reads as a grammar slip but is not a behavioral defect.
Verification questions
- Confirm renames_standard_crate walks the entire source file but only triggers when an ExternCrate item is present; cache schema 1.44 documents this widening but no negative test pins it on a real foreign input.
- Confirm sibling-path
use other::std::{self};+use std::*;was raised in the seeded thread as a #8534-vs-#8529 gap; #8529's new testplain_import_binding_the_std_root_keeps_the_glob_foreignexercisesuse other::std;(a single-segment path that binds thestdname), and the syntax owner_pin adds aroot_imported()gate that catchesuse crate::other::std;shape. Theuse other::std::{self}(use-tree list withselfleaf, no name_ref) shape is still not explicitly tested in this PR. - Confirm
macro_binding_ambiguitiesnow scansextern crate x as std\|core\|alloconly in the parse tree currently being visited. The LIB alias test ina_standard_crate_glob_does_not_rebind_...proves the behavior when LIB is one of the scanned trees, but production paths (e.g.scan_macro_sites,withheld_macro_bindings,read_macro_name_rebound) must guarantee the LIB tree is always passed. Add an invariant test that runs the full owner-pin pipeline on a workspace whose LIB has the alias and a sibling file with a std glob, asserting the refusal still fires. (crates/ripr/src/analysis/syntax/owner_pin.rs:647). - Confirm premise fixture uses
assert!(rebound(refusal_beside(shadowing))); the closure returns Option andreboundis Some(MacroBinding) only, so a None from a missing index also passes. Same pattern (assert_eq!(refusal_beside(sibling), None, ...)) covers missing rows as success. - Confirm
plain_import_binding_the_std_root_keeps_the_glob_foreignasserts body=assert!(matches!...) underuse other::std;+use std::prelude::v1::*;and expects refusal; only one positive credit shape and one refusal shape - covers edge (a) via use-tree-list, not the self-leafuse other::std::{self}shape flagged in the seeded thread. - Confirm root_imported() walks only the current parse tree, so the LIB
extern crate other as stdaliased_elsewhere test depends on LIB being visited by every call site that consults ambiguity.
Refuted
- with
verified_rootrouting std/core/alloc throughunbound_standard_root, every renamed-or-aliased std root will be caught by either (b)unbound_standard_rootor (c)renames_standard_crate; refuted because:renames_standard_crateonly triggers whensource.contains("extern")(newly added fast-bail at owner_pin.rs:583);Use::castforuse other::stdis handled byroot_imported, but amod core {}followed byuse core::*ismodnotexternand is caught bydrop_in_shadowedper the seeded tests; howeveruse other::std::{self}is missed byroot_imported(path is a list with self leaf, no name_ref on parent) and is not strangled byrenames_standard_crate, so the gate depends on a missing test fixture - the existing coverage is gap, not refuted. - Helper shape risk:
root_importedclosure inside macro_binding_ambiguities duplicates the conceptual structure ofrenames_standard_crateand should be lifted for symmetry and reuse.; refuted because: root_imported is used only inside the same function's glob loop; lifting it would add an indirection without removing duplication; current shape keeps the exemption self-contained at its only call site, which is appropriate smallest-complete-fix scope. - This PR may relax JS worker / transferable / async capture handling by widening binding candidates; refuted because: Lane scope mismatch: ub-worker-handoff targets JS/async/GC/transfer boundaries; PR #8529 is pure Rust static-analysis. diff flags confirm only Rust source/tests changed. The binding-candidate widening is a rust AST concept (MacroBindingCandidates::Any via renames_standard_crate) with no JS or worker surface.
Evidence gaps
- Model proof intent was rejected by deterministic validation.
…8388) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V8TkpFLtrPCzSGaPzpf7c3
…so its glob stays foreign (#8388) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Nf95NxBDVr2E4EGJVNg76T
There was a problem hiding this comment.
Confirmed findings
- crates/ripr/src/analysis/syntax/owner_pin.rs:552 — renames_standard_crate calls
rename.name()twice (one chained call site, one inside macro_binding_ambiguities' early-return gate); cache the text once to avoid redundant AST walks and to keep the over-approximation invariant documented alongside the schema bump. - crates/ripr/src/analysis/classify/owner_pin/tests.rs:10758 — Tighten the new test's fixture premise so a missing assertion row fails rather than passing the positive-credit loop: assert the shadowing premise, then unwrap_or_else(|| panic!("missing assertion row for {sibling}")) inside the loops, mirroring the explicit
?-as-panic pattern reviewers expect. The negative loop's explicit rebound assertion is already a premise; the positive loop lacks one. - Lane scope mismatch: ub-memory-lifetime targets native (unsafe, FFI, pointer, lifetime, ownership) seams. PR #8529 only modifies Rust static-analysis logic in
ripr(a build-time tool) and bumps a cache schema version 1.43 -> 1.44; no unsafe blocks, no FFI, no allocator or pointer manipulation, no async/buffer/transfer boundary is touched. Memory-lifetime review is not engaged. - STATIC_LIMITS.md and SPEC-0197/SPEC-0227/SPEC-0240 still describe the foreign-glob set without the new std/core exemption per seeded review comment 2026-10-18T04:49:15Z. Docs drift, not a security defect; risk is reviewer/maintainer misunderstanding future guard scope.
Verification questions
- Confirm seeded-thread item #2 (macro-generated shadowing via m!(std) expanding to mod std {} or extern crate other as std) is not addressed in the diff; PR intentionally documents this as an existing static limit and exemption leans on it. author self-discloses in comment 2026-10-18T04:49:15Z.
- Confirm the added integration tests in crates/ripr/src/analysis/classify/owner_pin/tests.rs pair a cfg-gated standard glob with a sibling file but none asserts the post-fix rand 94c9078 regression (
utils.rs:413and:432) becomes credited at the analysis-surface level; host CI is the proof per PR body. No source route to add here. - Confirm positive-credit loop in a_standard_crate_glob_does_not_rebind_the_standard_assertion_macros silently treats missing-assertion-row as credited via Option::None.
- Confirm crates/ripr/src/analysis/syntax/owner_pin.rs:904 —
root_importedonly inspects the FIRSTpathsegment of each non-glob UseTree (item.path().and_then(\|p\| p.segment())returnspath.segment()which foruse other::stdyieldsother, notstd). Verify: for single-segment paths likeuse other::std;,pathIS the fullother::std;segment()returns the LAST segmentstd. Confirm via test plain_import_binding_the_std_root_keeps_the_glob_foreign that already passed; this is a resolved concern, not a bug.
Refuted
- Lane scope mismatch: PR #8529 is Rust static-analysis only; no JS / ArrayBuffer / TypedArray / detach / transfer / postMessage surfaces are touched, so ub-active-view invariants are not engaged by this diff.
- PR #8529 narrows or widens a resizable-ArrayBuffer / TypedArray / detach / transfer / postMessage active-view invariant in ripr's analysis output.; refuted because: Diff only adjusts macro_binding_candidates and macro_binding_ambiguities over Rust source text and bumps FILE_FACT_CACHE_SCHEMA_VERSION 1.43 -> 1.44. No JS, no wasm-bindgen, no buffer ownership transfer, no active-view region vs whole backing store concept appears in any changed file. The active-view lane's invariants do not apply to a Rust static analyzer's binding candidate computation.
- PR #8529 introduces a worker/async/GC/transfer boundary that ub-worker-handoff must review (ArrayBuffer transfer, SharedArrayBuffer, resizable-buffer detach, postMessage, wasm-bindgen).; refuted because: Diff is purely Rust static-analysis under crates/ripr/: binding candidate over-approximation, std/core/alloc glob guard, schema bump 1.43->1.44, and macro_binding_ambiguities extras. No JS runtime, no wasm-bindgen, no async/await with cross-thread memory transfer, no GC-managed buffer lifecycle. Lane invariants are not engaged.
Evidence gaps
- Model proof intent was rejected by deterministic validation.
…onstructed field (#8389) (#8791) * fix(probes): a changed impl header no longer seeds a constructed-field probe (#8389) An impl header such as `impl Tr for K where Self: Sized {` was read as a field `name: Type` and reported as a no_static_path gap that does not exist. Adds grouped/nested std-root import controls from the #8529 post-merge review. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Nf95NxBDVr2E4EGJVNg76T * fix(probes): classify an impl header as static_unknown, not a constructed field (#8389) Reworks the first cut after review: skipping the header hid bound edits and left the closing brace of an empty impl probed. The lexical classifier now refuses the field-construction family for an impl header, so it stays one static_unknown probe. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Nf95NxBDVr2E4EGJVNg76T * test(probes): name the impl-header predicate test for what it checks and pin the lexical class (#8389) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Nf95NxBDVr2E4EGJVNg76T * fix(probes): impl headers with Fn bounds or trailing comments stay static_unknown (#8389) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Nf95NxBDVr2E4EGJVNg76T * fix(probes): impl header accepts tab after impl and array-type semicolons (#8389) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Nf95NxBDVr2E4EGJVNg76T * fix(probes): a one-line impl with a body after the brace is not a header (#8389) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Nf95NxBDVr2E4EGJVNg76T --------- Co-authored-by: Claude <noreply@anthropic.com>
Governing issue or accepted claim: #8388
Acceptance delta (one sentence): a glob import rooted at std, core or alloc no longer makes every plain assert_eq! in the crate "not credited" (part 1 of #8388).
Accepted winner and losing candidate disposition (when decided): #8529 wins, #8534 loses
Before: one
#[cfg(feature = "simd_support")] use core::simd::prelude::*;anywhere in a crate mademacro_binding_ambiguitiestreat the glob as a foreign glob that might rebindassert_eq!, so every plainassert_eq!in that crate was reportedassertion not credited: ripr could not establish that it runs as the standard macroand its probe dropped toobservation no / discriminator no. On rand 94c9078,src/distr/utils.rs:413and:432were hit.After: a glob rooted at
stdorcorecan only import standard-library items, whoseassert_eq!is the standard macro, so it is no longer a foreign glob. rand 94c9078: not-credited rows 6 -> 1, summary line unchanged (15 probes, same class counts); rand db14664: 28 -> 18; itertools, bytes, serde_json and anyhow outputs identical (measured before the review hardening below).How:
macro_binding_ambiguities(analysis/syntax/owner_pin.rs) skips a standard-root glob unless (a)drop_in_shadowedsays a local module,extern crate/use .. asalias or workspace package takes that name, (b) the Cargo manifests do not prove the root is the real std/core (unbound_standard_root, socore = { package = ".." }stays foreign;allochas no such proof and stays foreign), or (c) any scanned file hasextern crate x as std|core|alloc. Items (b) and (c) came from an independent exact-head review. The file-fact cache schema is bumped to 1.44 because the stored binding candidates widened. Fail-closed cases are tested: a siblingmacro_rules! assert_eqoruse other::assert_eq,rayon::prelude::*and other non-standard globs,mod core {}/extern crate other as std/use other as core, a Cargo rename, and a cross-fileextern cratealias.Not verified:
cargo xtask goldens checkcould not complete offline and the full precommit was not run, so hosted CI is the proof.uniform_other.rs:318 test_char_bad_deser(a serde-gated test) is still not credited and probably has a separate cause. #8534 implements the same guard without (b) and (c).Part 1 of #8388 only.
Generated by Claude Code