Context
dev is red on the unit job and it blocks every open PR. First seen on #18174, which is unrelated to the cause.
The failing arm is mine, from #18152:
DockOperationChangeClass.spec.mjs:47
every operation in the dispatch table carries a change class
+ Array [ "restoreTab" ]
This is the guard working, not a flake. Its own comment states the contract it just enforced: "a new operation added to dispatch without a class fails here rather than silently degrading." restoreTab landed in operationHandlers via #18164 / PR #18165 (5e67e5e486) while operationChangeClass was written before that operation existed.
The Problem
Operations.operationHandlers and Operations.operationChangeClass are siblings that must stay in step. The dispatch table derives the exported vocabulary from its own keys, so those two "cannot diverge by construction" — but a sibling map cannot inherit that guarantee, which is exactly why #18152 shipped the completeness arm as the enforcement instead.
Without an entry, changeClassFor('restoreTab') falls through to topology — the safe default, so runtime behaviour is correct today. The red is the guard refusing to let the map drift silently, which is the behaviour it was built for.
The Fix
Declare restoreTab: 'topology' beside its reducer.
Verified against the reducer rather than inferred from the name: Operations.restoreTab delegates to addTab when the target node still exists, and otherwise mints a new node — doc.nodes[nodeId] = {activeItemId: itemId, items: [itemId], type: 'tabs'}, with Document.genId when the id collides. Creating a node is a structural change, so topology is correct on both branches; addTab is itself topology.
Acceptance Criteria
Out of Scope
- Making the two maps structurally inseparable. Merging the class into
operationHandlers entries would change the dispatch table's shape and every reader of it — a real design question, and not one to answer while dev is red. See Related.
Avoided Traps
- Weakening the arm to unblock CI. The arm is the only thing keeping the maps in step; relaxing it would trade a red build for a silent drift, which is the failure it exists to prevent.
- Guessing the class from the operation's name.
restoreTab sounds like a sibling of addTab and is — but only on one of its two branches; the other creates a node, and that is what makes topology right rather than merely plausible.
Related
Origin Session ID: 7596538d-5324-419a-b043-95c585d833ea
Retrieval Hint: restoreTab operationChangeClass completeness arm red dev dispatch table sibling map drift
Context
devis red on theunitjob and it blocks every open PR. First seen on #18174, which is unrelated to the cause.The failing arm is mine, from #18152:
This is the guard working, not a flake. Its own comment states the contract it just enforced: "a new operation added to dispatch without a class fails here rather than silently degrading."
restoreTablanded inoperationHandlersvia #18164 / PR #18165 (5e67e5e486) whileoperationChangeClasswas written before that operation existed.The Problem
Operations.operationHandlersandOperations.operationChangeClassare siblings that must stay in step. The dispatch table derives the exported vocabulary from its own keys, so those two "cannot diverge by construction" — but a sibling map cannot inherit that guarantee, which is exactly why #18152 shipped the completeness arm as the enforcement instead.Without an entry,
changeClassFor('restoreTab')falls through totopology— the safe default, so runtime behaviour is correct today. The red is the guard refusing to let the map drift silently, which is the behaviour it was built for.The Fix
Declare
restoreTab: 'topology'beside its reducer.Verified against the reducer rather than inferred from the name:
Operations.restoreTabdelegates toaddTabwhen the target node still exists, and otherwise mints a new node —doc.nodes[nodeId] = {activeItemId: itemId, items: [itemId], type: 'tabs'}, withDocument.genIdwhen the id collides. Creating a node is a structural change, sotopologyis correct on both branches;addTabis itselftopology.Acceptance Criteria
Operations.changeClassFor('restoreTab')istopology, and the completeness arm is green in both directions.unitjob is green on a PR based on currentdev.restoreTabalready fell through totopology, sogetRefreshOptionsreturns the same{}before and after. Asserted, so the fix cannot be mistaken for a refresh-shape change.Out of Scope
operationHandlersentries would change the dispatch table's shape and every reader of it — a real design question, and not one to answer whiledevis red. See Related.Avoided Traps
restoreTabsounds like a sibling ofaddTaband is — but only on one of its two branches; the other creates a node, and that is what makestopologyright rather than merely plausible.Related
restoreTab.Origin Session ID: 7596538d-5324-419a-b043-95c585d833ea
Retrieval Hint:
restoreTab operationChangeClass completeness arm red dev dispatch table sibling map drift