Problem
test/playwright/setup.mjs installs the Neo.currentWorker mock inside setup(), which a spec calls in its module body — after every static import has been evaluated, because ES imports are hoisted. src/manager/Window.mjs creates its singleton at import time and its construct calls Neo.currentWorker.on(...). A spec whose static import chain reaches the window manager therefore throws at load, and Playwright reports the file as having no tests.
The chain exists on dev since 2026-08-30: examples/dashboard/crossWindow/DemoBWorkspace.mjs imports src/ai/client/InteractionService.mjs (since 08-23), which gained import WindowManager from '../../manager/Window.mjs' with the atomic drag transactions (#17862). test/playwright/unit/examples/dashboard/crossWindow/DemoBWorkspace.spec.mjs has not been runnable alone since.
CI does not see it because Playwright reuses a worker's Node process across spec files and globalThis.Neo survives that reuse: when another spec ran first in the same worker, its setup() already installed the mock, and the example spec loads and passes. With four CI workers and sixty-odd files that is nearly always the case. Alone, or first in its worker, it is dead. Measured: npx playwright test -c playwright.config.unit.mjs unit/examples/dashboard/crossWindow/DemoBWorkspace.spec.mjs → TypeError: Cannot read properties of undefined (reading 'on') at src/manager/Window.mjs:40, "No tests found", exit 1; the same file after unit/dashboard/DockActionTooltips.spec.mjs with --workers=1 → loads, 64 tests run. Same result with CI's invocation (NEO_TEST_SKIP_CI=true npm run test-unit -- <file>).
This class has been seen before from the other side: a local namespace collision killing every service-importing unit spec while CI stayed unaffected, and the theme-deferral gate reading a stale worker binding across worker reuse. The shared cause is state that lives on globalThis.Neo across files in one worker.
Evidence
test/playwright/setup.mjs: top level sets globalThis.Neo ??= {}, Neo.config and DOMRect; Neo.currentWorker ??= {...} sits inside setup().
src/manager/Window.mjs:40 (construct) and :230 (singleton at import).
src/ai/client/InteractionService.mjs:2 — the static import; examples/dashboard/crossWindow/DemoBWorkspace.mjs:17.
- Only
test/playwright/unit/data/PipelineRemoteExecution.spec.mjs assigns its own Neo.currentWorker, by plain assignment with restore — unaffected by an earlier default.
Proposed change
Move the Neo.currentWorker ??= {...} block to the module top level of setup.mjs, next to globalThis.Neo ??= {}: setup.mjs is every spec's first import, so its top level runs before any engine module evaluates. ??= keeps a spec's own later assignment authoritative and keeps setup()'s behaviour for every other spec identical. No change to the window manager: constructing its singleton at import is its production shape.
Acceptance Criteria
Non-goals
- Making the window manager tolerate a missing worker at import.
- The worker-reuse class in general (a lint that spots
globalThis.Neo state leaking across files) — a separate leaf if wanted.
Found while adding a unit arm to that spec for #18088; the arm is blocked on this. Sweep 13:50Z before filing: live latest-20 open (no match), A2A last-8 (no claim), Knowledge Base (#15364 and #16503 are the same class from other causes, neither this).
Authored by Mnemosyne (@neo-fable, Claude Fable 5.1, Claude Code) · session 37bbc610-f0cd-4abb-95c2-eb70336a86f3
Problem
test/playwright/setup.mjsinstalls theNeo.currentWorkermock insidesetup(), which a spec calls in its module body — after every static import has been evaluated, because ES imports are hoisted.src/manager/Window.mjscreates its singleton at import time and itsconstructcallsNeo.currentWorker.on(...). A spec whose static import chain reaches the window manager therefore throws at load, and Playwright reports the file as having no tests.The chain exists on
devsince 2026-08-30:examples/dashboard/crossWindow/DemoBWorkspace.mjsimportssrc/ai/client/InteractionService.mjs(since 08-23), which gainedimport WindowManager from '../../manager/Window.mjs'with the atomic drag transactions (#17862).test/playwright/unit/examples/dashboard/crossWindow/DemoBWorkspace.spec.mjshas not been runnable alone since.CI does not see it because Playwright reuses a worker's Node process across spec files and
globalThis.Neosurvives that reuse: when another spec ran first in the same worker, itssetup()already installed the mock, and the example spec loads and passes. With four CI workers and sixty-odd files that is nearly always the case. Alone, or first in its worker, it is dead. Measured:npx playwright test -c playwright.config.unit.mjs unit/examples/dashboard/crossWindow/DemoBWorkspace.spec.mjs→TypeError: Cannot read properties of undefined (reading 'on')atsrc/manager/Window.mjs:40, "No tests found", exit 1; the same file afterunit/dashboard/DockActionTooltips.spec.mjswith--workers=1→ loads, 64 tests run. Same result with CI's invocation (NEO_TEST_SKIP_CI=true npm run test-unit -- <file>).This class has been seen before from the other side: a local namespace collision killing every service-importing unit spec while CI stayed unaffected, and the theme-deferral gate reading a stale worker binding across worker reuse. The shared cause is state that lives on
globalThis.Neoacross files in one worker.Evidence
test/playwright/setup.mjs: top level setsglobalThis.Neo ??= {},Neo.configandDOMRect;Neo.currentWorker ??= {...}sits insidesetup().src/manager/Window.mjs:40(construct) and:230(singleton at import).src/ai/client/InteractionService.mjs:2— the static import;examples/dashboard/crossWindow/DemoBWorkspace.mjs:17.test/playwright/unit/data/PipelineRemoteExecution.spec.mjsassigns its ownNeo.currentWorker, by plain assignment with restore — unaffected by an earlier default.Proposed change
Move the
Neo.currentWorker ??= {...}block to the module top level ofsetup.mjs, next toglobalThis.Neo ??= {}:setup.mjsis every spec's first import, so its top level runs before any engine module evaluates.??=keeps a spec's own later assignment authoritative and keepssetup()'s behaviour for every other spec identical. No change to the window manager: constructing its singleton at import is its production shape.Acceptance Criteria
DemoBWorkspace.spec.mjsruns alone (npx playwright test -c playwright.config.unit.mjs <file>) and finds and passes its tests; it also passes first in a--workers=1pair.PipelineRemoteExecution.spec.mjskeeps its own worker seam.setup()).Non-goals
globalThis.Neostate leaking across files) — a separate leaf if wanted.Found while adding a unit arm to that spec for #18088; the arm is blocked on this. Sweep 13:50Z before filing: live latest-20 open (no match), A2A last-8 (no claim), Knowledge Base (#15364 and #16503 are the same class from other causes, neither this).
Authored by Mnemosyne (@neo-fable, Claude Fable 5.1, Claude Code) · session 37bbc610-f0cd-4abb-95c2-eb70336a86f3