LearnNewsExamplesServices
Frontmatter
id15065
titleFix: DockLayoutAdapter spec-chain unloadable in unit env (DockTabSortZone → DragCoordinator → Window import-time currentWorker.on)
stateClosed
labels
bugaitesting
assigneesneo-opus-grace
createdAt5:39 AM
updatedAt8:09 AM
githubUrlhttps://github.com/neomjs/neo/issues/15065
authorneo-opus-grace
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAt8:09 AM

Fix: DockLayoutAdapter spec-chain unloadable in unit env (DockTabSortZone → DragCoordinator → Window import-time currentWorker.on)

Closed Backlog/active-chunk-5 bugaitesting
neo-opus-grace
neo-opus-grace commented on 5:39 AM

Context

Mnemo's #15017 (merged) added DockLayoutAdapter → DockTabSortZone → DragCoordinator (module-scope) → Window. Window is a @singleton that Neo.setupClass instantiates at import, and its construct() touches Neo.currentWorker.on. In the unit env, importing the adapter (for its own specs or any dashboard-classified spec) evaluates this chain before setup()'s Neo.currentWorker stub runs → crash → "No tests found" (the chain is unloadable). Masked at merge by test-scope classification.

Blocks (why this is re-homed + urgent): my #14771 RA-2 falsifier tests (PR #15062) and Euclid's #14771 isolation testing — his cycle-1 review hit the same wall ("Local single-file adapter execution reaches the pre-existing Neo.currentWorker.on setup-order failure before discovery; it cannot validate this runtime plugin in isolation"). Re-homed from Mnemosyne (going dark 2026-07-13) — I'm absorbing it.

Root cause (V-B-A'd on dev)

  • src/dashboard/DockTabSortZone.mjs:1import DragCoordinator (module-scope)
  • src/manager/DragCoordinator.mjs:3import Window
  • src/manager/Window.mjs:40-45construct()Neo.currentWorker.on({…}); :196 Neo.setupClass(Window) instantiates the singleton at import
  • test/playwright/setup.mjs:143 — the Neo.currentWorker ??= {…} stub is inside setup() (line 48) → ESM hoists the import chain before setup() runs

Recommended fix — lazy the DragCoordinator dependency

DockTabSortZone uses DragCoordinator only in runtime drag methods (onDragEnd:170, onDragMove:212), never at module/class scope. Make the import lazy: preload in construct/onConstructed (import('../manager/DragCoordinator.mjs').then(m => me.dragCoordinator = m.default)) and use me.dragCoordinator at drag time. This breaks the module-scope chain (importing DockTabSortZone — which the adapter does for its config module: ref — no longer pulls Window at import → the adapter spec loads) while guaranteeing runtime availability (the preload resolves in ms; a drag is a much-later user gesture). The adapter spec imports DockTabSortZone but never constructs it, so the preload never fires in the unit env.

Alternatives weighed: (b) defer Window.construct's currentWorker.on — bigger blast (touches the window-manager runtime); (c) hoist-safe test-infra stub — fragile, spec-import-order-dependent.

Acceptance Criteria

  • The DockLayoutAdapter spec chain LOADS in the unit env (no currentWorker.on crash / "No tests found"); the adapter spec + #14771 RA-2 falsifiers run.
  • Cross-window tab drag still works (browser verification — the lazy preload resolves before any drag; assert via the #14772 recipe class). This is the safety AC — the fix touches drag-critical code.
  • No module-scope import of DragCoordinator/Window reachable from the DockLayoutAdapter import chain (grep-guard).

Related

#15017 (the introducing PR) · #14771 / PR #15062 (blocked — my RA-2 tests) · #14591 (whitebox-e2e) · #14772 (cross-window drag recipe). Origin: routed to Mnemo via A2A during #14771 (no ticket then, per the routed-to-owner rule); minted now as the owner goes dark.

tobiu referenced in commit 0401d09 - "fix(dashboard): lazy the DockTabSortZone DragCoordinator import — adapter spec loadable (#15065) (#15067) on 8:09 AM
tobiu closed this issue on 8:09 AM