Skip to content

fix(merge): pair Ruby tests with production files by path - #699

Open
viktorianer wants to merge 1 commit into
Egonex-AI:mainfrom
viktorianer:fix/ruby-tested-by-path-pairing
Open

viktorianer wants to merge 1 commit into
Egonex-AI:mainfrom
viktorianer:fix/ruby-tested-by-path-pairing

Conversation

@viktorianer

Copy link
Copy Markdown

Summary

Since #689 the tested_by linker classifies Ruby test files, but production_candidates() has no Ruby branch. The path-convention pass therefore never pairs a Ruby test the analyzer did not link. This adds that branch for Rails and gem layouts.

  • test/<tail>/x_test.rb and spec/<tail>/x_spec.rb try app/<tail>/x.rb, then lib/<tail>/x.rb, then <tail>/x.rb, so test/lib/foo_test.rb resolves to lib/foo.rb.
  • test_x.rb (classic Minitest in gems) follows the same mapping.
  • A path prefix before the first test/ or spec/ segment is kept, so engines/billing/spec/models/invoice_spec.rb resolves to engines/billing/app/models/invoice.rb.
  • A test outside a test tree, for example lib/parser_test.rb, tries its sibling only. Inside a test tree, the sibling is skipped, so a support file such as test/support/user.rb is never taken for production code.
  • test_helper, spec_helper and rails_helper produce no candidates. Otherwise test_helper.rb would pair with an unrelated lib/helper.rb.

Linked issue(s)

Refs #646, #689

How I tested this

  • New unit tests cover the Rails Minitest, Rails RSpec, gem, test/lib, engine-prefix and sibling layouts, plus the helper and support-file exclusions. Two link_tests cases cover the end-to-end result. With the new branch reverted, 7 of them fail.

  • Ran the candidate function over the file list of a large private Rails application. 1,526 of 2,185 Ruby test files paired, and every pairing landed under app/ or lib/. The unpaired ones are mostly request and integration specs, which have no single production file.

  • pnpm lint

  • pnpm --filter @understand-anything/core test (run through pnpm test)

  • pnpm test, plus python -m unittest tests.skill.understand.test_merge_batch_graphs tests.skill.understand.test_merge_subdomain_graphs tests.skill.knowledge.test_parse_knowledge_base

  • Manual smoke test (described above)

Versioning

  • Version bumped in all five manifests, OR
  • N/A — internal/docs-only change

Bumped 2.9.7 → 2.9.8 in the six files listed in CLAUDE.md.

🤖 Generated with Claude Code

https://claude.ai/code/session_011d1u3dqu58uR21urdNqri9

The tested_by linker classifies Ruby test files since Egonex-AI#689, but its
path-convention fallback had no Ruby rule, so a test the analyzer did
not link stayed unpaired.

Map Rails and gem layouts onto their production counterparts:
test/<tail>/x_test.rb and spec/<tail>/x_spec.rb resolve to
app/<tail>/x.rb, lib/<tail>/x.rb and <tail>/x.rb, keeping any engine
prefix. A test outside a test tree tries its sibling only, and
test_helper, spec_helper and rails_helper produce no candidates, so
support files are never taken for production code.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011d1u3dqu58uR21urdNqri9

This branch has not been deployed

No deployments
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