Skip to content

fix(lang-ts): select package export conditions per import - #770

Merged
avidianity merged 7 commits into
mainfrom
fix/issue-759
Dec 2, 2026
Merged

avidianity merged 7 commits into
mainfrom
fix/issue-759

Conversation

@avidianity

@avidianity avidianity commented Dec 2, 2026 •

Copy link
Copy Markdown
Owner

Summary

TypeScript and JavaScript resolve package exports using the kind of each runtime import.
Language and Metric plugins can use the 0.6.0 interface.
The host continues to load 0.5.0 plugins.

Closes #759

Tier

Tier 3 from cargo xtask risk-tier --base origin/main.
The change touches Plugin host and SDK paths and updates assertions for the new interface.

Task

Issue #759

  • Keep each runtime import's kind through lowering and resolution.
  • Resolve static imports, dynamic imports, and CommonJS calls to the corresponding package targets.
  • Load 0.5.0 Language and Metric plugins and document migration to 0.6.0.

Fail-first test

  • Test name is trace_selects_package_exports_by_runtime_import_kind.
  • On 2910ef78, one test ran and failed with main.mjs to packages/dual/e.mjs, left: Bool(false), right: true.
  • On 016887b0, the same test ran once and passed.
  • The test checks both expected targets and excludes the opposite target in files using only one import kind.

Checks

  • The CLI regression and TypeScript import-forms conformance test each ran once and passed.
  • The 0.5.0 Language and Metric compatibility tests and the 0.6.0 contract test each ran once and passed.
  • Three sandbox rejection tests ran and passed.
  • Pre-commit and commit-message hooks passed.
  • cargo xtask merged-result and target/debug/codeint check passed.
  • Both older-plugin rebuild-remedy tests and three Python tests ran and passed after merging main.
  • The fixture cache-key regression ran once and passed after both CI cache keys were updated.
  • All six required checks passed on this revision. CI run

Safety proof

Existing components keep their 0.5.0 wire format and run in the same sandbox.
The 0.5.0 Language fixture returns an import edge with Unknown and exercises resolution and scope analysis.
The 0.5.0 Metric fixture measures the resolved imports supplied by a 0.6.0 Language plugin.
Three sandbox tests still reject components that request filesystem, clock, or socket capabilities.
Four adversarial reviewers exercised 67 CLI trace assertions and 14 host integration cases with no verified findings.
An Independent reviewer verified both legacy interfaces and the exact fail-first trace result on the earlier revision.
Independent verification passed on 4efb85ee, including both legacy interfaces, sandbox rejection, and the Python regression.
Independent reviewers verified the cache-key change and the final merge separately, and reran both named regressions on 016887b0.

Runtime evidence

PASS on 016887b0.
The regression creates a tracked repository containing both export orderings.
It checks six actual codeint trace calls, including two targets reached from one specifier used by both import() and require().
The test removes its temporary repository on exit.

An unchanged-source comparison identified three Metrics for the combined version update.

  • Import cycles fell from two modules in a false cycle to zero because the ESM edge selects the ESM target.
  • Import boundaries changed the Finding ID because the forbidden edge names e.mjs instead of c.cjs.
  • Orphan files changed the Finding ID because a package import now reaches right.mjs instead of wrong.cjs.

Gaps

The batch follow-up owns Metric version increments.
The final review confirmed that the last merge added only the current main changes.

Carry import kind through the 0.6.0 Plugin interface and keep 0.5.0 components loadable. Use the matching package condition for each TypeScript and JavaScript runtime import.

Closes #759
@avidianity
avidianity added this pull request to stack #772 December 2, 2026 15:57
@avidianity avidianity closed this Dec 2, 2026
@avidianity avidianity reopened this Dec 2, 2026
@avidianity avidianity closed this Dec 2, 2026
@avidianity avidianity reopened this Dec 2, 2026
@github-actions github-actions Bot added the tier-3 Tier 3 from the tier check label Dec 2, 2026
@avidianity
avidianity merged commit 88bd9de into main Dec 2, 2026
33 of 37 checks passed
@avidianity
avidianity deleted the fix/issue-759 branch December 2, 2026 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tier-3 Tier 3 from the tier check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ESM imports resolve to a package's CommonJS file

1 participant