Skip to content

fix(engine): scope Ruby test globs to spec/ and test/ directories - #80

Merged
dejo1307 merged 1 commit into
mainfrom
fix/ruby-test-globs-directory-scoped
Jul 9, 2026
Merged

fix(engine): scope Ruby test globs to spec/ and test/ directories#80
dejo1307 merged 1 commit into
mainfrom
fix/ruby-test-globs-directory-scoped

Conversation

@dejo1307

@dejo1307 dejo1307 commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

**/*_spec.rb and **/*_test.rb sat in both config.Default().Ignore and .TestGlobs, matching on the basename alone. Any production file ending in the token _test or _spec -- an A/B-test job, a load-test harness -- was excluded from indexing AND routed to reference-only test-ref extraction, so the class it declared never became a symbol fact. The failure was silent and asymmetric: enola removed a right fact rather than adding a wrong one, so no downstream finding looked suspicious, and dead-code, impact and performance analysis were all quietly wrong for that file.

A file is now a Ruby test iff its basename ends _spec.rb/_test.rb AND some directory segment is exactly spec or test. No filename-only rule works: foo_test.rb (a test) and ab_test.rb (production) both end in the token test. Ruby settles it by convention -- RSpec requires spec/, Minitest defaults to test/.

Expressing that needed a pattern form the matcher lacked, so matchAnyGlob gained <prefix>/**/<fileglob> via matchDirScopedGlob. It fires only on a literal "/**/" in the pattern, which no shipped pattern contains, so existing globs are untouched. isIgnored was a token-identical copy of matchAnyGlob and now delegates to it -- one matcher is what keeps Ignore and TestGlobs from disagreeing about a file, which is the drift that caused this bug. Both lists change together: narrowing one alone leaves the file either still ignored or still misrouted.

Go and TypeScript keep their filename patterns; those languages genuinely co-locate tests. The bundled mcp-arch.yaml and examples/*.yaml ignore blocks are updated in step, since a YAML ignore: replaces the default wholesale and none of them declares test_globs:.

cacheVersion v96 -> v97: the file set reaching the extractor changes, so cached snapshots must re-extract.

`**/*_spec.rb` and `**/*_test.rb` sat in both config.Default().Ignore and
.TestGlobs, matching on the basename alone. Any production file ending in
the token `_test` or `_spec` -- an A/B-test job, a load-test harness -- was
excluded from indexing AND routed to reference-only test-ref extraction, so
the class it declared never became a symbol fact. The failure was silent and
asymmetric: enola removed a right fact rather than adding a wrong one, so no
downstream finding looked suspicious, and dead-code, impact and performance
analysis were all quietly wrong for that file.

A file is now a Ruby test iff its basename ends `_spec.rb`/`_test.rb` AND
some directory segment is exactly `spec` or `test`. No filename-only rule
works: `foo_test.rb` (a test) and `ab_test.rb` (production) both end in the
token `test`. Ruby settles it by convention -- RSpec requires spec/,
Minitest defaults to test/.

Expressing that needed a pattern form the matcher lacked, so matchAnyGlob
gained `<prefix>/**/<fileglob>` via matchDirScopedGlob. It fires only on a
literal "/**/" in the pattern, which no shipped pattern contains, so
existing globs are untouched. isIgnored was a token-identical copy of
matchAnyGlob and now delegates to it -- one matcher is what keeps Ignore and
TestGlobs from disagreeing about a file, which is the drift that caused this
bug. Both lists change together: narrowing one alone leaves the file either
still ignored or still misrouted.

Go and TypeScript keep their filename patterns; those languages genuinely
co-locate tests. The bundled mcp-arch.yaml and examples/*.yaml ignore blocks
are updated in step, since a YAML `ignore:` replaces the default wholesale
and none of them declares `test_globs:`.

cacheVersion v96 -> v97: the file set reaching the extractor changes, so
cached snapshots must re-extract.
@dejo1307
dejo1307 merged commit 508bb1b into main Jul 9, 2026
4 checks passed
@dejo1307
dejo1307 deleted the fix/ruby-test-globs-directory-scoped branch July 18, 2026 06:54
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