Repository navigation
fix(perl): wire perl into class_start named-entity extraction (#1295) - #1393
Merged
Merged
Conversation
No language_standards.py regex change -- pure ground-truth fix, the last
"quick" one in the epic. Perl's own class_start regex already correctly
matches package|class|role with a working capture group; the problem was
NODE_MAPS["perl"]["class_node_types"] only targeting class_statement
(Perl 5.38+'s brand-new `class Foo {...}` syntax), which real-world corpus
code (bugzilla, exiftool) essentially never uses -- the traditional
`package Foo::Bar;` idiom is Perl's dominant OOP/namespace mechanism and was
completely invisible to real_classes (real_classes=0 pre-fix despite 20 real
package declarations in the corpus).
Added package_statement to NODE_MAPS["perl"]. Its "name" field resolves
directly via the existing fast path (e.g. "Image::ExifTool") -- no custom
_get_node_name branch needed.
real_classes/found_classes 0->20, extra_classes 0 throughout -- a perfect
match. Flipped into the allowlist.
Also formally closes the epic's two remaining open questions in the
checklist doc: css and html are decided permanently out of scope for named
extraction (real category mismatch -- class_data's schema is
name/inheritance_parents/method_count/state_entanglement, an OOP-class
shape that CSS selectors and generic HTML elements don't fit; their
class_start numeric signal, a different consumer, is unaffected). Also fixes
a duplicate "dart" table row left over from an earlier merge-conflict
resolution.
11 of 13 languages in this epic now done; css/html closed by design, not
pending. One small optional follow-up noted (ruby's singleton_class has no
real name to resolve -- documented, not urgent).
crucible_check.py both modes clean, full core_engine/extraction suite passes
(6585 tests), audit_check.py clean.
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
Extends #1264's per-language
class_startnamed-entity extraction to perl, per epic #1295. Nolanguage_standards.pyregex change -- pure ground-truth fix, likely the last "quick" one in the epic.Perl's own
class_startregex already correctly matchespackage|class|rolewith a working capture group -- it was never the problem.NODE_MAPS["perl"]["class_node_types"]only targetedclass_statement(Perl 5.38+'s brand-newclass Foo {...}syntax), which real-world corpus code (bugzilla, exiftool) essentially never uses -- the traditionalpackage Foo::Bar;idiom is Perl's dominant OOP/namespace mechanism and was completely invisible toreal_classes(real_classes=0pre-fix, despite 20 real package declarations across the corpus).Added
package_statementtoNODE_MAPS["perl"]. Itsnamefield resolves directly via the existing fast path (e.g.Image::ExifTool) -- no custom_get_node_namebranch needed.real_classes/found_classes0→20,extra_classes0 throughout -- a perfect match. Flipped into the allowlist.Also in this PR: formally closing css and html as out of scope
The epic's checklist doc had css and html flagged from the start as needing a judgment call ("is this even a class") rather than a quick fix. Investigated properly rather than leaving it open indefinitely:
class_data(the table this epic populates) modelsclass_name/inheritance_parents/method_count/state_entanglement-- an OOP-class schema.class_startregex matches selectors (.foo,#bar) -- a different concept entirely, no methods/inheritance to speak of.class_startregex matches a curated risk-relevant tag list (form,table,svg, custom elements) -- chosen as complexity/attack-surface signals, not because they're class-like; tree-sitter's genericelementnode isn't even the same target.Populating
class_datawith CSS selectors or HTML elements would just be permanentmethod_count=0/inheritance_parents=[]noise, not a real data gain. Theirclass_startnumeric signal (a different consumer, used in risk-scoring equations) is completely unaffected by this decision. Decision: css and html are permanently out of scope for named extraction -- documented in the checklist doc so this doesn't get re-litigated cold later.Also fixes a duplicate "dart" row in the checklist doc's Done table, left over from an earlier merge-conflict resolution in this epic's batch.
11 of 13 languages now done. css/html closed by design (not pending). One small optional follow-up remains, documented not urgent: ruby's
singleton_classhas no real name to resolve.Verification
python tests/tools/tree_sitter_accuracy_audit.py --lang perl --ci-- cleanpython tests/tools/crucible_check.py-- both modes PASSpython tests/tools/audit_check.py --regenerate-- ruff findings were pure line-shiftspython -m pytest tests/core_engine/ tests/extraction/-- 6585 passed, 2 skipped, 11 xfailed, 3 xpassedTest plan
tree_sitter_accuracy_audit.py --lang perl --cicleancrucible_check.pyboth modes cleanaudit_check.pycleancore_engine/extractionsuite passes🤖 Generated with Claude Code