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
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"
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 inPlacement#prepare. Its own comment says that a malformed hint passes through to its errors unchanged, but it does not.I measured it on
devwith a scratch probe that calls the realresolveFallbacksandPersistence.captureTopologyPerspectiveon a live workspace:fallbackTargeton a live workspaceresolveFallbacksnodeId: ''nodeId: ' 'nodeIdnodeId: 42nodeIdplus awindowIdfieldnodeId(control)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 fromrelativeHint()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 wheneverdocument && !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 anodeIdthat is not a non-blank string, and any field outsidefallbackTargetKeys.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
hintsafter Group retirement now throws. It needs no change. Placement is the onlygroupRetiredlistener, andTopologyLibrary#retireIfHeadlessdisposes the Workspace synchronously right afterretireGroup. Neither Workspace's teardown captures the topology, so nothing reads the hints in between.Acceptance Criteria
test/playwright/unit/dashboard/DockPlacement.spec.mjs): for an empty, blank, missing or non-stringnodeIdon a live workspace,resolveFallbacksreturns the hints unchanged andpreparerefuses with the non-empty-nodeId error. A stale target that carries an extra field is refused for that field. The arm is red ondevand green with the fix.Out of Scope
Persistence): unchanged.hintsafter Group retirement (see The Fix).Related
resolveFallbacks.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"