LearnNewsExamplesServices
Frontmatter
id15789
titleSortZone spec leaks a global Neo.applyDeltas override across spec files
stateClosed
labels
bugaitesting
assigneesneo-opus-ada
createdAtJul 24, 2026, 11:24 AM
updatedAtJul 24, 2026, 2:46 PM
githubUrlhttps://github.com/neomjs/neo/issues/15789
authorneo-opus-vega
commentsCount6
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtJul 24, 2026, 2:33 PM

SortZone spec leaks a global Neo.applyDeltas override across spec files

Closed Backlog/active-chunk-9 bugaitesting
neo-opus-vega
neo-opus-vega commented on Jul 24, 2026, 11:24 AM

Context

Discovered by the #15783 workers:4 measurement (PR #15784, run 30081818399 attempt 1): unit/selection/GalleryInternalId.spec.mjs:88 flaked, and its retry trace shows a foreign fixture executing inside it —

at Object.applyDeltas (test/playwright/unit/draggable/dashboard/SortZone.spec.mjs:281:27)
at Gallery.onSelectionChange (src/component/Gallery.mjs:642:13)
at test/playwright/unit/selection/GalleryInternalId.spec.mjs:106:23

SortZone.spec.mjs assigns Neo.applyDeltas = (windowId, deltas) => {…} (line ~280) capturing its local appliedDeltas array, and never restores the original. Playwright reuses a worker process across spec files, so any later spec in the same worker that triggers Neo.applyDeltas executes SortZone's override against SortZone's dead fixture state.

The Problem

This is a correctness defect independent of the workers decision: the bleed exists under workers: 1 too — it is merely masked by the stable single-worker file ordering. Any reordering (new specs, sharding, parallelism, --grep runs) can re-pair the leak with a victim. Under workers: 4 it surfaced immediately as a retry-healed flake.

The Architectural Reality

  • test/playwright/unit/draggable/dashboard/SortZone.spec.mjs:280-284 — the unrestored global override (module/worker-scoped mutation of the Neo namespace).
  • Victim class: any spec sharing the worker afterwards whose components call Neo.applyDeltas (e.g. unit/selection/GalleryInternalId.spec.mjs).
  • House rule elsewhere in the suite is fixture-scoped seams (injected fsModule, injected services) — a global namespace patch without finally-restore is the anti-pattern.

The Fix

In SortZone.spec.mjs: capture the original Neo.applyDeltas before override and restore it in test.afterEach/afterAll (or wrap per-test with try/finally). Sweep the unit tree for the same pattern while there: grep -rn "Neo\.applyDeltas\s*=" test/playwright/unit/ plus any other Neo.<fn> = assignments without a paired restore.

Acceptance Criteria

  • SortZone.spec.mjs restores the original Neo.applyDeltas after each test (or its describe block).
  • A sweep of test/playwright/unit/** for unrestored Neo.* global assignments is recorded on this ticket (fix-in-place any further instances found).
  • GalleryInternalId.spec.mjs no longer shows the foreign stack under a reordered/parallel run (verifiable locally with --workers=4).

Out of Scope

  • The workers-4 CI decision itself (#15783) and the profiling-budget parallel-compat work (sibling ticket).

Related

  • #15783 (the measurement that exposed it) · PR #15784 run 30081818399 attempt 1 (evidence trace).

Decision Record impact: none.

Release classification: not release-blocking (test-suite correctness; boardless).

Live latest-open sweep: checked latest 20 open issues at 2026-07-24T09:24Z; no equivalent found. A2A claim sweep: no overlapping claims (recent: #15785/#15786/#15787 — disjoint).

Origin Session ID: 2cca0fff-6354-4036-bfdd-fc3320938015

Retrieval Hint: query_raw_memories("SortZone global applyDeltas bleed cross-file worker reuse")