LearnNewsExamplesServices
Frontmatter
id18480
titleWorkstation calls PreviewContract without importing it: a live ReferenceError no gated spec could report
stateClosed
labels
bugaidashboard
assigneesneo-opus-grace
createdAtSep 8, 2026, 4:15 PM
updatedAtSep 8, 2026, 8:45 PM
githubUrlhttps://github.com/neomjs/neo/issues/18480
authorneo-opus-grace
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtSep 8, 2026, 8:45 PM

Workstation calls PreviewContract without importing it: a live ReferenceError no gated spec could report

neo-opus-grace
neo-opus-grace commented on Sep 8, 2026, 4:15 PM

Context

Serves: #17844 — surfaced by the first execution of the gated Neural Link battery. This is one of the defects that battery exists to find, filed as its own leaf rather than left in a census comment.

The Problem

apps/workstation/view/Workspace.mjs:3291 calls a symbol the module never imports:

let descriptor     = PreviewContract.previewToOperation(finalPreview),
    expectedResult = descriptor && Operations.applyOperation(
        WorkspaceDocument.clone(documentBefore),
        descriptor
    );

grep -c "import PreviewContract" apps/workstation/view/Workspace.mjs → 0. Every sibling it sits beside is imported explicitly (Operations, WorkspaceDocument, DockPreview, …); this one is not. The class exists and is healthy — src/dashboard/dock/model/PreviewContract.mjs, export default Neo.setupClass(PreviewContract), imported and exercised by src/dashboard/dock/window/Participation.mjs, interaction/DropIndicators.mjs and the passing unit spec test/playwright/unit/dashboard/DockPreview.spec.mjs.

So this is not a rename, a retirement, or a broken module. It is a missing import in the consumer, and it throws a bare ReferenceError the moment that path executes.

The Architectural Reality

The observed failure, from the battery:

cue errors must be empty: {"applied":false,"errors":["PreviewContract is not defined"]}

The cue reports applied: false and carries the ReferenceError as a string, so the failure surfaces as a cue contract violation rather than as a crash — which is why it reads like a policy problem at first glance. It is not: the operation descriptor is never produced, so nothing downstream can apply.

Blast radius, measured across the battery run at dev@a57ffbe717: eight spec files reach this line.

DockSplitterZoneIdNL · WorkstationCrossZoneCueNL · WorkstationDockFlipResizeNL · WorkstationDockSplitChromeNL · WorkstationEdgeSplitterNL · WorkstationFiveBeatNL · WorkstationSplitterGridGeometryNL · WorkstationStarvedTourNL

Why nothing reported it. All eight are *NL specs, testIgnored by playwright.config.e2e.mjs whenever NEO_AGENTOS_RUNTIME_ROOT is unset — which it is in CI. Zero matched specs reads as a pass. The flagship application has been carrying a live ReferenceError on a real interaction path with no surface able to report it.

Independent corroboration: @neo-opus-vega hit the identical signature from a different Brain checkout while working #18460, and read it as a missing import before I did. Her diagnosis is the one this ticket adopts.

The Fix

Add the missing import to apps/workstation/view/Workspace.mjs, matching the file's existing alignment:

import PreviewContract from '../../../src/dashboard/dock/model/PreviewContract.mjs';

One line. No engine change, no contract change, no behavioural design decision — the call site already states the intended contract and PreviewContract.previewToOperation already implements it.

Contract Ledger Matrix

Target Surface Source of Authority Proposed Behavior Fallback Docs Evidence
apps/workstation/view/Workspace.mjs import block the call site at :3291 resolves PreviewContract at module scope none — absence is the defect none needed grep -c "import PreviewContract" → 0 before, 1 after
PreviewContract.previewToOperation src/dashboard/dock/model/PreviewContract.mjs unchanged unchanged unchanged imported by Participation.mjs, DropIndicators.mjs, passing unit spec

Decision Record impact

none.

Acceptance Criteria

  • AC-1 — apps/workstation/view/Workspace.mjs imports PreviewContract; grep -c returns 1.
  • AC-2 — red-first. WorkstationCrossZoneCueNL fails with errors: ["PreviewContract is not defined"] before the change and passes after, both with NEO_AGENTOS_RUNTIME_ROOT set. The red arm is the receipt that the import is load-bearing rather than cosmetic.
  • AC-3 — the other seven named specs no longer report that error string. Any residual failure in them is a different defect and must be named as such, not absorbed here.
  • AC-4 — run conditions are stated with the evidence: launch profile, execution mode and dist/development build state. A number without them is not a receipt (see #17844 — the same battery gave 51 and 57 under two configurations).

Out of Scope

  • The other failures the battery found. #17844 owns the census; this ticket owns one defect.
  • Making the gate fail loud when NEO_AGENTOS_RUNTIME_ROOT is unset — that is an AC on #17844.
  • Any apps/workstation decomposition. #18456 and its leaves own that entrypoint's shape; this changes one import line and must not drift into it.

Avoided Traps

  • Treating it as an engine defect. The signature reads like a dock-preview contract failure, and PreviewContract is an engine class — but the engine module is imported and exercised elsewhere and is not at fault. The consumer is.
  • Absorbing it into #17844. A census that also carries fixes stops being a census; the count and the repairs need separate authority.
  • Reading applied: false as policy. The cue reports a contract violation because it stringifies the ReferenceError into its errors array. The proximate cause is a missing symbol, not a refused operation.

Related

  • #17844 (the battery that surfaced it), #18456 / #18460 (@neo-opus-vega hit the same signature while working the Workstation consumer epic), #18304 (engine-side dock ownership)

Origin Session ID: 0692d99a-6b58-4de2-aa51-e7d10f3f80d4

Retrieval Hint: grep -n 'PreviewContract' apps/workstation/view/Workspace.mjs; query_raw_memories — "PreviewContract is not defined missing import workstation cue".