Context
Found while attributing a unit flake on neo #19825 (run 38948640859, job 117135130702, at 07b3c818d1). ViewLoadingReprojection.spec.mjs › "the expected teardown cancellation is consumed silently" records every console.error for 50 ms and expects none. It caught vdom update wedged: "cmp-scroll-1". That id belongs to the functional MockComponent of unit/functional/ScrollState.spec.mjs, which that spec destroys in its afterEach. A destroyed component's wedge watchdog fired into another spec's window. The same PR had an earlier red in this spec at :159.
A local unit probe on dev eedc33c3dd registers a flight that never replies, then destroys the component:
| component destroyed mid-flight |
after destroy() |
120 ms later (threshold 50 ms) |
its parent's next update, 400 ms later |
component.Base (control) |
in-flight entry and watchdog released; gone from the parent's descendantInFlightMap |
no error |
resolved |
functional.component.Base |
in-flight entry and watchdog still set; still in the parent's map |
vdom update wedged: "neo-functional-component-1" |
still pending |
The Problem
Destroying a functional component during its VDOM flight leaves the flight registered. The dead component then:
- gets reported as wedged by the watchdog, a false alarm and a cross-spec flake source;
- stays in each ancestor's
descendantInFlightMap, so an ancestor's next update yields to it and never settles. In an app, the parent container stops updating.
The Architectural Reality
VdomLifecycle registers flights through VDomUpdate.registerInFlightUpdate. component.Abstract mixes it in for both component families: component.Base and functional.component.Base both extend Abstract.
- #14923 (#14911) made destruction "a complete render-flight cancellation boundary" with three calls:
rejectCallbacks(id, Neo.isDestroyed), unregisterInFlightUpdate(id) and triggerPostUpdates(id). It placed them in component.Base#destroy (src/component/Base.mjs:1415–1426), so the functional family never got them. Abstract#destroy (src/component/Abstract.mjs:361–366) has none.
unregisterInFlightUpdate is also what clears the watchdog timer and removes the id from every parent's descendantInFlightMap (src/manager/VDomUpdate.mjs:702–720).
- Design authority: #14911 / #14923, and
component.Base#destroy's own comment ("a lingering one makes every ancestor update yield to it forever").
The Fix
- Move the boundary, its three calls and their comment, from
component.Base#destroy to the top of component.Abstract#destroy, the class that mixes in VdomLifecycle.
component.Base keeps its order: its own teardown, then super.destroy(), which now runs the boundary before Abstract's DOM-event and registry teardown, as before.
functional.component.Base#destroy reaches it through super.destroy().
- Lines move; no line is added beyond the move.
Acceptance Criteria
Out of Scope
ViewLoadingReprojection.spec.mjs's capture window, which accepts any console.error in the worker. With this fix the dead component no longer writes there, but the window stays broad; a separate hygiene question.
- Why
ScrollState.spec.mjs leaves a flight open at teardown: a test needs to be able to destroy a component mid-flight.
Related
#14911 · #14923 · #12946 (the watchdog) · neo #19825 (sighting)
Decision Record impact: none.
Live latest-open sweep: latest 20 open issues at 18:58Z, no equivalent; gh search issues "functional destroy flight" (open) found nothing. A2A sweep: the latest 30 messages, all read states; no claim on this scope. MC sweep: one query on the symptom; #14923's record placed the boundary in component.Base and records no decision about functional components. Own-assignment sweep: no open ticket of mine on this surface.
Origin Session ID: ac1f92da-06ba-4c59-8e6e-25a2d1397d69
Retrieval Hint: "functional component destroy in-flight vdom update watchdog wedged ancestor yields"
Context
Found while attributing a unit flake on neo #19825 (run 38948640859, job 117135130702, at
07b3c818d1).ViewLoadingReprojection.spec.mjs› "the expected teardown cancellation is consumed silently" records everyconsole.errorfor 50 ms and expects none. It caughtvdom update wedged: "cmp-scroll-1". That id belongs to the functionalMockComponentofunit/functional/ScrollState.spec.mjs, which that spec destroys in itsafterEach. A destroyed component's wedge watchdog fired into another spec's window. The same PR had an earlier red in this spec at:159.A local unit probe on
deveedc33c3ddregisters a flight that never replies, then destroys the component:destroy()component.Base(control)descendantInFlightMapfunctional.component.Basevdom update wedged: "neo-functional-component-1"The Problem
Destroying a functional component during its VDOM flight leaves the flight registered. The dead component then:
descendantInFlightMap, so an ancestor's next update yields to it and never settles. In an app, the parent container stops updating.The Architectural Reality
VdomLifecycleregisters flights throughVDomUpdate.registerInFlightUpdate.component.Abstractmixes it in for both component families:component.Baseandfunctional.component.Baseboth extendAbstract.rejectCallbacks(id, Neo.isDestroyed),unregisterInFlightUpdate(id)andtriggerPostUpdates(id). It placed them incomponent.Base#destroy(src/component/Base.mjs:1415–1426), so the functional family never got them.Abstract#destroy(src/component/Abstract.mjs:361–366) has none.unregisterInFlightUpdateis also what clears the watchdog timer and removes the id from every parent'sdescendantInFlightMap(src/manager/VDomUpdate.mjs:702–720).component.Base#destroy's own comment ("a lingering one makes every ancestor update yield to it forever").The Fix
component.Base#destroyto the top ofcomponent.Abstract#destroy, the class that mixes inVdomLifecycle.component.Basekeeps its order: its own teardown, thensuper.destroy(), which now runs the boundary beforeAbstract's DOM-event and registry teardown, as before.functional.component.Base#destroyreaches it throughsuper.destroy().Acceptance Criteria
VdomDestroyCancellation.spec.mjs, red ondev.dev: pending.component.Base's existing cancellation arms stay green and unchanged, and the promises parked on a functional flight settle with the destroy sentinel.Out of Scope
ViewLoadingReprojection.spec.mjs's capture window, which accepts anyconsole.errorin the worker. With this fix the dead component no longer writes there, but the window stays broad; a separate hygiene question.ScrollState.spec.mjsleaves a flight open at teardown: a test needs to be able to destroy a component mid-flight.Related
#14911 · #14923 · #12946 (the watchdog) · neo #19825 (sighting)
Decision Record impact: none.
Live latest-open sweep: latest 20 open issues at 18:58Z, no equivalent;
gh search issues "functional destroy flight"(open) found nothing. A2A sweep: the latest 30 messages, all read states; no claim on this scope. MC sweep: one query on the symptom; #14923's record placed the boundary incomponent.Baseand records no decision about functional components. Own-assignment sweep: no open ticket of mine on this surface.Origin Session ID: ac1f92da-06ba-4c59-8e6e-25a2d1397d69
Retrieval Hint: "functional component destroy in-flight vdom update watchdog wedged ancestor yields"