mirror of
https://github.com/colbymchenry/codegraph.git
synced 2026-10-24 06:53:52 +08:00
Ruby's other half of cross-file dependency (besides mixins) is `require` — but require imports created an import node that never resolved to the required file, so a file pulled in only by `require` (config-loaded components like Sidekiq's BasicFetch/systemd, or any gem that doesn't rely on autoloading) recorded no dependent. Mixins alone left Sidekiq at 76.8%. Emit an `imports` ref for `require "lib/foo"` (load-path — suffix-matched against the file path, the same mechanism template imports use) and `require_relative "../foo"` (resolved against the requiring file's directory). Bare gem/stdlib requires (`require "json"`, no slash) are skipped as external. The ref resolves to the required FILE node, so the requiring file → required file dependency is recorded even when the required file's class is reached only dynamically. Measured (fair cross-file dependent coverage, symbol-bearing source files): sidekiq 76.8% → 100.0%, rails/activerecord 93.0% → 96.8% (Rails autoloads but still has explicit requires for sub-components). Node count stable (the import nodes already existed; this only resolves them). Full suite green; Ruby-only. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>