Context
Found while checking what a workspace outside this repository has to work around to build against the engine (#20667). With the engine linked into node_modules instead of installed, the App worker build held the engine's own apps and none of the workspace's. Measured on dev 62f75736ba with webpack 5.112.2.
It was seen once before, during the verification of #17868 on 2026-09-08: a trial with a symlinked engine left the workspace and was set aside as an instrument artifact. This is the second sighting, now reproduced.
The Problem
A workspace whose node_modules/neo.mjs is a symbolic link builds an App worker without the workspace's apps. In the layout pnpm produces, the build reports no error.
Reproduction. A workspace with one app (apps/probe/app.mjs, its index.html and neo-config.json, and src/MicroLoader.mjs) and the engine's sources as node_modules/neo.mjs. From the workspace root, the factory of buildScripts/webpack/development/webpack.config.appworker.mjs is called with {insideNeo: 'false'} and compiled through webpack's Node API. Module names are read from stats.toJson({modules: true}).
node_modules/neo.mjs is |
Context root webpack used |
Modules |
Engine app entry points |
The workspace's app |
Chunks |
| a real directory, as npm installs it |
the workspace |
107 |
0 |
compiled |
18 |
a symlink to a package two folders below <parent> |
<parent> |
1,221 |
161 |
not compiled |
349 |
the same symlink, with resolve.symlinks: false |
the workspace |
107 |
0 |
compiled |
18 |
a symlink into .pnpm/neo.mjs@<version>/node_modules/neo.mjs |
.pnpm/neo.mjs@<version> |
81 |
0 |
not compiled, 0 errors |
11 |
Who meets it: npm link, a file: dependency on a checkout, and every pnpm install.
Limits of the measurement: only the App worker was built. The fourth row is pnpm's layout made by hand, not a pnpm install.
The Architectural Reality
buildScripts/webpack/workerContextRebasePlugin.mjs rebases an app-space context root with path.posix.join('../../', context.request), relative to context.context, the worker's directory.
- webpack resolves symbolic links by default (
resolve.symlinks). For a linked engine context.context is <real package>/src/worker, and two levels above the real package is not the workspace.
- The configs already know the workspace:
cwd = process.cwd() in buildScripts/webpack/development/webpack.config.appworker.mjs:7, with neoPath derived from it at :11.
- The Data and Canvas worker configs (
webpack.config.worker.mjs, development and production) use the same plugin.
buildScripts/util/check-consumer-runtime-build.mjs guards this defect class from an installed copy, and .github/workflows/consumer-runtime-build.yml:55 runs it. It builds the App worker only as the framework (configFactory(isApp ? {insideNeo: 'true'} : …), :497), and its fixture installs a tarball, so no arm has a linked package.
- Design authority: "app-space roots step out to the consumer workspace, package-local roots stay where they are" (the JSDoc of
workerContextRebasePlugin).
The Fix
Rebase to the workspace the build was started in, not by arithmetic from where the package resolves. In workerContextRebasePlugin, the rebased request becomes the path from context.context to the app-space root under the consumer root, which holds for an installed, a linked and a pnpm-stored package alike. The plugin's callers hold cwd and pass it in.
check-consumer-runtime-build.mjs gains two things:
- A consumer-mode App worker build that asserts the fixture's app is in the graph and no app of the package is.
- One linked arm: the fixture's installed package is moved aside and linked back, and the same expectations run again.
Contract Ledger
| Target surface |
Source of authority |
Proposed behavior |
Fallback / edge |
Docs |
Evidence |
workerContextRebasePlugin (buildScripts/webpack/workerContextRebasePlugin.mjs:65) |
its JSDoc, quoted above |
app-space roots resolve under the consumer root for a real, a linked and a pnpm-stored package |
an absent optional root keeps today's matches-nothing fallback |
its JSDoc states the rule and why path arithmetic is not used |
the guard's linked arm |
mainAddonContextPlugin (buildScripts/webpack/mainAddonContextPlugin.mjs) |
its JSDoc: the workspace-owned Main-addon context |
the workspace addon root resolves under the workspace the build started in, for a real, a linked and a pnpm-stored package |
a workspace without src/main/addon keeps today's emptied package fallback |
its JSDoc |
the guard's linked Main arms, with and without a workspace addon |
check-consumer-runtime-build.mjs |
its header comment, "the defect class" |
a consumer-mode App build and a linked arm join the existing ones |
the installed arm's expectations are unchanged |
its header names the sixth defect |
red on dev, green with the repair |
Decision Record impact: none.
Acceptance Criteria
Out of Scope
- A workspace build command with its own output folder; that is a design question on #20667.
- Layouts where the engine is not at
<workspace>/node_modules/neo.mjs at all, such as a hoisted monorepo. Not checked here.
- Changing
resolve.symlinks for any config.
Avoided Traps
resolve.symlinks: false. It restores this build (row 3), and it changes module identity for every consumer: one package reached through two links becomes two copies. The defect is one path computation.
- Excluding the package's
apps/ and examples/ with another context filter. It hides the 161 entry points and still leaves the workspace's own app out.
- Recognising the package by
node_modules/neo.mjs in a resolved path. A linked package's real path does not contain it.
Related
#20667 (parent). The guard's header comment lists the five earlier defects of this class.
unowned-rationale: Ready for a contributor; maintainers provide planning and review.
Live latest-open + closed sweep: checked the latest 20 open issues and closed searches (symlink workspace build, pnpm, npm link, workerContextRebasePlugin, consumer workspace examples bundle; Out of Scope read on #17881 and #19163) at 2026-11-10T03:02Z; no equivalent or prior exclusion found. Backlog: 21 open (green band). An organization-wide search for pnpm and for symlink found no ticket on this.
A2A in-flight claim sweep: the last 30 mailbox rows to 03:01Z carry no claim on this scope.
MC sweep: "workspace build with a linked or symlinked engine compiles the engine's own apps, the workspace's app is missing", 5 results; one is the 2026-09-08 sighting named in Context, none a prior decision.
Own-assignment sweep: 1 open (#20667, the parent), none overlapping.
Structure map: N/A, no file is placed.
Origin Session ID: fe737fdd-2c32-4a15-bc7d-df3f8da67694
Retrieval Hint: "linked engine symlink pnpm consumer App worker context rebase wrong root"
Context
Found while checking what a workspace outside this repository has to work around to build against the engine (#20667). With the engine linked into
node_modulesinstead of installed, the App worker build held the engine's own apps and none of the workspace's. Measured ondev62f75736bawith webpack 5.112.2.It was seen once before, during the verification of
#17868on 2026-09-08: a trial with a symlinked engine left the workspace and was set aside as an instrument artifact. This is the second sighting, now reproduced.The Problem
A workspace whose
node_modules/neo.mjsis a symbolic link builds an App worker without the workspace's apps. In the layout pnpm produces, the build reports no error.Reproduction. A workspace with one app (
apps/probe/app.mjs, itsindex.htmlandneo-config.json, andsrc/MicroLoader.mjs) and the engine's sources asnode_modules/neo.mjs. From the workspace root, the factory ofbuildScripts/webpack/development/webpack.config.appworker.mjsis called with{insideNeo: 'false'}and compiled through webpack's Node API. Module names are read fromstats.toJson({modules: true}).node_modules/neo.mjsis<parent><parent>resolve.symlinks: false.pnpm/neo.mjs@<version>/node_modules/neo.mjs.pnpm/neo.mjs@<version>Who meets it:
npm link, afile:dependency on a checkout, and every pnpm install.Limits of the measurement: only the App worker was built. The fourth row is pnpm's layout made by hand, not a
pnpm install.The Architectural Reality
buildScripts/webpack/workerContextRebasePlugin.mjsrebases an app-space context root withpath.posix.join('../../', context.request), relative tocontext.context, the worker's directory.resolve.symlinks). For a linked enginecontext.contextis<real package>/src/worker, and two levels above the real package is not the workspace.cwd = process.cwd()inbuildScripts/webpack/development/webpack.config.appworker.mjs:7, withneoPathderived from it at:11.webpack.config.worker.mjs, development and production) use the same plugin.buildScripts/util/check-consumer-runtime-build.mjsguards this defect class from an installed copy, and.github/workflows/consumer-runtime-build.yml:55runs it. It builds the App worker only as the framework (configFactory(isApp ? {insideNeo: 'true'} : …),:497), and its fixture installs a tarball, so no arm has a linked package.workerContextRebasePlugin).The Fix
Rebase to the workspace the build was started in, not by arithmetic from where the package resolves. In
workerContextRebasePlugin, the rebased request becomes the path fromcontext.contextto the app-space root under the consumer root, which holds for an installed, a linked and a pnpm-stored package alike. The plugin's callers holdcwdand pass it in.check-consumer-runtime-build.mjsgains two things:Contract Ledger
workerContextRebasePlugin(buildScripts/webpack/workerContextRebasePlugin.mjs:65)mainAddonContextPlugin(buildScripts/webpack/mainAddonContextPlugin.mjs)src/main/addonkeeps today's emptied package fallbackcheck-consumer-runtime-build.mjsdev, green with the repairDecision Record impact: none.
Acceptance Criteria
node_modules/neo.mjsas a symlink to a package outside the workspace, the consumer-mode App worker graph contains the workspace'sapps/**/app.mjsand no app entry point of the package..pnpm/<name>@<version>/node_modules/folder.devbefore the repair and passes after it, and the pull request body shows both runs.Out of Scope
<workspace>/node_modules/neo.mjsat all, such as a hoisted monorepo. Not checked here.resolve.symlinksfor any config.Avoided Traps
resolve.symlinks: false. It restores this build (row 3), and it changes module identity for every consumer: one package reached through two links becomes two copies. The defect is one path computation.apps/andexamples/with another context filter. It hides the 161 entry points and still leaves the workspace's own app out.node_modules/neo.mjsin a resolved path. A linked package's real path does not contain it.Related
#20667 (parent). The guard's header comment lists the five earlier defects of this class.
unowned-rationale: Ready for a contributor; maintainers provide planning and review.
Live latest-open + closed sweep: checked the latest 20 open issues and closed searches (symlink workspace build, pnpm, npm link, workerContextRebasePlugin, consumer workspace examples bundle; Out of Scope read on
#17881and#19163) at 2026-11-10T03:02Z; no equivalent or prior exclusion found. Backlog: 21 open (green band). An organization-wide search for pnpm and for symlink found no ticket on this. A2A in-flight claim sweep: the last 30 mailbox rows to 03:01Z carry no claim on this scope. MC sweep: "workspace build with a linked or symlinked engine compiles the engine's own apps, the workspace's app is missing", 5 results; one is the 2026-09-08 sighting named in Context, none a prior decision. Own-assignment sweep: 1 open (#20667, the parent), none overlapping. Structure map: N/A, no file is placed.Origin Session ID: fe737fdd-2c32-4a15-bc7d-df3f8da67694
Retrieval Hint: "linked engine symlink pnpm consumer App worker context rebase wrong root"