Repository navigation
fix(merge): pair Ruby tests with production files by path - #699
Open
viktorianer wants to merge 1 commit into
Open
viktorianer wants to merge 1 commit into
viktorianer wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Since #689 the
tested_bylinker classifies Ruby test files, butproduction_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.rbandspec/<tail>/x_spec.rbtryapp/<tail>/x.rb, thenlib/<tail>/x.rb, then<tail>/x.rb, sotest/lib/foo_test.rbresolves tolib/foo.rb.test_x.rb(classic Minitest in gems) follows the same mapping.test/orspec/segment is kept, soengines/billing/spec/models/invoice_spec.rbresolves toengines/billing/app/models/invoice.rb.lib/parser_test.rb, tries its sibling only. Inside a test tree, the sibling is skipped, so a support file such astest/support/user.rbis never taken for production code.test_helper,spec_helperandrails_helperproduce no candidates. Otherwisetest_helper.rbwould pair with an unrelatedlib/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. Twolink_testscases 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/orlib/. The unpaired ones are mostly request and integration specs, which have no single production file.pnpm lintpnpm --filter @understand-anything/core test(run throughpnpm test)pnpm test, pluspython -m unittest tests.skill.understand.test_merge_batch_graphs tests.skill.understand.test_merge_subdomain_graphs tests.skill.knowledge.test_parse_knowledge_baseManual smoke test (described above)
Versioning
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