Context
The current NL battery lists ContextMenuNL as an unowned real Engine error in #17844. Independently reproduced on dev@a186e92cfa34dcea086f991aaa037de5a4a289e3 on 2026-09-23: the existing full test/playwright/e2e/rendering/ContextMenuNL.spec.mjs reaches its final state assertions, then fails on two TypeError: Cannot read properties of undefined (reading 'includes') errors from DomEvent.verifyDelegationPath at line 649. One test failed in 2.0s; worker/page-error guards were unchanged.
The Problem
A normal context-menu journey completes placement, nested action and dismissal while event delivery throws. The error is not an expected rejected tool request: the worker's delegation reader accesses path[j].cls.includes(...) on a node without cls. Swallowing or exempting that error would leave event dispatch incomplete.
The Architectural Reality
src/main/DomEvents.mjs#getTargetData normally supplies cls: [] even for classless nodes. src/manager/DomEvent.mjs#fire routes event paths through verifyDelegationPath, which owns selector matching and physical/logical ancestor boundaries. Existing unit coverage is test/playwright/unit/manager/domEvent/Delegation.spec.mjs; the real-browser witness is the existing ContextMenu NL spec. src/main/addon/Navigator.mjs#setActiveItem deliberately emits neonavigate with path: [{id: data.id}]. The default delegate is the owning component's #id; when menu ownership bubbles the event to an ancestor, the ID mismatch incorrectly falls through to .cls.includes. No producer lost data: the selector reader mixes the ID and class branches. Two focused controls reproduce the missing-class exception and a same-named class incorrectly satisfying an ID selector.
The Fix
Use mutually exclusive ID/class comparison in DomEvent.verifyDelegationPath, and extend its existing focused coverage. Preserve selector matching and physical/logical ancestry semantics. No new file or abstraction is prescribed.
Contract Ledger
| Surface |
Authority |
Required behavior |
Fallback |
Docs |
Evidence |
DOM event path / verifyDelegationPath |
Existing main-thread event projection and worker delegation contract |
ID selectors read IDs only; valid ID-only navigation paths complete dispatch without throwing |
Unmatched delegation remains false |
Document the corrected producer/reader contract at its owner |
Focused regression and existing ancestry controls |
| Context-menu interaction |
Existing ContextMenuNL journey |
Reused menu, nested action and dismissal remain correct with no worker/page errors |
None |
Existing spec |
Whole-file browser run |
Acceptance Criteria
Out of Scope
Menu focus/navigation redesign, broad selector parsing, masking unexpected worker errors, the remaining NL battery failures.
Avoided Traps
Do not infer that every missing cls is an acceptable wire shape merely from the throwing consumer; the normal producer supplies it. Do not credit a green final menu state as complete event execution when the error channel is red.
Related
#17844. Closed #18870 changes menu focus ownership, not this reproduced exception.
Decision Record impact: none — restore the existing event-delivery contract.
Sweeps: latest 20 open issues and all-state verifyDelegationPath/DomEvent cls search checked immediately before filing; no equivalent leaf. Recent 15 A2A messages show no claim on this error. Four MC problem-framed queries found menu focus history (session 0a997d38-ccdb-4352-ac21-566606a6ab2d) but no matching repair decision. Two own Engine assignments were checked; neither overlaps. Structure map/structural pre-flight: N/A, existing Engine files only. KB queries remain operator-disabled while corpus ingestion is stale.
Origin Session ID: 9e4f2c84-9ea2-4bb3-ac93-19237406cae9
Retrieval Hint: ContextMenuNL DomEvent verifyDelegationPath cls includes missing path data
Context
The current NL battery lists
ContextMenuNLas an unowned real Engine error in #17844. Independently reproduced ondev@a186e92cfa34dcea086f991aaa037de5a4a289e3on 2026-09-23: the existing fulltest/playwright/e2e/rendering/ContextMenuNL.spec.mjsreaches its final state assertions, then fails on twoTypeError: Cannot read properties of undefined (reading 'includes')errors fromDomEvent.verifyDelegationPathat line 649. One test failed in 2.0s; worker/page-error guards were unchanged.The Problem
A normal context-menu journey completes placement, nested action and dismissal while event delivery throws. The error is not an expected rejected tool request: the worker's delegation reader accesses
path[j].cls.includes(...)on a node withoutcls. Swallowing or exempting that error would leave event dispatch incomplete.The Architectural Reality
src/main/DomEvents.mjs#getTargetDatanormally suppliescls: []even for classless nodes.src/manager/DomEvent.mjs#fireroutes event paths throughverifyDelegationPath, which owns selector matching and physical/logical ancestor boundaries. Existing unit coverage istest/playwright/unit/manager/domEvent/Delegation.spec.mjs; the real-browser witness is the existing ContextMenu NL spec.src/main/addon/Navigator.mjs#setActiveItemdeliberately emitsneonavigatewithpath: [{id: data.id}]. The default delegate is the owning component's#id; when menu ownership bubbles the event to an ancestor, the ID mismatch incorrectly falls through to.cls.includes. No producer lost data: the selector reader mixes the ID and class branches. Two focused controls reproduce the missing-class exception and a same-named class incorrectly satisfying an ID selector.The Fix
Use mutually exclusive ID/class comparison in
DomEvent.verifyDelegationPath, and extend its existing focused coverage. Preserve selector matching and physical/logical ancestry semantics. No new file or abstraction is prescribed.Contract Ledger
verifyDelegationPathContextMenuNLjourneyAcceptance Criteria
Out of Scope
Menu focus/navigation redesign, broad selector parsing, masking unexpected worker errors, the remaining NL battery failures.
Avoided Traps
Do not infer that every missing
clsis an acceptable wire shape merely from the throwing consumer; the normal producer supplies it. Do not credit a green final menu state as complete event execution when the error channel is red.Related
#17844. Closed #18870 changes menu focus ownership, not this reproduced exception.
Decision Record impact: none — restore the existing event-delivery contract.
Sweeps: latest 20 open issues and all-state
verifyDelegationPath/DomEvent clssearch checked immediately before filing; no equivalent leaf. Recent 15 A2A messages show no claim on this error. Four MC problem-framed queries found menu focus history (session 0a997d38-ccdb-4352-ac21-566606a6ab2d) but no matching repair decision. Two own Engine assignments were checked; neither overlaps. Structure map/structural pre-flight: N/A, existing Engine files only. KB queries remain operator-disabled while corpus ingestion is stale.Origin Session ID: 9e4f2c84-9ea2-4bb3-ac93-19237406cae9 Retrieval Hint: ContextMenuNL DomEvent verifyDelegationPath cls includes missing path data