feat: truthful module/import facts across builtin and runtime plugins #31

Open
opened 2026-07-20 22:38:52 +02:00 by buildagent · 1 comment
Member

Narrowed scope

The previous issue combined import completeness, unused-import analysis, git churn and stats history. They do not form one deliverable.

This issue now owns only extraction/schema work needed to make the module/import graph truthful across builtin and runtime plugins.

Stats/history measurement belongs to #45/#53. Churn/placement belongs, if justified by task benchmarks, in #35. Repository-wide unused-import productization is deferred until its false-positive classes have a separate user case.

Gaps

Module declarations

Capture graph-forming declarations currently absent or incomplete:

  • Rust mod x;
  • PHP require/include variants;
  • Ruby require/require_relative;
  • CommonJS/other profile-declared module constructs where not already covered.

Distinguish declaration/import/module-load classes. An import row is evidence, not automatically a symbol dependency edge.

Per-binding imports

Represent grouped imports as independent bindings while retaining their shared source span:

  • use a::{B, C};
  • aliased/grouped variants in supported languages;
  • wildcard/glob imports as a distinct unresolved binding class.

This supports accurate reachability and per-binding provenance without pretending a module row is one edit site.

Runtime-plugin ABI

#76 import facts must support:

  • source language/component/generation;
  • structured module segments;
  • individual bindings and aliases;
  • import class;
  • shared declaration identity/span;
  • embedded-region source mapping.

Language profiles select bounded normalization algorithms. Plugins cannot emit resolved target ids or custom import SQL.

Mixed-language files

Wrapper and embedded host components may both emit imports. Removal/rollback deletes only the relevant contribution. files.lang cannot determine import language.

Correctness constraints

  • Upgrade/fresh/cold/activated indexes are equivalent.
  • Existing target projection does not change unintentionally.
  • Import extraction changes re-run resolver scopes through #78 generations.
  • get_dependencies exposes truncation/count/provenance honestly.
  • No import is silently treated as an edit/reference edge; I056 semantics remain.
  • Package capability filtering applies before imports contribute reachability/file keys.
  • #65/#53 work budgets include any larger reachability populations.

Tests

  • one positive and one decoy per language/profile;
  • grouped import emits exact independent bindings;
  • wildcard stays explicitly non-specific;
  • module declaration affects get_dependencies as intended;
  • no phantom symbol edge from import-only evidence;
  • mixed-language wrapper contributions;
  • package disable/rollback;
  • cold==incremental==activated;
  • old client/daemon import fact normalization.

Acceptance

  1. Supported module declarations appear in get_dependencies with correct class/provenance.
  2. Grouped imports are independently analyzable without duplicating source edits.
  3. Runtime packages use the same validated import fact model.
  4. Reachability changes are capability-gated and zero-phantom.
  5. All extraction paths converge across cold, watcher and plugin activation.
  6. The unrelated churn/stats/unused-import ideas no longer expand this issue.
## Narrowed scope The previous issue combined import completeness, unused-import analysis, git churn and stats history. They do not form one deliverable. This issue now owns only extraction/schema work needed to make the module/import graph truthful across builtin and runtime plugins. Stats/history measurement belongs to #45/#53. Churn/placement belongs, if justified by task benchmarks, in #35. Repository-wide unused-import productization is deferred until its false-positive classes have a separate user case. ## Gaps ### Module declarations Capture graph-forming declarations currently absent or incomplete: - Rust mod x; - PHP require/include variants; - Ruby require/require_relative; - CommonJS/other profile-declared module constructs where not already covered. Distinguish declaration/import/module-load classes. An import row is evidence, not automatically a symbol dependency edge. ### Per-binding imports Represent grouped imports as independent bindings while retaining their shared source span: - use a::{B, C}; - aliased/grouped variants in supported languages; - wildcard/glob imports as a distinct unresolved binding class. This supports accurate reachability and per-binding provenance without pretending a module row is one edit site. ### Runtime-plugin ABI #76 import facts must support: - source language/component/generation; - structured module segments; - individual bindings and aliases; - import class; - shared declaration identity/span; - embedded-region source mapping. Language profiles select bounded normalization algorithms. Plugins cannot emit resolved target ids or custom import SQL. ### Mixed-language files Wrapper and embedded host components may both emit imports. Removal/rollback deletes only the relevant contribution. files.lang cannot determine import language. ## Correctness constraints - Upgrade/fresh/cold/activated indexes are equivalent. - Existing target projection does not change unintentionally. - Import extraction changes re-run resolver scopes through #78 generations. - get_dependencies exposes truncation/count/provenance honestly. - No import is silently treated as an edit/reference edge; I056 semantics remain. - Package capability filtering applies before imports contribute reachability/file keys. - #65/#53 work budgets include any larger reachability populations. ## Tests - one positive and one decoy per language/profile; - grouped import emits exact independent bindings; - wildcard stays explicitly non-specific; - module declaration affects get_dependencies as intended; - no phantom symbol edge from import-only evidence; - mixed-language wrapper contributions; - package disable/rollback; - cold==incremental==activated; - old client/daemon import fact normalization. ## Acceptance 1. Supported module declarations appear in get_dependencies with correct class/provenance. 2. Grouped imports are independently analyzable without duplicating source edits. 3. Runtime packages use the same validated import fact model. 4. Reachability changes are capability-gated and zero-phantom. 5. All extraction paths converge across cold, watcher and plugin activation. 6. The unrelated churn/stats/unused-import ideas no longer expand this issue.
Author
Member

Triage: P1 for graph correctness; split before implementation

This issue combines four unrelated data investments. Recommended split:

  1. P1: import/module-edge completeness — mod, require, require_relative, and per-binding imports. This directly improves graph truth, context selection, impact, cycles, and orphan analysis.
  2. P2: stats history — resolver regression measurement and release validation.
  3. P3: churn/hotspot evidence — optional ranking input, query-time first.
  4. Defer unused-import productization until false-positive classes are controlled; compilers already cover part of this space.

Implement the import work before adding more graph-derived conclusions. Each extraction change needs upgrade/fresh-index equivalence and before/after resolution precision measurements.

### Triage: P1 for graph correctness; split before implementation This issue combines four unrelated data investments. Recommended split: 1. **P1: import/module-edge completeness** — `mod`, `require`, `require_relative`, and per-binding imports. This directly improves graph truth, context selection, impact, cycles, and orphan analysis. 2. **P2: stats history** — resolver regression measurement and release validation. 3. **P3: churn/hotspot evidence** — optional ranking input, query-time first. 4. **Defer unused-import productization** until false-positive classes are controlled; compilers already cover part of this space. Implement the import work before adding more graph-derived conclusions. Each extraction change needs upgrade/fresh-index equivalence and before/after resolution precision measurements.
buildagent changed title from feat: new-data prerequisites — mod-declaration imports, per-binding import split, churn, stats history to feat: truthful module/import facts across builtin and runtime plugins 2026-08-26 13:41:38 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
h-dv/code-index#31
No description provided.