Context
Leaf of #20667: an emitted workspace and a statically imported package class must use the same Engine module graph.
At Engine 1b12232214a5b36bec6ca0255c2b93b5ef51e3ed, a bounded Node artifact probe using the actual ESM rewrite, template-processing and minification stages reaches two CoreBase module URLs:
- the emitted workspace class reaches
/dist/esm/src/core/Base.mjs;
- its statically imported installed package class reaches
/node_modules/neo.mjs/src/core/Base.mjs.
This is artifact-path evidence. No full application build or browser execution is claimed. The existing browser negative control already demonstrates that a page can mount despite a split Engine graph, so mount success is not an adequate identity oracle.
The Problem
The workspace manifest names neo.mjs and @fixture/widgets as dependencies. The package uses ordinary static imports; no Main-addon or runtime-worker opt-in is involved. A minimal generic reproduction has this installed class:
import Base from '../../../neo.mjs/src/core/Base.mjs';
export default class Widget extends Base {}The workspace imports both the Engine and that package statically:
import Base from '../../../node_modules/neo.mjs/src/core/Base.mjs';
import Widget from '../../../node_modules/@fixture/widgets/src/Widget.mjs';
export default class Viewport extends Base {
static widget = Widget
}The ESM transform correctly changes the Viewport's Engine import to ../../../src/core/Base.mjs. Its package import instead becomes ../../../../../node_modules/@fixture/widgets/src/Widget.mjs, which resolves back to the source package outside the emitted tree. That package's unchanged Engine import then returns to the source Engine.
The direct import-existence check sees an existing package file. It does not establish the transitive Engine identity of the package's static closure. The package needs no runtime loadModule() call or Main addon to expose the problem.
Controls from the artifact probe:
- the source-layout workspace and package resolve to one source Engine;
- a separately declared Main addon is correctly rebased to the emitted Engine;
- the emitted Viewport's direct-import check reports no failures while the transitive paths still reach two CoreBase URLs.
The Architectural Reality
Source anchors at 1b12232214a5b36bec6ca0255c2b93b5ef51e3ed:
buildScripts/build/esmodules.mjs:39–42 selects workspace/Engine source roots plus dependency roots declared by neo.mainAddons; :94–105 runs the shared rewrite/template/minify stages.
buildScripts/util/esmDistTransforms.mjs:100–107 sends ordinary third-party imports back to host node_modules.
rewriteMainAddonImports() at :124–162 rebases declared Main-addon modules onto the emitted Engine; ordinary App/package modules take the preceding generic transform.
resolveSourceRoots() at :233–262 adds workspace-owned roots. It does not currently discover a package's statically imported Engine-bearing graph.
findUnresolvableImports() at :488–523 validates the supplied emitted import records. A source-package target that exists does not reveal its transitive Engine edge there.
test/playwright/unit/buildScripts/esmWorkspaceBuild.spec.mjs owns actual emitted-tree integration coverage; esmDistTransforms.spec.mjs owns the pure transforms.
test/playwright/e2e/core/DistEsmWorkspaceBoot.spec.mjs:452–467 demonstrates that an Engine-identity mutation can still mount and must be caught through module identity evidence.
Design authority: the existing findUnresolvableImports() contract explicitly rejects a second Engine module graph, and the existing browser mutation arm proves why identity is independent of successful mounting. This leaf extends that protection through statically imported installed package classes. It does not declare all third-party source imports invalid.
The Fix
Keep the repair in ESM artifact discovery and import rebasing.
- Add the generic package-class reproduction to the existing workspace-build fixture and record its pre-change identity failure.
- Discover the transitive static import/re-export closure. For an installed package whose reachable graph integrates the Engine, emit its reachable package modules—including local helpers—under
dist/esm/node_modules/<package>/..., preserving the logical package-relative path. Rebase package-local, inter-package and Engine edges through one finite source-to-output map, including the importing workspace edges. A direct Engine import is not required in every copied helper.
- Preserve unrelated dependencies and the existing external treatment of ordinary packages that do not lead back to the Engine. Do not scan/copy every dependency tree or widen worker runtime contexts.
- Make the build's identity validation cover the relevant transitive package edges. A package source fallback must not silently reintroduce the source Engine.
- Review the shared
esmDistTransforms.mjs seam with the owner of #20778 before implementation. Reuse one consistent destination map where appropriate; do not add a competing runtime package-path protocol.
Static imports and re-exports already declare reachability: do not reuse neo.mainAddons, require neo.workerModules, or introduce a new opt-in key for this static graph. This is a bounded implementation direction. The PR must explain its graph/admission rule and preserve the controls below. No new host option or package-specific naming rule is required by this leaf.
Contract Ledger
| Target surface |
Source of authority |
Proposed behaviour |
Fallback / edge |
Docs |
Evidence |
Existing dist/esm workspace output |
esmodules.mjs; emitted Engine-identity guard |
Workspace and statically imported Engine-bearing package classes reach one emitted CoreBase URL |
Missing or unrepresentable required edges fail with the importer/specifier named; no silent source-Engine fallback |
Owning build/transform JSDoc |
Actual workspace-build fixture and artifact graph assertions |
| Existing static third-party imports |
rewriteImportPaths() and its plain-package control |
Preserve unrelated ordinary-package behaviour; admit only the bounded graph required for Engine identity |
No wholesale node_modules copy or dynamic-worker discovery |
Transform JSDoc |
Ordinary-library and unrelated-package exclusion controls |
Existing neo.mainAddons roots |
mainAddonPackages.mjs; rewriteMainAddonImports() |
Preserve declared Main-root admission and its emitted Engine identity |
Undeclared Main roots remain unadmitted |
Existing Main-addon contract |
Existing unit/build/native controls remain green |
Decision Record impact: none; preserve the existing emitted-Engine identity contract without a new runtime API or manifest protocol.
Acceptance Criteria
Out of Scope
Runtime/public URL-contract redesign (Discussion #17886, to which #17884 was retired); runtime worker loadModule() admission and neo.workerModules (#20778); shipped-app discovery (#20717); new Main-addon admission rules; webpack worker context changes; package feature code; registry publication or peer-version overrides; unrelated third-party bundling; treating Main-only bundle tests as full App build coverage.
Avoided Traps
- Redirecting only the workspace's import while leaving the package's Engine imports unchanged.
- Adding a private/vendor scope to an import filter or copying all of
node_modules.
- Declaring App component trees as Main-addon roots merely to reuse their special rewrite.
- Weakening the one-Engine oracle to file existence, successful mounting or namespace arbitration.
- Calling a source-worker/compiled-Main test a complete compiled-App proof.
- Presenting a staged local package-layout probe as successful npm peer resolution or released-engine qualification.
Related
#20667 (parent) · #20778 (runtime package paths; shared transform coordination) · #20717 (separate App discovery) · #17921 (emitted tree and Engine-identity checks) · #17931 (existing workspace boot coverage; not installed-package static closure) · #20821 / #20823 (declared package Main addons)
Retrieval Hint: "dist esm static installed package class source Engine emitted CoreBase transitive import graph"
Ownership and sweep
Sophie owns this bounded continuation under #20667; it is already-owned dependent delivery, not a contributor handoff. The parent steward and #20778 owner independently confirmed that static artifact emission is a separate leaf. #20778 is now merged through #20880: its shared reader is declaredPackageRoots.mjs, and neo.canvasModules remains Canvas runtime admission. The ESM builder's change was the reader import; the static package closure is still absent. Static reachability does not turn either role declaration into a worker opt-in.
Live latest-open + closed sweep: latest20 of30 open issues (orange band), closed ESM-package search and latest30 all-status A2A refreshed on 2026-11-13 immediately before filing. Same-surface #20821/#17931/#17884 bodies and exclusions were read: Main admission, existing boot coverage and the deferred runtime URL redesign do not own this static package closure. Own assignments #20861 and #20185 do not overlap. Problem-framed Memory Core search found no closer rationale; KB identified the existing ESM identity/boot and runtime package precedents. No competing static closure claim was found. Labels verified.
Structural pre-flight: existing build filesystem scheduling, pure AST transforms, unit build fixtures and the current native boot fixture own the work. No new directory, runtime subsystem, public config or Agent OS placement is proposed.
Origin Session ID: 9bf9ac41-3a89-436f-9bdb-2e38327937eb
Intake refresh — 14 November 2026
Valid with the source-anchor update above. Created/last pre-intake update: 13 November 07:05 UTC; pre-stale under the workflow's 90-day mark, with no stale/exemption labels. Parent #20667 has Grace's independent Greenlight review; this leaf has no blocking issue edges and remains assigned to Sophie. Current-dev inspection and the actual rewrite → template → minify probe still produce /dist/esm/src/core/Base.mjs for the workspace and /node_modules/neo.mjs/src/core/Base.mjs through the source package. This is artifact evidence, not a browser acceptance claim.
Prescription checked: buildScripts/build/esmodules.mjs owns finite file discovery/emission; buildScripts/util/esmDistTransforms.mjs owns import rebasing and emitted identity validation. The consumer supplies no new manifest key: static imports/re-exports already name the required graph. Existing role-specific Main/Canvas discovery stays separate. Core instance idioms are not implicated in the build algorithms. KB surfaced the existing ESM identity/boot precedents; three differently framed memory searches did not recover a closer implementation. The current code, live leaf and parent review govern intake.
Coordination: Grace's boundary review confirms the static admission rule and requires one destination map for every admission. Julia's #20948 is merged; the candidate preserves its resource exclusion, including stale-output removal. No other current open Engine PR touches this static-graph seam. Implementation remains bounded to the seven ACs above; ordinary unrelated dependencies stay external.
Candidate delivery
#20956 at a678dbb220 uses esmDestination() and a single createEsmBuildPlan() for default roots, declared Main roots and the reachable static package graph. Package-owner reverse reachability admits helpers that return to an already emitted owner, including cycles through pure shared state. Each admitted logical module is emitted once. Actual linked peers must agree with logical imports; genuine Engine aliases use the existing emitted file, while second installations and ambiguous package aliases are refused. Required missing or unrepresentable local package edges name their importer and specifier. Imported package JSON stays data.
The regression suite exercises installed and linked layouts, Main/App overlap, local/inter-package cycles, ordinary-library exclusion and the existing negative identity control. The packed-workspace browser now mounts a real package component and reads its Engine identity through Neural Link. Source and emitted modes pass without relaxing the original Main-bundle or split-identity oracles. Native evidence is distinct from the Node artifact checks; CI and review disposition remain on the PR. Runtime computed imports and Canvas ESM layout are outside this leaf, as recorded in the seam review.
Context
Leaf of #20667: an emitted workspace and a statically imported package class must use the same Engine module graph.
At Engine
1b12232214a5b36bec6ca0255c2b93b5ef51e3ed, a bounded Node artifact probe using the actual ESM rewrite, template-processing and minification stages reaches two CoreBase module URLs:/dist/esm/src/core/Base.mjs;/node_modules/neo.mjs/src/core/Base.mjs.This is artifact-path evidence. No full application build or browser execution is claimed. The existing browser negative control already demonstrates that a page can mount despite a split Engine graph, so mount success is not an adequate identity oracle.
The Problem
The workspace manifest names
neo.mjsand@fixture/widgetsas dependencies. The package uses ordinary static imports; no Main-addon or runtime-worker opt-in is involved. A minimal generic reproduction has this installed class:// node_modules/@fixture/widgets/src/Widget.mjs import Base from '../../../neo.mjs/src/core/Base.mjs'; export default class Widget extends Base {}The workspace imports both the Engine and that package statically:
// apps/probe/view/Viewport.mjs import Base from '../../../node_modules/neo.mjs/src/core/Base.mjs'; import Widget from '../../../node_modules/@fixture/widgets/src/Widget.mjs'; export default class Viewport extends Base { static widget = Widget }The ESM transform correctly changes the Viewport's Engine import to
../../../src/core/Base.mjs. Its package import instead becomes../../../../../node_modules/@fixture/widgets/src/Widget.mjs, which resolves back to the source package outside the emitted tree. That package's unchanged Engine import then returns to the source Engine.The direct import-existence check sees an existing package file. It does not establish the transitive Engine identity of the package's static closure. The package needs no runtime
loadModule()call or Main addon to expose the problem.Controls from the artifact probe:
The Architectural Reality
Source anchors at
1b12232214a5b36bec6ca0255c2b93b5ef51e3ed:buildScripts/build/esmodules.mjs:39–42selects workspace/Engine source roots plus dependency roots declared byneo.mainAddons;:94–105runs the shared rewrite/template/minify stages.buildScripts/util/esmDistTransforms.mjs:100–107sends ordinary third-party imports back to hostnode_modules.rewriteMainAddonImports()at:124–162rebases declared Main-addon modules onto the emitted Engine; ordinary App/package modules take the preceding generic transform.resolveSourceRoots()at:233–262adds workspace-owned roots. It does not currently discover a package's statically imported Engine-bearing graph.findUnresolvableImports()at:488–523validates the supplied emitted import records. A source-package target that exists does not reveal its transitive Engine edge there.test/playwright/unit/buildScripts/esmWorkspaceBuild.spec.mjsowns actual emitted-tree integration coverage;esmDistTransforms.spec.mjsowns the pure transforms.test/playwright/e2e/core/DistEsmWorkspaceBoot.spec.mjs:452–467demonstrates that an Engine-identity mutation can still mount and must be caught through module identity evidence.Design authority: the existing
findUnresolvableImports()contract explicitly rejects a second Engine module graph, and the existing browser mutation arm proves why identity is independent of successful mounting. This leaf extends that protection through statically imported installed package classes. It does not declare all third-party source imports invalid.The Fix
Keep the repair in ESM artifact discovery and import rebasing.
dist/esm/node_modules/<package>/..., preserving the logical package-relative path. Rebase package-local, inter-package and Engine edges through one finite source-to-output map, including the importing workspace edges. A direct Engine import is not required in every copied helper.esmDistTransforms.mjsseam with the owner of #20778 before implementation. Reuse one consistent destination map where appropriate; do not add a competing runtime package-path protocol.Static imports and re-exports already declare reachability: do not reuse
neo.mainAddons, requireneo.workerModules, or introduce a new opt-in key for this static graph. This is a bounded implementation direction. The PR must explain its graph/admission rule and preserve the controls below. No new host option or package-specific naming rule is required by this leaf.Contract Ledger
dist/esmworkspace outputesmodules.mjs; emitted Engine-identity guardrewriteImportPaths()and its plain-package controlnode_modulescopy or dynamic-worker discoveryneo.mainAddonsrootsmainAddonPackages.mjs;rewriteMainAddonImports()Decision Record impact: none; preserve the existing emitted-Engine identity contract without a new runtime API or manifest protocol.
Acceptance Criteria
/node_modules/neo.mjs/requests in the emitted App graph. Source mode remains a passing control. Browser proof is separate from the Node artifact result.Out of Scope
Runtime/public URL-contract redesign (Discussion #17886, to which #17884 was retired); runtime worker
loadModule()admission andneo.workerModules(#20778); shipped-app discovery (#20717); new Main-addon admission rules; webpack worker context changes; package feature code; registry publication or peer-version overrides; unrelated third-party bundling; treating Main-only bundle tests as full App build coverage.Avoided Traps
node_modules.Related
#20667 (parent) · #20778 (runtime package paths; shared transform coordination) · #20717 (separate App discovery) · #17921 (emitted tree and Engine-identity checks) · #17931 (existing workspace boot coverage; not installed-package static closure) · #20821 / #20823 (declared package Main addons)
Retrieval Hint: "dist esm static installed package class source Engine emitted CoreBase transitive import graph"
Ownership and sweep
Sophie owns this bounded continuation under #20667; it is already-owned dependent delivery, not a contributor handoff. The parent steward and #20778 owner independently confirmed that static artifact emission is a separate leaf. #20778 is now merged through #20880: its shared reader is
declaredPackageRoots.mjs, andneo.canvasModulesremains Canvas runtime admission. The ESM builder's change was the reader import; the static package closure is still absent. Static reachability does not turn either role declaration into a worker opt-in.Live latest-open + closed sweep: latest20 of30 open issues (orange band), closed ESM-package search and latest30 all-status A2A refreshed on 2026-11-13 immediately before filing. Same-surface #20821/#17931/#17884 bodies and exclusions were read: Main admission, existing boot coverage and the deferred runtime URL redesign do not own this static package closure. Own assignments #20861 and #20185 do not overlap. Problem-framed Memory Core search found no closer rationale; KB identified the existing ESM identity/boot and runtime package precedents. No competing static closure claim was found. Labels verified.
Structural pre-flight: existing build filesystem scheduling, pure AST transforms, unit build fixtures and the current native boot fixture own the work. No new directory, runtime subsystem, public config or Agent OS placement is proposed.
Origin Session ID: 9bf9ac41-3a89-436f-9bdb-2e38327937eb
Intake refresh — 14 November 2026
Valid with the source-anchor update above. Created/last pre-intake update: 13 November 07:05 UTC; pre-stale under the workflow's 90-day mark, with no stale/exemption labels. Parent #20667 has Grace's independent Greenlight review; this leaf has no blocking issue edges and remains assigned to Sophie. Current-dev inspection and the actual rewrite → template → minify probe still produce
/dist/esm/src/core/Base.mjsfor the workspace and/node_modules/neo.mjs/src/core/Base.mjsthrough the source package. This is artifact evidence, not a browser acceptance claim.Prescription checked:
buildScripts/build/esmodules.mjsowns finite file discovery/emission;buildScripts/util/esmDistTransforms.mjsowns import rebasing and emitted identity validation. The consumer supplies no new manifest key: static imports/re-exports already name the required graph. Existing role-specific Main/Canvas discovery stays separate. Core instance idioms are not implicated in the build algorithms. KB surfaced the existing ESM identity/boot precedents; three differently framed memory searches did not recover a closer implementation. The current code, live leaf and parent review govern intake.Coordination: Grace's boundary review confirms the static admission rule and requires one destination map for every admission. Julia's #20948 is merged; the candidate preserves its resource exclusion, including stale-output removal. No other current open Engine PR touches this static-graph seam. Implementation remains bounded to the seven ACs above; ordinary unrelated dependencies stay external.
Candidate delivery
#20956 at
a678dbb220usesesmDestination()and a singlecreateEsmBuildPlan()for default roots, declared Main roots and the reachable static package graph. Package-owner reverse reachability admits helpers that return to an already emitted owner, including cycles through pure shared state. Each admitted logical module is emitted once. Actual linked peers must agree with logical imports; genuine Engine aliases use the existing emitted file, while second installations and ambiguous package aliases are refused. Required missing or unrepresentable local package edges name their importer and specifier. Imported package JSON stays data.The regression suite exercises installed and linked layouts, Main/App overlap, local/inter-package cycles, ordinary-library exclusion and the existing negative identity control. The packed-workspace browser now mounts a real package component and reads its Engine identity through Neural Link. Source and emitted modes pass without relaxing the original Main-bundle or split-identity oracles. Native evidence is distinct from the Node artifact checks; CI and review disposition remain on the PR. Runtime computed imports and Canvas ESM layout are outside this leaf, as recorded in the seam review.