Context
The Monaco component readiness helper introduced by PR #18355 failed an unrelated history PR's component job. Job 101328008490 reports 248 passed / 1 failed: the reactive-wrapper case throws Cannot read properties of undefined (reading 'monaco-test-editor') in expectEditor, before polling can wait. A later attempt is green; the premature lookup remains reproducible.
The Problem
test/playwright/component/wrapper/MonacoEditor.spec.mjs#expectEditor evaluates addon?.map[id]. The addon namespace can exist before its editor registry does. Optional chaining guards the addon, while the missing registry is still indexed.
Executing the exact callback with an absent addon returns false; with addon = {} it throws TypeError; with an empty registry it returns false; with a ready editor/model it returns true. A real getModel exception propagates.
The Architectural Reality
This is a test-observation race. The helper already owns the not-ready predicate and the bounded expect.poll; the addon, wrapper and history implementation need no behavioral change. Its existing JSDoc requires an actual native editor rather than an empty wrapper div.
The Fix
Guard the registry access within the existing predicate. Preserve the readiness/model checks and the existing poll bound. Do not catch arbitrary browser exceptions or increase retries/timeouts.
Contract Ledger
| Surface |
Authority |
Behavior |
Fallback |
Docs |
Evidence |
| expectEditor callback |
existing helper/JSDoc |
false until registry/editor/model exist and addon is ready |
genuine model errors still propagate |
existing helper summary |
direct callback state controls; existing six real component cases |
Acceptance Criteria
Out of Scope
Monaco runtime APIs, DOMPurify remediation, history semantics, new retries/timeouts and broader test-harness changes.
Avoided Traps
A blanket catch would hide a real editor failure. Re-running CI alone does not repair the callback's invalid intermediate-state assumption.
Related
#5822 · #18354 · PR #18355 · PR #18360
Decision Record impact: none. Existing test helper only; no new module or placement.
Live latest-open sweep: latest 20 issues and recent all-state A2A claims checked immediately before creation; no equivalent ticket. Emmy reported the failure and proposed this separate repair; I accepted ownership directly. All-state Monaco-readiness search found no equivalent. Memory Core symptom query returned six unrelated records. Own assignments: #18354 is sanitizer remediation, #18303 is dock topology; neither owns this helper failure. The exact callback and CI log establish the defect.
Origin Session ID: cb7ccc74-b375-4785-9adf-df6d1112957b
Retrieval Hint: Monaco expectEditor addon registry undefined premature indexing
Context
The Monaco component readiness helper introduced by PR #18355 failed an unrelated history PR's component job. Job 101328008490 reports 248 passed / 1 failed: the reactive-wrapper case throws
Cannot read properties of undefined (reading 'monaco-test-editor')inexpectEditor, before polling can wait. A later attempt is green; the premature lookup remains reproducible.The Problem
test/playwright/component/wrapper/MonacoEditor.spec.mjs#expectEditorevaluatesaddon?.map[id]. The addon namespace can exist before its editor registry does. Optional chaining guards the addon, while the missing registry is still indexed.Executing the exact callback with an absent addon returns false; with
addon = {}it throws TypeError; with an empty registry it returns false; with a ready editor/model it returns true. A realgetModelexception propagates.The Architectural Reality
This is a test-observation race. The helper already owns the not-ready predicate and the bounded
expect.poll; the addon, wrapper and history implementation need no behavioral change. Its existing JSDoc requires an actual native editor rather than an empty wrapper div.The Fix
Guard the registry access within the existing predicate. Preserve the readiness/model checks and the existing poll bound. Do not catch arbitrary browser exceptions or increase retries/timeouts.
Contract Ledger
Acceptance Criteria
getModelstill propagates.Out of Scope
Monaco runtime APIs, DOMPurify remediation, history semantics, new retries/timeouts and broader test-harness changes.
Avoided Traps
A blanket catch would hide a real editor failure. Re-running CI alone does not repair the callback's invalid intermediate-state assumption.
Related
#5822 · #18354 · PR #18355 · PR #18360
Decision Record impact: none. Existing test helper only; no new module or placement.
Live latest-open sweep: latest 20 issues and recent all-state A2A claims checked immediately before creation; no equivalent ticket. Emmy reported the failure and proposed this separate repair; I accepted ownership directly. All-state Monaco-readiness search found no equivalent. Memory Core symptom query returned six unrelated records. Own assignments: #18354 is sanitizer remediation, #18303 is dock topology; neither owns this helper failure. The exact callback and CI log establish the defect.
Origin Session ID: cb7ccc74-b375-4785-9adf-df6d1112957b Retrieval Hint:
Monaco expectEditor addon registry undefined premature indexing