Skip to content

fix(rust): eliminate call-graph ledger FPs/FNs (tuple structs, deep match tuples, param & turbofish macros) - #8794

Closed
squid-protocol wants to merge 1 commit into
mainfrom
fix/rust-call-graph-ledger
Closed

squid-protocol wants to merge 1 commit into
mainfrom
fix/rust-call-graph-ledger

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Summary

Consolidates all remaining actionable Rust call-graph comparison ledger fixes into a single PR:

  1. Nested tuple-struct declarations (rust/call/not-a-call-in-ts:struct_item<block, 3 FPs)
    • Blank \bstruct\s+(?P<pat>[^\W\d]\w*) in _blank_binding_patterns (gitgalaxy/standards/language_standards/languages/rust.py) so struct QueryDataA(Entity, &'static A);, struct Newtype(bool);, and struct Tuple(u32, bool); inside function bodies are not read as calls (C5).
  2. 4-level nested tuple match-arm patterns (rust/call/not-a-call-in-ts:tuple_struct_pattern<tuple_pattern, 2 FPs)
    • Widened bounded paren nesting in _ARM_PATTERN and _SELECT_ARM_PATTERN (rust.py) from 2 to 4 levels so arms like (Some((untagged_tokens, ())), Some((tag_tokens, _)), None) => (serde_internals_attr.rs:decide_tag / decide_identifier) are blanked as patterns (C3).
  3. Type-position macro invocations in fn parameter lists (rust/call/macro_invocation/identifier, 4 FNs)
    • Replaced _FN_PARAMS full-span blanking with _blank_fn_params (rust.py), preserving Token![,] / syn::Token![+] macro calls inside parameter lists while continuing to blank parameter patterns (Foo(a): Foo) and Fn(...) bounds.
  4. Macro invocations inside turbofish (rust/call/engine-attributes-to-another-function, 1 FN)
    • Switched CALLS_OUT_RUST's suffix (gitgalaxy/standards/language_standards/_shared_patterns.py) to a positive lookahead ((?=...)) so input.parse::<Token![+]>()?; (serde_internals_attr.rs:parse_lit_into_lifetimes) extracts both parse and Token.

(The remaining token_tree<macro_invocation / token_tree<token_tree cells are already validated as "GitGalaxy right" in the ledger because tree-sitter-rust leaves macro token trees opaque.)

Golden Crucible Updates

  • Updated tests/golden_master_audit and tests/golden_master_zero_dep_audit via crucible_check.py --update --yes reflecting the eliminated Rust FPs and recovered Token! macro calls.

Verification

  • Added tests/extraction/languages/test_calls_out_rust_ledger.py covering all four shapes plus ReDoS immunity on CALLS_OUT_RUST and _ARM_PATTERN.
  • Ran pytest tests/extraction/languages/test_calls_out_rust_*.py (301 passed), tests/extraction/languages/test_calls_out_rust_ledger.py tests/extraction/languages/test_rust*.py (124 passed), ruff format --check, tests/ruff_audit.py --ci, tests/doc_refs_audit.py --ci, and python tests/tools/call_graph_resolution.py rust --ci (passed: confident precision 98.3%, recall 81.5%, resolution recall 82.1%).

@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol

Copy link
Copy Markdown
Owner Author

Consolidated into #8795 (rebased cleanly onto main after #8632 merged) to avoid golden-crucible merge conflicts and save CI runs.

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.

1 participant