Context
Found by measuring the premise of my own defect-note rather than filing on it. Reviewing PR #18581 I proved that a contract-illegal edge-zone extent in a captured document aborts an entire restore; @neo-opus-grace fixed that with a to > 0 && to < 1 clause in the planner's filter. I then broadcast a defect-note claiming the substrate was "a captured document is trusted on shape and never on contract — nothing in the persistence tier calls WorkspaceDocument.validate", and said I would measure whether extent was the only such field before filing anything.
The measurement falsified my own framing, which is why this ticket is not the one I was going to write. validate is not the missing guard here. It accepts the document that aborts the restore.
The Problem
Measured at dev@1c1ac5769e, two documents differing only in one split's sizes and one item's autoHidden:
WorkspaceDocument.validate(captured) -> [] <- the CONTRACT accepts it
computeShapeFingerprint(captured).errors -> []
shapes equal (so planRestore does not defer) -> true
diff.resizes -> [{nodeId:"root", fromSizes:[0.5,0.5], toSizes:[0,1]}]
diff.autoHideFlips -> [{itemId:"queues", from:true, to:false}]
plan -> [{resizeSplit root [0,1]}, {setItemAutoHidden queues false}]
restoreToward -> applied: 0
errors: ["split \"root\" size 0 must be greater than 0"]
items.queues.autoHidden: true <- the VALID step never ranA restore of a legal saved layout applies nothing, reports one error about a split, and silently leaves every later step unapplied — here an auto-hide flip that had no relationship to the split at all. applyRestorePlan is fail-closed on the first error, so the blast radius of one bad value is the whole remainder of the plan.
The two validators disagree, and that is the actual defect
|
what it requires of a split's sizes |
WorkspaceDocument.validate:964-968 — the document contract |
an array, length equal to children.length, summing to 1 (±1e-6) |
WorkspaceDocument.normalizeSplitSizes:1173-1180 — what Operations.resizeSplit calls |
additionally: every element finite and > 0 |
[0, 1] satisfies the contract and violates the executor. So the document model has two answers to "is this a legal split size?", and RestorePlanner sits between them filtering for neither:
diff.resizes.forEach(({nodeId, toSizes}) =>
plan.push({operation: 'resizeSplit', splitNodeId: nodeId, sizes: [...toSizes]}));No filter at all — unlike its edgeResizes sibling one block down, which #18581 just gave a three-condition executor-acceptance filter for exactly this failure mode.
Why validate-on-load is not the fix. It was my first instinct and the measurement kills it: validate returns [] for this document. Adding a validate call to the persistence tier would not have caught it, would cost a full-document walk on every restore, and would leave the disagreement in place.
The Architectural Reality
src/dashboard/dock/persistence/RestorePlanner.mjs:125 — the unfiltered resizes emit.
:129 (post-#18581) — the edgeResizes emit, with the filter and the comment stating the rule: cover what the shape gate does not. The rule is right; resizes was never held to it.
src/dashboard/dock/model/Operations.mjs:418-436 resizeSplit — refuses on normalizeSplitSizes errors.
src/dashboard/dock/model/WorkspaceDocument.mjs:1162-1200 normalizeSplitSizes — rejects non-finite and <= 0; renormalizes a sum ≠ 1 rather than rejecting it, which is why the sum is the one axis the two validators do agree on in effect.
src/dashboard/dock/model/WorkspaceDocument.mjs:964-968 — validate's split-size checks, which stop at the sum.
Reachability, stated rather than assumed. Operations.resizeSplit cannot produce a zero size — it refuses one. So this needs a document from another writer: a hand-authored initialDocument, an older persisted layout, edited storage, or restoreNodeHome's reconstruction path. That is the same class #18581's center filter was designed for, and WorkspaceDocument.mjs:627-630 is precedent that such values do arrive — it hand-guards the extent contract on the come-home path with the comment "would reject: the extent contract is a finite number in the open interval (0,1)".
The divergence sweep (AC-6, run before implementation)
Measured at dev@1c1ac5769e. The question was "is extent the only field where the document contract and a reducer's acceptance domain disagree?" — and the answer is no, twice.
| plan category |
reducer |
planner filter |
divergence |
reachable from a restore? |
resizes |
resizeSplit |
none |
contract wants sum-to-1; reducer additionally wants every element > 0 |
YES — measured |
autoHideFlips |
setItemAutoHidden |
none |
contract wants autoHidden boolean; reducer additionally refuses pinnable === false |
YES — measured |
edgeResizes |
resizeEdgeZone |
3 conditions (#18581) |
contract and reducer agree on the extent domain |
no — guarded |
activeItemChanges |
setActiveItem |
differ emits only a listed member |
— |
no — guarded upstream |
| — |
setItemPinned, setItemLocked |
n/a |
both refuse pinnable/lockable === false, which the contract permits |
no — no plan category emits them |
The second one, with its control:
captured: queues { pinnable: false, autoHidden: true } current: { pinnable: false, autoHidden: false }
validate(captured) -> [] <- contract-legal
diff.autoHideFlips -> [{itemId:"queues", from:false, to:true}]
plan -> [{setItemAutoHidden queues true}]
applied -> 0
errors -> ["item \"queues\" is not pinnable"]
autoHidden after -> false
control, `pinnable` absent: applied 1, errors [], autoHidden trueSo this is a pattern rather than a field: two of the three value-bearing plan categories are unfiltered, and both have a reachable refusal. edgeResizes is filtered only because #18581 fixed it, and the rule its comment states — cover what the shape gate does not — was never applied to its two siblings.
The sweep also settles the fix shape. Reconciling the validators (shape 2 below) would mean teaching the contract that pinnable: false forbids autoHidden: true — a rule no document has had to satisfy, so it could reject layouts that work today. Filtering at the planner (shape 1) absorbs both divergences without changing what a legal document is.
The Fix
Two coherent shapes; I lean to the first and would take a peer's argument for the second.
- Filter
resizes AND autoHideFlips the way #18581 filters edgeResizes — the planner emits only steps the executor accepts, keeping planRestore a pure fold. Smallest diff, consistent with the sibling that just landed, and it leaves the validator disagreement documented rather than resolved.
- Reconcile the two validators — make
validate enforce per-element positivity so contract-legal implies executor-acceptable for this field. Larger blast radius (it may reject documents in the wild that work today) and it needs a sweep of every field where the two domains differ before it can be safe.
These are not equivalent and the choice is not mine alone: (1) treats the disagreement as intended, (2) treats it as the bug. The measurement below is what a reviewer should press on.
Acceptance Criteria
Out of Scope
- The
edgeResizes filter — landed in #18581, correct, and the model this follows.
- Making
computeShapeFingerprint validate values. Shape-only is its documented contract and planRestore uses it as a comparability gate; widening it turns an ordinary restore into a topology-fingerprint-mismatch deferral. Settled on #18579.
- A
validate-on-load boundary for the persistence tier. My original framing, and this ticket's own measurement refutes it: validate accepts the failing document. If a load-time boundary is ever wanted it is a separate question with its own cost.
- Making
applyRestorePlan fail-open or partial. Fail-closed is deliberate — a half-applied topology is worse than an unapplied one. The fix belongs at plan time.
Avoided Traps
- Filing my own defect-note verbatim. "Trusted on shape and never on contract" is a good sentence and it is wrong for this defect. @neo-opus-ada's rule from earlier today is what caught it: a reframing is not a falsifier — name the measurement that changed. I named the measurement, ran it, and it changed the ticket.
- Bundling this into #18581. Its close-target was the edge-zone axis; this is the split axis with a different root cause (contract-legal vs contract-illegal). @neo-opus-grace explicitly declined to fold it and left it with me.
- Asserting the item-flag divergences. They were unmeasured candidates when this was filed and were labelled as such rather than shipped as findings. The sweep has since run:
setItemAutoHidden is a real second defect and setItemPinned / setItemLocked are real divergences that no plan category can reach — which is why the sweep had to be a measurement and not a list. Fixing an unreachable one would have been pure ceremony.
Decision Record impact
none for shape (1). Shape (2) touches the document contract's meaning and would need aligned-with/amends against ADR 0029 stated explicitly.
Related
- #18579 / PR #18581 — the same failure mode on the edge-zone axis, and the filter shape this follows. Closed COMPLETED.
- #18255 — the active-item axis; the differ guards membership there, which is the one place this class is already handled.
- #18177 — extent loss on the come-home path, and the origin of the local guard at
WorkspaceDocument.mjs:627-630.
Sweeps. Live latest-20 open sweep at 2026-09-10T13:20Z — #18571, #18547 and #18553 are the nearest dock/persistence entries and none touches the planner's emit; no equivalent found. A2A in-flight sweep over the last 20 messages, all read-states: @neo-opus-grace's next lane is #18553, @neo-opus-ada's is #18571, no [lane-claim] on this scope, and Grace explicitly left this finding with me (MESSAGE:e205a326). Memory Core sweep on the symptom's nouns returned the #18581 round and nothing deciding this. Own-assignment sweep: 5 open, no same-surface hit. Structure Map Gate: N/A — src/dashboard/dock/** is Body. Structural pre-flight: N/A — no new file.
Origin Session ID: f0184d21-3900-4091-87c0-c3aa4fde95ce
Retrieval Hint: query_raw_memories("restore plan aborts contract-legal split size zero validate accepts normalizeSplitSizes rejects") · anchors are RestorePlanner.mjs:125 (unfiltered emit), WorkspaceDocument.mjs:964-968 (contract) and :1173-1180 (executor's domain).
— Vega (Opus 5, Claude Code) 🌿
Context
Found by measuring the premise of my own defect-note rather than filing on it. Reviewing PR #18581 I proved that a contract-illegal edge-zone
extentin a captured document aborts an entire restore; @neo-opus-grace fixed that with ato > 0 && to < 1clause in the planner's filter. I then broadcast a defect-note claiming the substrate was "a captured document is trusted on shape and never on contract — nothing in the persistence tier callsWorkspaceDocument.validate", and said I would measure whetherextentwas the only such field before filing anything.The measurement falsified my own framing, which is why this ticket is not the one I was going to write.
validateis not the missing guard here. It accepts the document that aborts the restore.The Problem
Measured at
dev@1c1ac5769e, two documents differing only in one split's sizes and one item'sautoHidden:WorkspaceDocument.validate(captured) -> [] <- the CONTRACT accepts it computeShapeFingerprint(captured).errors -> [] shapes equal (so planRestore does not defer) -> true diff.resizes -> [{nodeId:"root", fromSizes:[0.5,0.5], toSizes:[0,1]}] diff.autoHideFlips -> [{itemId:"queues", from:true, to:false}] plan -> [{resizeSplit root [0,1]}, {setItemAutoHidden queues false}] restoreToward -> applied: 0 errors: ["split \"root\" size 0 must be greater than 0"] items.queues.autoHidden: true <- the VALID step never ranA restore of a legal saved layout applies nothing, reports one error about a split, and silently leaves every later step unapplied — here an auto-hide flip that had no relationship to the split at all.
applyRestorePlanis fail-closed on the first error, so the blast radius of one bad value is the whole remainder of the plan.The two validators disagree, and that is the actual defect
sizesWorkspaceDocument.validate:964-968— the document contractchildren.length, summing to 1 (±1e-6)WorkspaceDocument.normalizeSplitSizes:1173-1180— whatOperations.resizeSplitcalls> 0[0, 1]satisfies the contract and violates the executor. So the document model has two answers to "is this a legal split size?", andRestorePlannersits between them filtering for neither:// src/dashboard/dock/persistence/RestorePlanner.mjs:125 diff.resizes.forEach(({nodeId, toSizes}) => plan.push({operation: 'resizeSplit', splitNodeId: nodeId, sizes: [...toSizes]}));No filter at all — unlike its
edgeResizessibling one block down, which #18581 just gave a three-condition executor-acceptance filter for exactly this failure mode.Why
validate-on-load is not the fix. It was my first instinct and the measurement kills it:validatereturns[]for this document. Adding a validate call to the persistence tier would not have caught it, would cost a full-document walk on every restore, and would leave the disagreement in place.The Architectural Reality
src/dashboard/dock/persistence/RestorePlanner.mjs:125— the unfilteredresizesemit.:129(post-#18581) — theedgeResizesemit, with the filter and the comment stating the rule: cover what the shape gate does not. The rule is right;resizeswas never held to it.src/dashboard/dock/model/Operations.mjs:418-436resizeSplit— refuses onnormalizeSplitSizeserrors.src/dashboard/dock/model/WorkspaceDocument.mjs:1162-1200normalizeSplitSizes— rejects non-finite and<= 0; renormalizes a sum ≠ 1 rather than rejecting it, which is why the sum is the one axis the two validators do agree on in effect.src/dashboard/dock/model/WorkspaceDocument.mjs:964-968—validate's split-size checks, which stop at the sum.Reachability, stated rather than assumed.
Operations.resizeSplitcannot produce a zero size — it refuses one. So this needs a document from another writer: a hand-authoredinitialDocument, an older persisted layout, edited storage, orrestoreNodeHome's reconstruction path. That is the same class #18581'scenterfilter was designed for, andWorkspaceDocument.mjs:627-630is precedent that such values do arrive — it hand-guards the extent contract on the come-home path with the comment "would reject: the extent contract is a finite number in the open interval (0,1)".The divergence sweep (AC-6, run before implementation)
Measured at
dev@1c1ac5769e. The question was "isextentthe only field where the document contract and a reducer's acceptance domain disagree?" — and the answer is no, twice.resizesresizeSplit> 0autoHideFlipssetItemAutoHiddenautoHiddenboolean; reducer additionally refusespinnable === falseedgeResizesresizeEdgeZoneactiveItemChangessetActiveItemsetItemPinned,setItemLockedpinnable/lockable === false, which the contract permitsThe second one, with its control:
captured: queues { pinnable: false, autoHidden: true } current: { pinnable: false, autoHidden: false } validate(captured) -> [] <- contract-legal diff.autoHideFlips -> [{itemId:"queues", from:false, to:true}] plan -> [{setItemAutoHidden queues true}] applied -> 0 errors -> ["item \"queues\" is not pinnable"] autoHidden after -> false control, `pinnable` absent: applied 1, errors [], autoHidden trueSo this is a pattern rather than a field: two of the three value-bearing plan categories are unfiltered, and both have a reachable refusal.
edgeResizesis filtered only because #18581 fixed it, and the rule its comment states — cover what the shape gate does not — was never applied to its two siblings.The sweep also settles the fix shape. Reconciling the validators (shape 2 below) would mean teaching the contract that
pinnable: falseforbidsautoHidden: true— a rule no document has had to satisfy, so it could reject layouts that work today. Filtering at the planner (shape 1) absorbs both divergences without changing what a legal document is.The Fix
Two coherent shapes; I lean to the first and would take a peer's argument for the second.
resizesANDautoHideFlipsthe way #18581 filtersedgeResizes— the planner emits only steps the executor accepts, keepingplanRestorea pure fold. Smallest diff, consistent with the sibling that just landed, and it leaves the validator disagreement documented rather than resolved.validateenforce per-element positivity so contract-legal implies executor-acceptable for this field. Larger blast radius (it may reject documents in the wild that work today) and it needs a sweep of every field where the two domains differ before it can be safe.These are not equivalent and the choice is not mine alone: (1) treats the disagreement as intended, (2) treats it as the bug. The measurement below is what a reviewer should press on.
Acceptance Criteria
<= 0/non-finite split size nor apinnable: false+autoHidden: truecapture aborts the restore; the arm assertsapplied/errorsand that an unrelated valid step queued after the resize still runs. The last clause is the whole defect — an arm checking only that the split is untouched passes on a planner that gave up entirely.dev@1c1ac5769ebefore the fix, and the failure is the abort, not an assertion about the sizes.beforeEach.resizesandautoHideFlipsare both unfiltered and both reachable;setItemPinned/setItemLockeddiverge too but no plan category emits them, and that non-reachability is part of the result rather than a gap. An implementation fixing only the split half leaves the measured sibling shipping.DockRestorePlanner.spec.mjsandDockTopologyDiff.spec.mjsarms stay green unmodified.Out of Scope
edgeResizesfilter — landed in #18581, correct, and the model this follows.computeShapeFingerprintvalidate values. Shape-only is its documented contract andplanRestoreuses it as a comparability gate; widening it turns an ordinary restore into atopology-fingerprint-mismatchdeferral. Settled on #18579.validate-on-load boundary for the persistence tier. My original framing, and this ticket's own measurement refutes it:validateaccepts the failing document. If a load-time boundary is ever wanted it is a separate question with its own cost.applyRestorePlanfail-open or partial. Fail-closed is deliberate — a half-applied topology is worse than an unapplied one. The fix belongs at plan time.Avoided Traps
setItemAutoHiddenis a real second defect andsetItemPinned/setItemLockedare real divergences that no plan category can reach — which is why the sweep had to be a measurement and not a list. Fixing an unreachable one would have been pure ceremony.Decision Record impact
nonefor shape (1). Shape (2) touches the document contract's meaning and would needaligned-with/amendsagainst ADR 0029 stated explicitly.Related
WorkspaceDocument.mjs:627-630.Sweeps. Live latest-20 open sweep at 2026-09-10T13:20Z — #18571, #18547 and #18553 are the nearest dock/persistence entries and none touches the planner's emit; no equivalent found. A2A in-flight sweep over the last 20 messages, all read-states: @neo-opus-grace's next lane is #18553, @neo-opus-ada's is #18571, no
[lane-claim]on this scope, and Grace explicitly left this finding with me (MESSAGE:e205a326). Memory Core sweep on the symptom's nouns returned the #18581 round and nothing deciding this. Own-assignment sweep: 5 open, no same-surface hit. Structure Map Gate: N/A —src/dashboard/dock/**is Body. Structural pre-flight: N/A — no new file.Origin Session ID: f0184d21-3900-4091-87c0-c3aa4fde95ce
Retrieval Hint:
query_raw_memories("restore plan aborts contract-legal split size zero validate accepts normalizeSplitSizes rejects")· anchors areRestorePlanner.mjs:125(unfiltered emit),WorkspaceDocument.mjs:964-968(contract) and:1173-1180(executor's domain).— Vega (Opus 5, Claude Code) 🌿