Repository navigation
Fix #819: Extraction hardening for rust - #874
Merged
Merged
Conversation
Hardens all four extraction gauntlets for rust. This was a fresh sweep
(no pre-flagged known finding) and surfaced two real bugs:
- args' generic-parameter step-over was still the flat `<[^>]*>`, unlike
func_start's own two-level-nesting Rule-11 idiom fixed in an earlier
pass. Broke on any nested trait bound
(`fn foo<T: Into<String>>(x: T) {`, a realistic, common Rust pattern --
any generic function bounded by a From/Into conversion trait). Widened
to match func_start's already-proven idiom. A prior partial fix on one
rule doesn't mean sibling rules parsing the identical shape got it too.
- _dependency_capture's character class was missing `*`, so every glob
import (`use std::io::*;`, `use super::*;` -- extremely common, appears
in nearly every Rust test submodule and in re-export-heavy crates)
produced zero dependency-graph edges.
Verified via crucible_check.py: 4 real corpus files across rust/holylang
and rust/bevy gained newly-detected glob-import dependency edges (e.g.
one file's detected-dependency count jumped 1 -> 5, all confirmed genuine
`pub use x::*;` re-exports, not parsing artifacts). Confirmed no other
language/file affected. Golden masters re-blessed for this on-target,
expected change.
Also documents a known, unfixed limitation: func_start/_dependency_capture's
Mode-B string-shielding gap reproduces on Rust raw string literals
(`r#"..."#`) -- now confirmed on a FOURTH language/feature after js/ts
template literals, Java text blocks, and Go raw strings.
Migrates rust's test cases out of the four monolithic dict files into
tests/extraction/languages/test_rust.py, and updates the epic +
methodology doc with the new findings (recurring bug classes 18-20).
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Part of the extraction-hardening epic (#813). Closes #819.
Hardens all four extraction gauntlets (
func_start,args,class_start,_dependency_capture) for rust pertests/extraction/how_to_harden_extraction.md. This was a fresh sweep (no pre-flagged known bug) and surfaced two real bugs:args' generic-parameter step-over was still the flat<[^>]*>, unlikefunc_start's own two-level-nesting Rule-11 idiom fixed in an earlier pass. Broke on any nested trait bound (fn foo<T: Into<String>>(x: T) {, a realistic, common Rust pattern — any generic function bounded by aFrom/Intoconversion trait). Widened to matchfunc_start's already-proven idiom. A prior partial fix on one rule doesn't mean a sibling rule parsing the identical shape got it too._dependency_capture's character class was missing*, so every glob import (use std::io::*;,use super::*;— extremely common, appears in nearly every Rust test submodule and in re-export-heavy crates) produced zero dependency-graph edges.Also documents a known, unfixed architectural limitation (out of scope for a single-language pass, tracked in the epic):
func_start/_dependency_capture's Mode-B string-shielding gap reproduces on Rust raw string literals (r#"..."#, common for embedded SQL/regex/JSON) — now confirmed on a fourth language/feature after js/ts template literals (#815), Java text blocks (#816), and Go raw strings (#817).Differential Scan
Ran
python tests/tools/crucible_check.py: 4 real corpus files acrossrust/holylangandrust/bevygained newly-detected glob-import dependency edges (e.g. one file's detected-dependency count jumped 1 → 5). Manually confirmed every new edge is a genuinepub use x::*;/use x::*;re-export in the source, not a parsing artifact, and confirmed no other language/file is affected anywhere in the ~80-repo corpus. Golden masters re-blessed for this on-target, expected change viacrucible_check.py --update --yes.Test plan
pytest tests/extraction/languages/test_rust.py(51 new tests) — run via barepytestfrom an unrelated CWD to reproduce CI's invocation stylepytest tests/core_engine/ tests/extraction/ -q— 3503 passed, 1 known pre-existing tiktoken-environment failure, 1 xfailedpython tests/tools/audit_check.py— clean (only the pre-existing, already-trackedguidestar_lens.pymypy findings, unrelated to this change)python tests/tools/crucible_check.py— PASS on both venvs after re-blessingtests/extraction/languages/test_rust.py🤖 Generated with Claude Code