Skip to content

Resolve constant-reference dependencies and safely inferred import paths - #56

Open
TristanKruse wants to merge 6 commits into
fix/definition-of-done-blockersfrom
fix/issues-54-55-extraction
Open

TristanKruse wants to merge 6 commits into
fix/definition-of-done-blockersfrom
fix/issues-54-55-extraction

Conversation

@TristanKruse

@TristanKruse TristanKruse commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

Autoloaded code such as Retrieval::Store.new and imports such as path = '../retrieval/store'; require_relative path previously contributed no architecture dependency. Both issue reproducers now produce the expected single forbidden file dependency without executing application code.

  • Add opt-in CheckOptions.new(dependency_analysis: :imports_and_constants) with a bounded Prism definition/reference index. Import-only analysis remains the default. Lexical nesting, compact/root-qualified namespaces, namespace shadowing, and explicit superclass/mixin references are covered; ambiguous reopenings and unsupported lookup stay unresolved.
  • Infer literal local strings across the four supported import forms, with conservative invalidation for reassignment, aliases, mutation/escape, closures, reflection, and unsupported control flow.
  • In expanded mode, merge import and constant support into one edge while preserving names and source spans. JSON exports retain evidence; file/layer/slice/cycle/diagram rules and coupling metrics consume the same graph. Import-only edges keep empty evidence for compatibility with existing edge-value comparisons, including the RAG fixture. Analysis mode participates in cache identity.
  • Document the bounded contract and Prism/RubyDEX design choice. Extend the benchmark and CI with constant-index performance and installed-gem regression checks.

This PR is based on fix/definition-of-done-blockers (#51), keeping the extraction diff separate from its documentation/quality prerequisites. Review and merge #51 first, then retarget this PR to main if GitHub has not done so automatically. The overlapping changelog, CheckOptions, and metric-documentation edits have already been resolved together. Both PRs include the merged documentation and debug-inspection changes (#52 and #53); no gem release is triggered.

The combined branch passes 499 examples with zero failures on Ruby 4.0.6 / Windows x64, with 98.98% line and 90.94% branch coverage. RuboCop checks 248 files with no offenses, 176 generated documentation pages and their links validate, and the strict 0.0.2 gem build plus installed-gem reproducers pass. One existing symlink example is skipped because this Windows account cannot create symlinks. The GitHub matrix additionally verifies Ruby 3.3/3.4 on Ubuntu and 4.0 on Windows, plus the RAG fixture and installed-gem reproducers.

Three fresh-process 1,000-file benchmark runs per mode: median cold graph build 1.706 s import-only vs 1.533 s expanded; median constant indexing 32.0 ms. Filesystem/run-order noise prevents interpreting the total-time difference as a speedup. All warm checks reuse the graph. Memory samples and their GC-related limits are recorded in benchmark/README.md.

Closes #54
Closes #55

Add opt-in Prism constant indexing, conservative local-string flow tracking, and source evidence merged through graph reports. Exercise both issue reproducers through public APIs and installed gems, document bounded lookup behavior, and profile cold/warm extraction. Addresses #54 and #55.
@TristanKruse
TristanKruse changed the base branch from main to fix/definition-of-done-blockers October 16, 2026 17:05

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

1 participant