LearnNewsExamplesConnect
Frontmatter
assigneesneo-opus-vega
createdAtNov 3, 2026, 7:42 AM
updatedAtNov 3, 2026, 4:32 PM
githubUrlhttps://github.com/neomjs/neo/issues/20223
authorneo-opus-vega
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtNov 3, 2026, 4:32 PM

Let a Workstation subclass choose the Workspace its viewport creates

neo-opus-vega
neo-opus-vega commented on Nov 3, 2026, 7:42 AM

Context

An app that builds on the Workstation, for example a workspace app that extends Workstation.view.Workspace with its own stores and panes, has no way to get that subclass created. Workstation.view.ViewportController#createRoot names the class at its call site: Neo.create(Workspace, {...}) at apps/workstation/view/ViewportController.mjs:210 (dev bb9f0311).

The rest of the Workstation already supports the extension. Workspace#createPane(itemId, item) is a method a subclass overrides, and the root stateProvider.stores map is a config.

The Problem

Swapping the workspace today means overriding createRoot in full. That is a ~60-line async method: it hydrates the topology library, validates the saved topology and writes the cold-hydrate transaction. A copy drifts from the original on every topology change, and a one-line seam avoids that.

The Architectural Reality

  • createRoot(binding, layoutId) (ViewportController.mjs:172-232) ends in Neo.create(Workspace, {flex, initialTopology, topologyGroupId, topologyLibrary, windowId}).
  • Workspace.MAIN_WORKSPACE_ID is read as a static at lines 151 and 199. A subclass inherits it, so those reads stay valid.
  • The Viewport takes its controller as a config, so a config object {module: ViewportController, workspaceModule: X} reaches a new controller config without subclassing the controller.
  • Engine owners take the class to instantiate as a config elsewhere too, e.g. Neo.grid.column.Tree defaults: {module: TreeComponent}. A class named at its call site defeats replacement.

The Fix

Add a workspaceModule config to Workstation.view.ViewportController, defaulting to Workstation.view.Workspace, and create the root workspace from it in createRoot. Its JSDoc names the two ways to set it: a subclass, or the controller config object.

Contract Ledger

Surface Source of authority Behavior Fallback Docs Evidence
Workstation.view.ViewportController#workspaceModule (new config) this ticket; createRoot at ViewportController.mjs:210 createRoot instantiates this class for the main workspace, with the same config as today unset → Workstation.view.Workspace, today's behavior JSDoc on the config unit spec in test/playwright/unit/apps/workstation/ViewportController.spec.mjs

Decision Record impact

none

Acceptance Criteria

  • Workstation.view.ViewportController has a documented workspaceModule config that defaults to Workstation.view.Workspace.
  • createRoot creates the root workspace from workspaceModule, and no other site in the controller instantiates the class.
  • A unit spec in ViewportController.spec.mjs shows both the default and an override reaching the instantiation.
  • The default path is unchanged: the existing Workstation unit specs pass.

Out of Scope

  • Making panes or stores swappable: createPane and stateProvider.stores already are.
  • Any change to Workstation.view.Workspace itself.

Avoided Traps

  • Overriding createRoot in a subclass copies 60 lines of topology hydration, which then drift.
  • Patching Workspace.prototype from the extending app mutates a shared class for every consumer.

Related

  • apps/workstation/view/Workspace.mjs: createPane and stateProvider, the existing seams.

Live latest-open + closed sweep: checked latest 20 open + closed search (Workstation workspace subclass createRoot, Workstation ViewportController Workspace) at 2026-11-03T06:45Z; no equivalent or prior exclusion found. A2A in-flight claim sweep (latest 30 lane-claims): none on this surface. Memory Core rationale sweep: no prior decision on a swappable workspace class. Own-assignment sweep: no overlapping ticket.

Origin Session ID: 5e9128fe-c4ce-41cb-869a-e627945eb9b8 Retrieval Hint: "Workstation ViewportController createRoot workspace class seam"

tobiu referenced in commit e0a4702 - "feat(workstation): let a subclass choose the Workspace its viewport creates (#20223) (#20225)" on Nov 3, 2026, 4:32 PM
tobiu closed this issue on Nov 3, 2026, 4:32 PM