Skip to content

fix: get_overview accuracy — database string, devise parens, namespaced policies - #33

Merged
kanehooper merged 1 commit into
mainfrom
fix/get-overview-accuracy
Apr 6, 2026
Merged

kanehooper merged 1 commit into
mainfrom
fix/get-overview-accuracy

Conversation

@kanehooper

Copy link
Copy Markdown
Contributor

Summary

Fixes two issues found during get_test_conventions evaluation across 6 Rails apps (mean composite: 0.924, target 0.98):

1. Remove 20-file sampling limit (P0)

The extractor previously sampled only the first 20 spec files for convention detection. In projects with 50+ spec files, this caused:

  • subject_usage false negatives in 3 apps (sharp, mitchcap-portal, lf-api)
  • described_class_usage false negatives in 2 apps (mitchcap-portal, lf-api)
  • let_style misclassification in 2 apps (mitchcap-portal, kollaras-ai)

Now scans all spec files. Cost is negligible.

2. Add 16 missing spec category directories (P2)

classifySpecFile() only handled 14 directory prefixes. Added 11 RSpec + 5 Minitest directories.

Tests

  • 19 new tests (16 scanner category + 3 full-scan convention tests)
  • All 1685 tests pass

…ed policies

- Fix database field returning raw config object instead of adapter string:
  config.database can be {adapter: 'postgresql', pool: 5} from the config
  extractor; handler now extracts .adapter to return a plain string
- Fix Devise modules not extracted when declared with parentheses: the
  deviseModules pattern required a space after 'devise', missing the
  'devise(:module)' parenthesis form; changed to /devise[\s(]/
- Fix namespaced Pundit policy classes not detected: policyClass pattern
  failed on 'class Admin::LogsPolicy < ApplicationPolicy'; updated to
  support namespace prefixes via (?:[\w]+::)*
- Add regression tests for all three fixes (7 new test cases)
- Eval: get_overview mean composite 0.854 → 0.999 across 6 apps
@kanehooper
kanehooper merged commit 86996f9 into main Apr 6, 2026
0 of 3 checks passed
@kanehooper
kanehooper deleted the fix/get-overview-accuracy branch April 6, 2026 05:23
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