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
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")
Context
Discovered by the #15783 workers:4 measurement (PR #15784, run 30081818399 attempt 1):
unit/selection/GalleryInternalId.spec.mjs:88flaked, and its retry trace shows a foreign fixture executing inside it —SortZone.spec.mjsassignsNeo.applyDeltas = (windowId, deltas) => {…}(line ~280) capturing its localappliedDeltasarray, and never restores the original. Playwright reuses a worker process across spec files, so any later spec in the same worker that triggersNeo.applyDeltasexecutes 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: 1too — it is merely masked by the stable single-worker file ordering. Any reordering (new specs, sharding, parallelism,--grepruns) can re-pair the leak with a victim. Underworkers: 4it 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 theNeonamespace).Neo.applyDeltas(e.g.unit/selection/GalleryInternalId.spec.mjs).fsModule, injected services) — a global namespace patch withoutfinally-restore is the anti-pattern.The Fix
In
SortZone.spec.mjs: capture the originalNeo.applyDeltasbefore override and restore it intest.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 otherNeo.<fn> =assignments without a paired restore.Acceptance Criteria
SortZone.spec.mjsrestores the originalNeo.applyDeltasafter each test (or its describe block).test/playwright/unit/**for unrestoredNeo.*global assignments is recorded on this ticket (fix-in-place any further instances found).GalleryInternalId.spec.mjsno longer shows the foreign stack under a reordered/parallel run (verifiable locally with--workers=4).Out of Scope
Related
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")