LearnNewsExamplesConnect
Frontmatter
assigneesneo-opus-ada
createdAtOct 22, 2026, 6:20 PM
updatedAtOct 22, 2026, 10:54 PM
githubUrlhttps://github.com/neomjs/neo/issues/20012
authorneo-opus-ada
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtOct 22, 2026, 10:54 PM

resolveFallbacks turns a malformed fallbackTarget into a valid one

neo-opus-ada
neo-opus-ada commented on Oct 22, 2026, 6:20 PM

Context

This was raised in @neo-gemini-julia's review of #19995 (challenge 1). Placement.resolveFallbacks, added there for #19993, runs before the topology validation in Placement#prepare. Its own comment says that a malformed hint passes through to its errors unchanged, but it does not.

I measured it on dev with a scratch probe that calls the real resolveFallbacks and Persistence.captureTopologyPerspective on a live workspace:

fallbackTarget on a live workspace validation errors errors after resolveFallbacks
nodeId: '' requires a non-empty nodeId none (target → root)
nodeId: ' ' requires a non-empty nodeId none
no nodeId requires a non-empty nodeId none
nodeId: 42 requires a non-empty nodeId none
stale nodeId plus a windowId field unexpected field "windowId"; node does not exist none (field dropped)
stale nodeId (control) node does not exist none (intended)

The Problem

prepare() is the placement participant's write boundary: every commit that carries placement hints passes through it. A malformed target comes out as a valid one that points at the workspace root, so the write is accepted instead of refused. No shipped writer produces such a target today, because minted hints come from relativeHint() and stored ones were validated. The break is in the boundary's contract, and it lets a writer the boundary does not control, such as a programmatic or agent-driven commit, slip past validation.

The Architectural Reality

  • src/dashboard/dock/window/Placement.mjs, resolveFallbacks: it re-targets whenever document && !Object.hasOwn(document.nodes, target.nodeId), and it rebuilds the target as {workspaceKey, nodeId: document.root}.
  • src/dashboard/dock/model/Persistence.mjs, placement-hint validation: it refuses a nodeId that is not a non-blank string, and any field outside fallbackTargetKeys.
  • Design authority: the method's own comment, "Runs before validation: a malformed hint passes through to its errors unchanged."

The Fix

Re-target only a well-formed target. The check is typeof nodeId === 'string' && nodeId.trim(), the same predicate validation applies, plus a node the document lacks. Spread the target ({...target, nodeId: document.root}) so that its other fields still reach validation.

Julia's second observation was that reading hints after Group retirement now throws. It needs no change. Placement is the only groupRetired listener, and TopologyLibrary#retireIfHeadless disposes the Workspace synchronously right after retireGroup. Neither Workspace's teardown captures the topology, so nothing reads the hints in between.

Acceptance Criteria

  • Unit (test/playwright/unit/dashboard/DockPlacement.spec.mjs): for an empty, blank, missing or non-string nodeId on a live workspace, resolveFallbacks returns the hints unchanged and prepare refuses with the non-empty-nodeId error. A stale target that carries an extra field is refused for that field. The arm is red on dev and green with the fix.
  • The existing stale-fallback arms stay green: "a document commit that removes the fallback node leaves the hints capturable, and undo restores the target" and "a popup move after the fallback node is gone still records its row".

Out of Scope

  • Validation itself (Persistence): unchanged.
  • Reading hints after Group retirement (see The Fix).

Related

Live latest-open sweep: checked latest 20 open issues at 2026-10-22T16:19:18Z; no equivalent found. Keyword sweep: "resolveFallbacks", "fallbackTarget nodeId": no results. A2A claim sweep: latest 30 messages; no overlapping lane-claim. MC sweep: "placement hint fallbackTarget empty nodeId masked, validation error hidden by fallback resolution": 6 results, none on this surface. Own-assignment sweep: none overlapping.

Origin Session ID: ad72172d-1af5-4daa-84ba-e3520e41b6d3 Retrieval Hint: "Placement resolveFallbacks malformed fallbackTarget hidden from validation, placement hint prepare boundary"

tobiu referenced in commit 998f35a - "fix(dock): resolveFallbacks leaves a malformed fallbackTarget to validation (#20012) (#20013) on Oct 22, 2026, 10:54 PM
tobiu closed this issue on Oct 22, 2026, 10:54 PM