LearnNewsExamplesServices
Frontmatter
id18239
titleFix the dock lock idioms in place, before anything moves
stateClosed
labels
enhancementairefactoringarchitecturedashboard
assigneesneo-opus-vega
createdAtSep 4, 2026, 12:58 AM
updatedAtSep 4, 2026, 10:09 AM
githubUrlhttps://github.com/neomjs/neo/issues/18239
authorneo-opus-vega
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtSep 4, 2026, 10:09 AM

Fix the dock lock idioms in place, before anything moves

Closed v13.2.0/archive-v13-2-0-chunk-18 enhancementairefactoringarchitecturedashboard
neo-opus-vega
neo-opus-vega commented on Sep 4, 2026, 12:58 AM

AMENDED 2026-09-04. This was "extract the lock concern into a plugin, as the vehicle spike". PR #18240 delivered that and @neo-opus-grace Dropped+Superseded it — successor map — because the moved body violated four Neo idioms, none of them introduced or resolved by moving it. Her successor ordering is now this ticket's scope: fix the idioms in place on Workspace first; where the code lives is the second question.

Sub of #18151.

Context

src/dashboard/dock/Workspace.mjs is 4,317 lines at origin/dev@274b63beac, and D#18150 is choosing a vehicle to decompose it. The spike that tried extraction first produced the finding that made extraction the wrong first step: relocating code does not improve it, and the lock concern's body was carrying four idiom violations that travel with it wherever it goes.

Operator rating on the extraction PR: 5/5/5/5. A refactor review that checks line count, test greenness and assertion-edit count verifies only that the move was faithful — none of the three can see whether the moved thing was worth keeping.

The Problem

Four idioms, all live on dev, none of them a consequence of any refactor:

# Idiom violation Status
1 Positional pairing. syncDockLockAction paired dockItemIds, getTabButtons() and getCardContainer().items by index, while tab/plugin/Overflow removes overflowing buttons from that set by design — so under overflow a lock transition could stamp the drag token on the wrong button. DONE — PR #18245, identity-keyed via dockItemId
2 Hand-rolled change detection. Five action syncs wrote action.x !== v && (action.x = v) in front of reactive configs that already self-diff. DONE — PR #18245, with the setSilent-vs-set batching correction from @neo-opus-grace's review
3 Per-instance mutable state as class fields. dockLockPaneState and dockLockDragState are WeakMaps keyed on components — a parallel store the engine cannot observe or invalidate, where the idiom is configs. open — this ticket
4 The engine patches a tab button's presentation imperatively. setSilent / vdom['aria-label'] / update() against a header that should own its own chrome, per the standing operator ruling. open — #18241, which is the generator: actions have no class, so the derivation is written once in the projection and again in every host sync

The Architectural Reality

Item 3 is the residue after #18245 and #18241. The two WeakMaps exist because unlock must reverse along the path that locked: the record decides, never the current probe. That contract is right; the storage is not. A WeakMap keyed on a component instance is invisible to the engine's own lifecycle — nothing invalidates it on destroy except the code that wrote it, and nothing can inspect it.

Item 4 is not this ticket's to fix, and it subsumes part of item 3: once an action owns its state→presentation derivation, the drag-token record has an owner too.

The Fix

Move the lock records off class fields and onto the surfaces that already have lifecycle: the pane's and button's own config state, or the committed document, so the engine can see and invalidate them. Sequenced behind #18241 — the shape of item 3's fix depends on whether an action class exists to hold it.

Decision Record impact

aligned-with ADR 0029.

Acceptance Criteria

  • AC-1 — dockLockPaneState and dockLockDragState are gone from Workspace's class fields; the exact-restore contract is preserved and still witnessed by the existing arms, unedited.
  • AC-2 — The replacement is observable to the engine: a destroyed pane or button leaves no record behind without the lock code running.
  • AC-3 — Workspace.mjs loses lines and gains none. The number is stated in the PR body.
  • AC-4 — No extraction. If the residue looks worth moving afterwards, that is D#18150's question and a separate PR.

Out of Scope

  • Extraction of any kind. That was this ticket's original scope and it was the wrong first step; #18240 is the receipt.
  • The action class (#18241) and the §1e trigger widening (#18242).
  • D#18150's vehicle choice. This ticket makes the code worth extracting; it does not decide where it goes.

Avoided Traps

  • Extracting first. Measured: the extraction moved 240 lines and improved none of them, and its four ACs graded the move — so none could fail on any real falsifier.
  • Reading green arms as approval of a refactor. 896 passing arms and a −175 delta told me nothing about whether the moved code was worth keeping.
  • Treating a reviewer's Drop+Supersede as "discard everything". The salvage map scoped the discard to the extraction; five in-place fixes were never in it, and I binned them anyway until @tobiu caught it. They are now #18245.

Related

  • PR #18240 (closed, Drop+Supersede) — the extraction and its falsifiers; the successor map.
  • PR #18245 (approved) — items 1 and 2, in place.
  • #18241 — item 4's generator: actions have no class.
  • #18242 — widening the defect-note trigger from broke to touched-and-saw, which is how items 1–4 should have surfaced years earlier.
  • D#18150 — the decomposition this feeds; the declinability datum from the spike belongs in the Guard cells of options B and E.
  • #18151 — parent.

Salvaged from the spike, carried so it is not rediscovered

A lazy-getter plugin makes declinability a call-site discipline rather than a property of the vehicle — a declined concern still constructed through syncDockLockItemPresentation, because only two of four entry points gated on the flag. That belongs in D#18150's Guard cells for both B and E regardless of which wins. And an extraction of the largest self-contained concern yielded ~175 lines, which is a real input to that Discussion's target.

Origin Session ID: e8ea32a2-b9a8-43ea-84ba-b83081ec4b3d

Retrieval Hint: "fix dock lock idioms in place before extraction WeakMap class fields positional pairing setSilent batching"