Skip to content

fix: preserve runtime module dependency safety - #32

Merged
adityankale190895 merged 1 commit into
DiffCI:mainfrom
FredApps:fix/runtime-module-safety
Oct 22, 2026
Merged

adityankale190895 merged 1 commit into
DiffCI:mainfrom
FredApps:fix/runtime-module-safety

Conversation

@FredApps

Copy link
Copy Markdown
Contributor

Summary

Prevent a missing runtime dependency edge from becoming an empty successful selective plan.

  • Record computed import(...) and require(...) arguments as unresolved runtime dependencies instead of external package names or omitted references.
  • Keep unresolved runtime dependencies globally unsafe during delta-confidence refinement. Missing edges cannot establish that an importer is unrelated to a changed target.
  • Resolve no-substitution template literals and TypeScript external-module import = require(...) declarations, including type-only declarations.
  • Invalidate schema-2 persisted graphs, including cache callers that omit an engine version.

Reproduction and tests

Synthetic repositories contain a changed module, a loader, an importing test, and an unrelated test. Before the fix, variable/conditional imports and computed require calls return COMPLETE with no selected tests. Interpolated imports return UNSAFE initially, then refinement incorrectly returns COMPLETE for a changed possible target. Import-equals declarations omit their dependency edge.

Nine module-reference regressions fail against the original code and pass with the fix. A separate warm-cache regression fails before the schema bump and passes afterward.

Validated on Node v24.19.0, Linux, from baseline 9d575cef7b1dd118300cd6298c9f85a8c1a44ad8:

  • npm ci --ignore-scripts --cache /tmp/diffci-npm-cache
  • npm run typecheck
  • npm run build
  • npm run audit:boundary
  • node --import tsx --test --test-concurrency=1 $(find tests -name '*.test.ts' | sort) — 343/343 passed
  • git diff --check

The unmodified baseline passes 333/333 tests serially. Its default parallel npm test run lost two suite processes in this environment without assertion details, so the full suite was validated serially. Windows and Node 22 execution remain for CI.

Scope and cache coordination

Computed module expressions intentionally require full validation; this does not evaluate expressions or model arbitrary custom loaders. Commands remain advisory.

Other independent safety PRs from this review also change graph construction and bump cache schema 2 to 3. If merged/released separately, advance the schema again (or otherwise invalidate intermediate-version graphs) for each subsequent analysis change. Do not retain warmed graphs from an earlier subset of the fixes.

@adityankale190895

Copy link
Copy Markdown
Member

Hi @FredApps, we're relicensing DiffCI Core from AGPL-3.0-only to MIT and need your consent for this contribution. Details and the one-line consent reply are in #43. Thank you!

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.

2 participants