Skip to content

fix(perl): wire perl into class_start named-entity extraction (#1295) - #1393

Merged
squid-protocol merged 1 commit into
mainfrom
fix/perl-class-start-named-extraction-1295
Aug 12, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
fix/perl-class-start-named-extraction-1295

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Summary

Extends #1264's per-language class_start named-entity extraction to perl, per epic #1295. No language_standards.py regex change -- pure ground-truth fix, likely the last "quick" one in the epic.

Perl's own class_start regex already correctly matches package|class|role with a working capture group -- it was never the problem. NODE_MAPS["perl"]["class_node_types"] only targeted 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 across 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 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) models class_name/inheritance_parents/method_count/state_entanglement -- an OOP-class schema.
  • css's own class_start regex matches selectors (.foo, #bar) -- a different concept entirely, no methods/inheritance to speak of.
  • html's own class_start regex 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 generic element node isn't even the same target.

Populating class_data with CSS selectors or HTML elements would just be permanent method_count=0/inheritance_parents=[] noise, not a real data gain. Their class_start numeric 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_class has no real name to resolve.

Verification

  • python tests/tools/tree_sitter_accuracy_audit.py --lang perl --ci -- clean
  • python tests/tools/crucible_check.py -- both modes PASS
  • python tests/tools/audit_check.py --regenerate -- ruff findings were pure line-shifts
  • python -m pytest tests/core_engine/ tests/extraction/ -- 6585 passed, 2 skipped, 11 xfailed, 3 xpassed

Test plan

  • tree_sitter_accuracy_audit.py --lang perl --ci clean
  • crucible_check.py both modes clean
  • audit_check.py clean
  • Full core_engine/extraction suite passes

🤖 Generated with Claude Code

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]>
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol merged commit 6eb16c0 into main Aug 12, 2026
30 checks passed
@squid-protocol
squid-protocol deleted the fix/perl-class-start-named-extraction-1295 branch August 12, 2026 22:19
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