feat(plugins): Ruby language support (Rails-aware) + parser recursion hardening (v0.4.0) #2
No reviewers
Labels
No labels
Kind/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
h-dv/code-index!2
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/ruby-language"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds a sixth indexed language — Ruby — and closes a stack-overflow DoS that affected every language plugin. Reviewed ultradeep by a multi-agent pass (correctness/security/perf/test-coverage/parity/production) with adversarial verification; all confirmed findings addressed.
Ruby plugin (
crates/plugins/src/ruby.rs).rb/.rake/.gemspecand the extensionlessRakefile/Gemfile.A, B = …),attr_*fields (symbol & string forms),require/require_relativeimports, bare-call vs receivermethod_callrefs, mixininclude/extend/prependrefs.has_many/has_one/belongs_to/has_and_belongs_to_many→ TYPE ref to the model class, honoringclass_name:(string/symbol value; colon- and hashrocket-key forms; dynamic values suppress inference) and singularizing plurals via a corrected inflector + irregular table (people→Person,sizes→Size,houses→House, …).Security: parser recursion-depth guard (
common::MAX_PARSE_DEPTH)A crafted ~400 KB file of deeply nested literals (under the 2 MiB cap) parses to an AST deep enough to overflow the worker stack and SIGABRT the daemon — and
catch_unwindcan't intercept stack exhaustion, defeating the plugin sandbox. All six plugins'walk, Ruby's constant-chain recursion, and Rust's macro-token-tree recursion now bail past the cap. Confirmed by a 2 MiB-stack regression test on 20 000-deep input.Parity wiring
qualified_name_separator(::), project-root markers (Gemfile/*.gemspec), entry-point basenames (main.rb/config.ru/Rakefile), ctags ground-truth mapping, init template + extension allowlist, README (six languages + Rails note + matrix row).gap_fillpolyglot/empty-file tests now cover Ruby.Tests
25 Ruby unit tests; e2e (
e2e_ruby_project, find_references on class type, Rails association incl.belongs_tosingular path, method-vs-bare-call parity,qualified_name, resolution schema);correctness_ruby5-layer cross-validation; project-root marker tests. Full workspace suite green.Bumps workspace to 0.4.0 (new indexed language → minor).
🤖 Generated with Claude Code
Adds a sixth indexed language, Ruby, and closes a class of stack-overflow DoS across every language plugin. Ruby plugin (crates/plugins/src/ruby.rs): - Detects .rb / .rake / .gemspec and the extensionless Rakefile / Gemfile. - Extracts modules, classes (+ superclass TYPE refs), instance & singleton methods, top-level functions, constants (incl. parallel `A, B = ...`), attr_accessor/reader/writer fields (symbol & string forms), require/require_relative imports, bare-call vs receiver method_call refs, and mixin include/extend/prepend module refs. - Rails-aware: has_many/has_one/belongs_to/has_and_belongs_to_many emit a TYPE ref to the associated model class, honoring `class_name:` (string/symbol value, colon- and hashrocket-key forms; dynamic values suppress inference) and singularizing plural names via a corrected inflector + irregular-plural table (people→Person, sizes→Size, …). Wiring/parity: registered in all_plugins; qualified_name_separator ("::"); project-root markers (Gemfile / *.gemspec); entry-point basenames (main.rb / config.ru / Rakefile); ctags ground-truth mapping; init template + ground-truth extension allowlist; README (six languages + Rails note + matrix row). Cross-language gap_fill (polyglot, empty file) now covers Ruby. Security — parser recursion-depth guard (common::MAX_PARSE_DEPTH=512): A crafted ~400 KB file of deeply nested literals (well under the 2 MiB cap) parses to an AST deep enough to overflow the worker stack and SIGABRT the daemon — and catch_unwind cannot intercept stack exhaustion, defeating the plugin sandbox. Every plugin's walk (rust, python, typescript, csharp, php, ruby), Ruby's constant-chain recursion, and Rust's macro-token-tree recursion now bail past the depth cap. Confirmed via a 2 MiB-stack regression test on 20000-deep input. Tests: 25 Ruby unit tests; e2e (e2e_ruby_project, find_references on class type, Rails association incl. belongs_to singular path, method-vs-bare-call parity, qualified_name, resolution schema); correctness_ruby 5-layer cross-validation; project-root marker tests. Full workspace suite green (pre-existing Windows-only path_display test excepted — fails identically on v0.3.2, unrelated). Bumps workspace to 0.4.0 (new indexed language → minor). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>