Serves: #18304 — dock composition around existing Neo owners. Follow-up to #18500 (approved; the engine change stands).
The Problem
#18500's component fixture observes the reveal machine by replacing three of its methods on a live instance — timeout, registerAsync and unregisterAsync. The spec that consumes it therefore measures the probe rather than the machine, and the probe does not behave like what it replaced.
The engine half of #18500 is sound and is not in scope here: timeout(time, {signal}={}) is backward compatible, registerAsync/unregisterAsync have existed since trap() landed (core/Base.mjs:1216/:1226), and RevealStateMachine shrank by 53 net lines against 26 added in core.
The Architectural Reality
test/playwright/component/apps/dock-rail-retarget/app.mjs, afterSetObserveRevealWaits:
const rail = this.down({dockNodeType: 'edge-rail', dockEdge: 'right'}),
owner = rail.revealMachine, timeout = owner.timeout,
register = owner.registerAsync, unregister = owner.unregisterAsync;
owner.registerAsync = (id, reject) => { … register.call(owner, id, reject) };
owner.unregisterAsync = id => { … unregister.call(owner, id) };
owner.timeout = (delay, options) => { … timeout.call(owner, delay, options) };1. The replacement is stricter than the method it replaces.
timeout(time, {signal} = {})
owner.timeout = (delay, options) => { … }
… options.signal.aborted … RevealStateMachine.mjs:234 currently always passes {signal: controller.signal}, so this does not throw today. But any future timeout(delay) call inside the machine — which the engine contract explicitly permits — throws a TypeError only under the fixture. A spec that fails for a reason production cannot produce is worse than no spec, because the failure looks like a real defect.
2. It replaces the method under test. DockRailRevealRetarget.spec.mjs enables the probe and then asserts on wait behaviour, so the assertions run against the wrapper. A wrapper that forwards correctly today is still an object the test author must keep in sync with the engine by hand, and nothing fails when it drifts.
3. No teardown. revealWaitProbe guards re-entry, but the three methods are never restored. The instance carries the wrappers for the rest of its life.
Explicitly not the target: the unit specs swap globalThis.setTimeout and do restore it — BaseTimeout.spec.mjs:39, DockRail.spec.mjs:85, DockRevealStateMachine.spec.mjs:28/:174, with finally blocks and afterEach hooks. That is ordinary fake-timer practice and is fine.
The Fix
Amended 2026-09-12 — this section's original premise was false, and the amendment is the author's, not the claimer's. It opened "the engine already exposes the registration pair the probe wants to count, so the receipt can be read rather than intercepted" and ranked three bullets by that. @neo-opus-vega measured every route at intake and none is open; row 1 falsifies the premise directly. I wrote that sentence right after @tobiu corrected my read on registerAsync, and over-corrected a wrong detail into an absolute prohibition.
The measurement, at origin/dev a1a2a781cb. Hers, verified row by row by me at that ref rather than ratified:
| candidate |
what the source says |
usable without replacing? |
| read the async registrations directly |
core/Base.mjs:193 holds them in a private field #asyncRejects; registerAsync / unregisterAsync are its only doors |
no — private by design |
| capture the wait outcome from a returned promise |
RevealStateMachine#transition calls transitionAfter(...) without awaiting or storing it, and transitionAfter awaits me.timeout(delay, {signal}) inside a try that swallows abort and destroy |
no — nothing outside holds it |
| an existing event |
the machine fires none (fire( occurs 0 times); onChange_ is one reactive callback the Rail owns |
no — a second subscriber would replace the first |
| observe the state fields |
state, pendingItemId, revealedItemId are plain fields (:37, :39, :41), not reactive configs, so observeConfig cannot see them — and a state observer could not separate elapsed from aborted, because transition aborts the old controller on both paths before assigning |
no |
| inject a recording subclass |
Rail#createRevealMachine hardcodes Neo.create(RevealStateMachine, …) (interaction/Rail.mjs:252) with no class seam |
no — and engine API for a fixture is not what this ticket asks for |
So exact-signature wrapping is the shape, not a fallback. What the fixture owes:
- wrap only where the table above shows no non-replacing route, and say so in a comment beside the wrapper that names the reason
- mirror the wrapped signature exactly —
timeout(time, options = {}), options.signal?.aborted — so no call that works in production can fail under the fixture
- restore every original on teardown: the probe's own off-switch, the Rail's destroy, and the workspace's destroy
AC
- AC-1 (amended — the original read "the fixture no longer replaces
timeout", which contradicted this ticket's own Fix section and cannot be met: every non-replacing route is closed. Ratified on @neo-opus-vega's intake proposal, reworded by me so it stands on the table above rather than on a comment.) The fixture wraps a machine method only where the measurement table in The Fix shows no non-replacing observation point, and names that reason in a comment beside each wrapper.
- AC-2 No probe wrapper is stricter than the method it wraps. Specifically:
options defaults and options.signal is optional-chained, so a timeout(delay) call cannot fail under the fixture and pass in production.
- AC-3 Any wrapper installed is restored on teardown, so a probed instance does not carry it for its remaining lifetime.
- AC-4
DockRailRevealRetarget.spec.mjs still fails when the reveal behaviour it covers regresses — verified by mutating the machine and watching the spec go red, not by the spec passing.
Out of Scope
core/Base.mjs's timeout signature and the AbortSignal support — approved on #18500 and correct. RevealStateMachine's refactor. The unit specs' globalThis.setTimeout swapping, which restores properly.
Avoided Traps
Do not delete the probe and call it fixed: it exists because the reveal waits needed a witness, and #18500's evidence rests on it. Do not verify the replacement by the spec passing — AC-4 requires a mutation showing it can still fail. Do not widen this into the unit specs' fake timers; they are correct.
Decision Record impact
none — test-fixture instrumentation, no contract change.
Sweeps and ownership
Live latest-open sweep run before filing; no ticket covers fixture instrumentation. Measured against pull/18500/head.
Raised by @tobiu ("the tests still feel odd") after correcting my read on registerAsync. Filed by @neo-opus-grace.
Serves:#18304 — dock composition around existing Neo owners. Follow-up to #18500 (approved; the engine change stands).The Problem
#18500's component fixture observes the reveal machine by replacing three of its methods on a live instance —timeout,registerAsyncandunregisterAsync. The spec that consumes it therefore measures the probe rather than the machine, and the probe does not behave like what it replaced.The engine half of #18500 is sound and is not in scope here:
timeout(time, {signal}={})is backward compatible,registerAsync/unregisterAsynchave existed sincetrap()landed (core/Base.mjs:1216/:1226), andRevealStateMachineshrank by 53 net lines against 26 added in core.The Architectural Reality
test/playwright/component/apps/dock-rail-retarget/app.mjs,afterSetObserveRevealWaits:const rail = this.down({dockNodeType: 'edge-rail', dockEdge: 'right'}), owner = rail.revealMachine, timeout = owner.timeout, register = owner.registerAsync, unregister = owner.unregisterAsync; owner.registerAsync = (id, reject) => { … register.call(owner, id, reject) }; owner.unregisterAsync = id => { … unregister.call(owner, id) }; owner.timeout = (delay, options) => { … timeout.call(owner, delay, options) };1. The replacement is stricter than the method it replaces.
timeout(time, {signal} = {}) // engine: options defaults owner.timeout = (delay, options) => { … } // fixture: no default … options.signal.aborted … // no optional chainingRevealStateMachine.mjs:234currently always passes{signal: controller.signal}, so this does not throw today. But any futuretimeout(delay)call inside the machine — which the engine contract explicitly permits — throws a TypeError only under the fixture. A spec that fails for a reason production cannot produce is worse than no spec, because the failure looks like a real defect.2. It replaces the method under test.
DockRailRevealRetarget.spec.mjsenables the probe and then asserts on wait behaviour, so the assertions run against the wrapper. A wrapper that forwards correctly today is still an object the test author must keep in sync with the engine by hand, and nothing fails when it drifts.3. No teardown.
revealWaitProbeguards re-entry, but the three methods are never restored. The instance carries the wrappers for the rest of its life.Explicitly not the target: the unit specs swap
globalThis.setTimeoutand do restore it —BaseTimeout.spec.mjs:39,DockRail.spec.mjs:85,DockRevealStateMachine.spec.mjs:28/:174, withfinallyblocks andafterEachhooks. That is ordinary fake-timer practice and is fine.The Fix
Amended 2026-09-12 — this section's original premise was false, and the amendment is the author's, not the claimer's. It opened "the engine already exposes the registration pair the probe wants to count, so the receipt can be read rather than intercepted" and ranked three bullets by that. @neo-opus-vega measured every route at intake and none is open; row 1 falsifies the premise directly. I wrote that sentence right after @tobiu corrected my read on
registerAsync, and over-corrected a wrong detail into an absolute prohibition.The measurement, at
origin/deva1a2a781cb. Hers, verified row by row by me at that ref rather than ratified:core/Base.mjs:193holds them in a private field#asyncRejects;registerAsync/unregisterAsyncare its only doorsRevealStateMachine#transitioncallstransitionAfter(...)without awaiting or storing it, andtransitionAfterawaitsme.timeout(delay, {signal})inside atrythat swallows abort and destroyfire(occurs 0 times);onChange_is one reactive callback the Rail ownsstate,pendingItemId,revealedItemIdare plain fields (:37,:39,:41), not reactive configs, soobserveConfigcannot see them — and a state observer could not separate elapsed from aborted, becausetransitionaborts the old controller on both paths before assigningRail#createRevealMachinehardcodesNeo.create(RevealStateMachine, …)(interaction/Rail.mjs:252) with no class seamSo exact-signature wrapping is the shape, not a fallback. What the fixture owes:
timeout(time, options = {}),options.signal?.aborted— so no call that works in production can fail under the fixtureAC
timeout", which contradicted this ticket's own Fix section and cannot be met: every non-replacing route is closed. Ratified on @neo-opus-vega's intake proposal, reworded by me so it stands on the table above rather than on a comment.) The fixture wraps a machine method only where the measurement table in The Fix shows no non-replacing observation point, and names that reason in a comment beside each wrapper.optionsdefaults andoptions.signalis optional-chained, so atimeout(delay)call cannot fail under the fixture and pass in production.DockRailRevealRetarget.spec.mjsstill fails when the reveal behaviour it covers regresses — verified by mutating the machine and watching the spec go red, not by the spec passing.Out of Scope
core/Base.mjs'stimeoutsignature and theAbortSignalsupport — approved on #18500 and correct.RevealStateMachine's refactor. The unit specs'globalThis.setTimeoutswapping, which restores properly.Avoided Traps
Do not delete the probe and call it fixed: it exists because the reveal waits needed a witness, and #18500's evidence rests on it. Do not verify the replacement by the spec passing — AC-4 requires a mutation showing it can still fail. Do not widen this into the unit specs' fake timers; they are correct.
Decision Record impact
none— test-fixture instrumentation, no contract change.Sweeps and ownership
Live latest-open sweep run before filing; no ticket covers fixture instrumentation. Measured against
pull/18500/head.Raised by @tobiu ("the tests still feel odd") after correcting my read on
registerAsync. Filed by @neo-opus-grace.