Repository navigation
Fix #821: Extraction hardening for cpp - #882
Merged
Merged
Conversation
Hardens all four extraction gauntlets for cpp. This was a fresh sweep (no pre-flagged known finding) and surfaced two real bugs: - func_start/args had zero allowance for a class-qualifier before the `operator` keyword, so out-of-line operator overload definitions (`TargetClass::operator=(...)`, `TargetClass::operator==(...)`, declared in a header and defined in a .cpp file, mainstream C++) were completely invisible -- even though bare (non-qualified) `operator=(...)` already worked. Distinct failure mode from the Rule-11 nesting bug already fixed elsewhere in this epic: the operator alternative simply never had the qualifier-prefix group the plain-identifier alternative already had. - args also needed the established nested-template step-over for the method's own template arguments (`Foo::Bar<Baz<int>>(...)`, an explicit template specialization), matching the Rule 11 idiom already proven in func_start. Verified via crucible_check.py: 7 real files across 4 repos (mlir, NVDA, powertoys, godot) gained newly-detected operator functions and/or parameter counts. NVDA's storage.cpp function count jumped 10 -> 13 for its 3 out-of-line comparison operators; powertoys' centralized_kb_hook.cpp already detected `operator<` but previously reported 0 parameters, now correctly reports 3. A structural JSON diff (not a textual git-diff grep, which produced false "other language" hits from unrelated dependency-list values) was needed to correctly confirm confinement to cpp -- see the epic for the full lesson. Also documents a known, unfixed limitation: func_start's Mode-B string-shielding gap reproduces on C++ raw string literals (R"(...)") -- now confirmed on a SIXTH language. class_start's lack of a base-clause capture group was confirmed to be cpp's original, deliberate design (one capture group only), not a regression of the java/python/csharp bug. Migrates cpp's test cases out of the four monolithic dict files into tests/extraction/languages/test_cpp.py, and updates the epic + methodology doc with the new findings (recurring bug classes 24-25). 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 #821.
Hardens all four extraction gauntlets (
func_start,args,class_start,_dependency_capture) for cpp pertests/extraction/how_to_harden_extraction.md. This was a fresh sweep (no pre-flagged known bug) and surfaced two real bugs:func_start/argshad zero allowance for a class-qualifier before theoperatorkeyword, so out-of-line operator overload definitions (TargetClass::operator=(...),TargetClass::operator==(...), declared in a header and defined in a.cppfile, mainstream C++) were completely invisible — even though bare (non-qualified)operator=(...)already worked. This is a distinct failure mode from the Rule-11 nesting bug already fixed elsewhere in this epic: the operator alternative simply never had the qualifier-prefix group the plain-identifier alternative already had.argsalso needed the established nested-template step-over for the method's own template arguments (Foo::Bar<Baz<int>>(...), an explicit template specialization), matching the Rule 11 idiom already proven infunc_start.Also documents a known, unfixed architectural limitation (out of scope for a single-language pass, tracked in the epic):
func_start's Mode-B string-shielding gap reproduces on C++ raw string literals (R"(...)") — now confirmed on a sixth language.class_start's lack of a base-clause capture group was confirmed to be cpp's original, deliberate design (one capture group only, unlike java/python/csharp) — not a regression.Differential Scan
Ran
python tests/tools/crucible_check.py: 7 real files across 4 repos (mlir, NVDA, powertoys, godot) gained newly-detected operator functions and/or parameter counts. NVDA'sstorage.cppfunction count jumped 10 → 13 for its 3 out-of-line comparison operators; powertoys'centralized_kb_hook.cppalready detectedoperator<but previously reported 0 parameters, now correctly reports 3.Note on verifying confinement: a naive textual
git diff | grepon the update produced dozens of false "other language" hits (.zig,.pm, unrelated.hpaths) — these turned out to be pre-existing dependency-list values sitting inside other files' JSON entries, not actually-changed entries. Re-verified with a proper structural diff (loading pre/post JSON and comparing only the"6. Parsed Files (Scanned Artifacts)" -> "<repo>" -> "Files"keys), which correctly confirmed all 7 changed files are cpp. Documented as a new methodology lesson (recurring bug class 25) so this doesn't cost time again on a future language.Test plan
pytest tests/extraction/languages/test_cpp.py(42 new tests) — run via barepytestfrom an unrelated CWD to reproduce CI's invocation stylepytest tests/core_engine/ tests/extraction/ -q— 3606 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_cpp.py🤖 Generated with Claude Code