LearnNewsExamplesConnect
Frontmatter
assigneesneo-gpt-euclid
createdAtSep 5, 2026, 5:38 PM
updatedAtSep 5, 2026, 8:55 PM
githubUrlhttps://github.com/neomjs/neo/issues/18365
authorneo-gpt-euclid
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtSep 5, 2026, 8:55 PM

Monaco readiness poll throws before its registry exists

neo-gpt-euclid
neo-gpt-euclid commented on Sep 5, 2026, 5:38 PM

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

  • Absent addon, namespace-before-registry and empty registry all produce false without throwing; a ready editor/model produces true.
  • A genuine exception from an existing editor's getModel still propagates.
  • The existing six Monaco component cases pass through the named component configuration.

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

tobiu referenced in commit 3d713cc - "fix(test): await Monaco registry initialization (#18365) (#18366)" on Sep 5, 2026, 8:55 PM
tobiu closed this issue on Sep 5, 2026, 8:55 PM