LearnNewsExamplesServices
Frontmatter
id20054
titleDomAccessCanvasTransfer.spec leaves the real DomAccess to the next spec in its worker
stateClosed
labels
bugaitesting
assigneesneo-opus-ada
createdAtOct 23, 2026, 2:52 PM
updatedAtOct 23, 2026, 3:23 PM
githubUrlhttps://github.com/neomjs/neo/issues/20054
authorneo-opus-ada
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtOct 23, 2026, 3:23 PM

DomAccessCanvasTransfer.spec leaves the real DomAccess to the next spec in its worker

Closed Backlog/active-chunk-10 bugaitesting
neo-opus-ada
neo-opus-ada commented on Oct 23, 2026, 2:52 PM

Context

Found while running the full unit suite for #20045 (PR #20053). GalleryInternalId.spec failed one test in 2 of 3 local full runs at that head, with TypeError: Cannot read properties of undefined (reading 'getElementById').

  • Where it throws: DomAccess.getElement (src/main/DomAccess.mjs), reached through Gallery.afterSetMounted → Component.focus → DomAccess.focus.
  • Alone it passes: 15/15 over five repeats.
  • dev was green in 3 of 3 full runs (one run had an unrelated red). The suite is fullyParallel, so the rate depends on which specs land in one worker.

Deterministic repro on dev e2f77dd0fb, with no local changes:

npx playwright test -c test/playwright/playwright.config.unit.mjs unit/main/DomAccessCanvasTransfer.spec.mjs unit/selection/GalleryInternalId.spec.mjs --workers=1

That gives 1 failed and 6 passed. Pairing GalleryInternalId.spec the same way with each of the other six specs that import the real DomAccess passes: DomAccessAlign, DragDrop, GoogleMapsReadiness, GridRowScrollPinning, DeltaUpdatesChangeNodeName and DomEvents.

The Problem

This is #18776's class again. A unit spec replaces Neo.main.DomAccess and never restores it. A later spec in the same worker then focuses into the real main-thread singleton over a document it does not have.

CI runs the unit tier fullyParallel with 4 workers, so this can red any PR's unit job, depending on scheduling.

The Architectural Reality

  • test/playwright/unit/main/DomAccessCanvasTransfer.spec.mjs (added by #19589) does three things:
    • it deletes the setup stub when it is not the real class (Neo.main.DomAccess.className !== 'Neo.main.DomAccess');
    • it imports src/main/DomAccess.mjs, whose singleton registers itself as Neo.main.DomAccess;
    • its afterEach restores document, manager.startWorker, manager.sendMessage and Neo.config.useDomIds, but not the namespace entry.
  • test/playwright/setup.mjs installs the stub with ??=. Whatever a spec leaves under Neo.main is what every later spec in that worker gets.
  • #18776 fixed the same shape in DomEvents.spec.mjs: it captures replacedRemotes before the delete and restores them in afterAll.

The Fix

In DomAccessCanvasTransfer.spec.mjs:

  • capture Neo.main.DomAccess before the delete;
  • restore it in an afterAll, or delete it when it was undefined.

This is the DomEvents.spec.mjs pattern.

Acceptance Criteria

  • AC-1: the paired run above passes, and removing the restore makes it fail again with the same getElementById error.
  • AC-2: DomAccessCanvasTransfer.spec's own arms stay green.

Out of Scope

A suite-level guard that fails any spec leaving a Neo.main remote behind. It's worth it if a third instance appears.

Related

#18776 (same class, DomEvents.spec) · #19589 (added the spec) · #20053 (where it surfaced)

Live latest-open sweep: checked the latest 20 open issues at 12:46Z and the latest 8 at 12:52Z; no equivalent. A2A in-flight claim sweep: the latest 30 messages, no claim on this scope. Memory Core rationale sweep: #18776's fix and the DragDrop fixture repair (#19591) recovered; neither covers this spec. Own-assignment sweep: none of my open tickets touches unit isolation.

Origin Session ID: 577c5310-3173-4991-85a7-50aeabd66ceb

Handoff Retrieval Hints: "GalleryInternalId getElementById undefined real DomAccess left by an earlier spec"; defect-note fingerprint fb2577102dcdb50b.

⚖️ Ada · @neo-opus-ada · Claude Opus 5.5 · Claude Code

tobiu closed this issue on Oct 23, 2026, 3:23 PM
tobiu referenced in commit d0f92ff - "test(unit): the canvas-transfer spec gives Neo.main.DomAccess back after its import (#20054) (#20055) on Oct 23, 2026, 3:23 PM