Skip to content

fix(ruby): wire ruby into class_start named-entity extraction (#1295) - #1386

Merged
squid-protocol merged 2 commits into
mainfrom
fix/ruby-class-start-named-extraction-1295
Aug 12, 2026
Merged

squid-protocol merged 2 commits into
mainfrom
fix/ruby-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 ruby, per epic #1295. No language_standards.py regex change -- pure ground-truth fix.

Added module to NODE_MAPS["ruby"]["class_node_types"] (previously only class, singleton_class) -- module declarations are a real, cleanly-named tree-sitter node type (confirmed a name field resolving to a constant node) that ruby's own class_start regex already intentionally matches under its "Object / Entity Declarations" comment, but were invisible to real_classes here. Confirmed via rails' module ActionDispatch/module AbstractController/etc.

real_classes/found_classes 9→15, extra_classes 2→3 -- the 3 residual are all class << self singleton-class-reopening matches. Investigated whether to suppress these from named extraction via a change to the shared _resolve_class_start_match function (used by every allowlisted language, not just ruby) and decided against it: singleton_class genuinely has no name field of its own in the grammar (it wraps an expression, not an identifier -- confirmed via direct parse), so there's no real class name being missed, and touching shared per-match resolution code for one language's cosmetic wart wasn't worth the added risk surface. Documented as an accepted gap, same precedent as csharp/zig/rust.

Implemented via an independent Gemini/Antigravity delegation pass, then independently re-verified end to end (full diff re-read, accuracy audit, both crucible modes from a clean venv, full test suite) before this commit -- same discipline as the other 3 languages in this batch (#1295's haskell/c/dart PRs).

Verification

  • python tests/tools/tree_sitter_accuracy_audit.py --lang ruby --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 ruby --ci clean
  • crucible_check.py both modes clean
  • audit_check.py clean
  • Full core_engine/extraction suite passes

🤖 Generated with Claude Code

squid-protocol and others added 2 commits August 12, 2026 17:24
No language_standards.py regex change -- pure ground-truth fix. Added
"module" to NODE_MAPS["ruby"]["class_node_types"] (previously only "class",
"singleton_class") -- module declarations are a real, cleanly-named
tree-sitter node type (confirmed a "name" field resolving to a `constant`
node) that ruby's own class_start regex already intentionally matches under
its "Object / Entity Declarations" comment, but were invisible to
real_classes here (confirmed via rails' `module ActionDispatch`/
`module AbstractController`/etc.).

real_classes/found_classes 9->15, extra_classes 2->3 -- the 3 residual are
all `class << self` singleton-class-reopening matches. Investigated whether
to suppress these from named extraction via a change to the shared
_resolve_class_start_match function (used by every allowlisted language, not
just ruby) and decided against it: `singleton_class` genuinely has no "name"
field of its own in the grammar (it wraps an expression, not an identifier --
confirmed via direct parse), so there's no real class name being missed, and
touching shared per-match resolution code for one language's cosmetic wart
wasn't worth the added risk surface. Documented as an accepted gap, same
precedent as csharp/zig/rust.

crucible_check.py both modes clean, full core_engine/extraction suite passes
(6585 tests), audit_check.py clean.

Implemented via an independent Gemini/Antigravity delegation pass, then
independently re-verified end to end (full diff re-read, accuracy audit, both
crucible modes from a clean venv, full test suite) before this commit.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
…named-extraction-1295

# Conflicts:
#	tests/ruff_audit_baseline.json
@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 e011de7 into main Aug 12, 2026
30 checks passed
@squid-protocol
squid-protocol deleted the fix/ruby-class-start-named-extraction-1295 branch August 12, 2026 21:33
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