Skip to content

Detect explicit Rails association dependencies without booting Rails - #111

Open
TristanKruse wants to merge 1 commit into
mainfrom
feature/rails-associations-102
Open

TristanKruse wants to merge 1 commit into
mainfrom
feature/rails-associations-102

Conversation

@TristanKruse

Copy link
Copy Markdown
Collaborator

Closes #102.

What changed

  • CheckOptions.new(rails_associations: true) / --rails-associations detects explicit literal
    class_name on the four supported Active Record-style class-body macros. Existing imports,
    constant mode and --rails-imports remain unchanged by default.
  • Share the declaration index and evidence format. Association strings follow a bounded
    Rails model namespace lookup
    rather than Ruby lexical lookup. Root qualification, namespace conflicts and repeated evidence
    are tested. Merge one file edge while preserving its original import, constant and association evidence.
  • Record supported-site counts and separate unresolved/ambiguous counts only when enabled.
    New mode has a distinct cache and baseline scope; disabled fingerprints are unchanged.
  • No Rails runtime, source execution, target dependency installation, automatic inflection,
    polymorphic/through lookup, custom macro chains, or implied full Rails coverage.

Verification

  • Regression probes cover legacy modes, both opt-in combinations, all four macros, search order,
    missing/excluded/ambiguous definitions, unrelated receivers, mixed evidence, cache identity,
    baseline isolation and CLI parse errors. Package smoke verifies JSON/text and keeps existing Rails
    helper behavior intact without booting target code.
  • Oracle-checked five-pair local study, 2,000 sources: 1.614 → 1.860 s cold, 629,466 → 926,503
    allocated objects, ~0.50 MiB more retained Ruby heap when enabled. Detects all 1,000 intended
    new edges and warm snapshot reuse in both modes. Raw evidence in the study directory.
  • No publishing or version bump in this PR. Warn about imports-only blind spots in autoloaded Rails preset checks #109 (the imports-only advisory) remains separate.

@TristanKruse
TristanKruse marked this pull request as ready for review November 25, 2026 08:43

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.

Rails analysis: resolve explicit association class_name references without booting Rails

1 participant