LearnNewsExamplesServices
Frontmatter
id18785
titleA unit arm asserts DragCoordinator.sortZones is empty, under 4 workers
stateClosed
labels
bugaitesting
assigneesneo-opus-ada
createdAtSep 16, 2026, 1:26 PM
updatedAtSep 16, 2026, 1:41 PM
githubUrlhttps://github.com/neomjs/neo/issues/18785
authorneo-opus-ada
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtSep 16, 2026, 1:41 PM

A unit arm asserts DragCoordinator.sortZones is empty, under 4 workers

neo-opus-ada
neo-opus-ada commented on Sep 16, 2026, 1:26 PM

Context

test/playwright/unit/dashboard/CrossWindowDragTarget.spec.mjs:54 — "an incomplete registry identity never registers (§2.3: sortGroup + windowId are mandatory)" — reds the unit job intermittently, on branches that touch none of the code it exercises. Today alone it has carried a red on #18783 (a menu change), #18773 ×2 (a grid change) and #18784's branch, and a same-SHA rerun on #18773 reproduced it rather than clearing it.

The job is right to go red. test/playwright/playwright.config.unit.mjs:28 sets failOnFlakyTests: isCI beside retries: 2 — a flake that retries green still fails CI, which is the policy that keeps flakes from becoming background noise. Nothing here proposes changing that; the arm is what needs fixing.

Measured while shipping #18781, twelve full-suite runs on one branch and eight on dev source in the same worktree:

condition result
the spec alone, either head 3/3 green
full suite, dev source 0 failures in 8 runs
full suite, an engine branch 3 failures in 12 runs, clustered in one window

Not attributable to any diff. The arm is order- and load-dependent, which is exactly what asserting a shared global under parallel workers produces.

The Problem

const target = Neo.create(CrossWindowDragTarget, {windowId: 3});

expect(DragCoordinator.sortZones.size).toBe(0);

DragCoordinator is a singleton and sortZones is its process-global registry. playwright.config.unit.mjs runs fullyParallel: true with workers: 4, so each worker process runs many spec files in one shared module registry — and the arm's claim is not about the component it just created, it is about everything in that process. Any spec sharing the worker that registers a sort zone and has not yet destroyed it makes the assertion false, without either spec being wrong.

The intent is narrow and correct: a target created without sortGroup must not register. The assertion is global, and that is the whole defect.

The Architectural Reality

The same file already shows the shape that survives parallelism, one arm earlier:

site claim parallel-safe
CrossWindowDragTarget.spec.mjs:31 sortZones.has('dock-main') is false after destroy yes — names the group this arm created
manager/DragCoordinator.spec.mjs:154, :236 sortZones.has('dock') is false yes — same shape
CrossWindowDragTarget.spec.mjs:59 sortZones.size is 0 no — a claim about every other spec in the worker

One greppable rule covers it: an arm may assert the groups it created; it may not assert that the map is empty.

  • src/manager/DragCoordinator.mjs — sortZones, the singleton registry.
  • src/dashboard/dock/window/DragTarget.mjs:411 — destroy() unregisters only when sortGroup && windowId != null, which is what the arm is really checking.

The Fix

Assert the negative the arm means: after creating a target with windowId and no sortGroup, no group in the registry holds that target. [...sortZones.values()].some(byWindow => [...byWindow.values()].includes(target)) is false — true regardless of what else shares the worker, and still false-able by the defect it guards (a target that registers without a sortGroup appears in exactly one group).

Deliberately not proposed: changing failOnFlakyTests, adding a beforeEach that clears the singleton (it would hide a real leak from a sibling spec and make the suite order-dependent in the other direction), or serialising the unit project.

Acceptance Criteria

  • AC-1 — the arm asserts that no registry group holds the target it created, and makes no claim about the registry's size.
  • AC-2 — red-first: with DragTarget#destroy's registration guard removed (or a sortGroup added to the arm's config), the rewritten arm fails. An arm that cannot fail is what the size assertion degenerated into.
  • AC-3 — a seeded sibling registration in the same worker does not fail the arm, and does fail the current one. This is the contamination the ticket exists for, so it is measured rather than argued.
  • AC-4 — the full unit suite runs clean ×5 consecutively on this branch; the pre-fix rate measured 3 in 12.
  • AC-5 — a census of sortZones.size / equivalent global-emptiness assertions across test/playwright/unit is recorded here, and any second instance is fixed with it or filed.

Out of Scope

  • unit/list/animatePlugin.spec.mjs:551, the other arm reddening the same job — @neo-opus-grace's defect-note, hers to file.
  • failOnFlakyTests and the retry policy — deliberate, and this ticket depends on them staying that way.
  • unit/main/DomEvents.spec.mjs's namespace restoration — #18776, the same family from the other side (state left behind rather than state assumed absent).

Avoided Traps

  • Clearing the singleton in a hook. It would green the arm and hide a sibling's leak in the same motion, which is how a suite stops being able to report contamination at all.
  • Blaming the last diff that reddened. Twelve runs against eight say it is neither; a flake that follows the branch you happen to be on is a scheduling artifact, not evidence.
  • Serialising the project. The parallelism is the point of a 4200-arm suite finishing in 23 seconds; one arm's global claim does not get to spend that.

Related

  • #18776 — the mirror half: a spec that leaves shared namespace state behind.
  • #18772 — the same class one tier up: a component arm that measured across two round-trips.
  • #18784 / #18781 — where the twelve-run measurement was taken.

Live latest-open sweep: checked the latest 12 open issues at 2026-09-16T11:25:20Z; no equivalent found. A2A in-flight claim sweep: coordinated directly with @neo-opus-grace, who captured the job-level note first and holds the animatePlugin arm; no competing claim on this one. Memory Core rationale sweep on the symptom nouns: returned the #18721 overflow-flake lane and no prior decision on global-state assertions. Own-assignment sweep: no same-surface hit. Structure-map gate: N/A — no .mjs created or relocated, nothing under ai/, Agent OS, MCP, Memory Core, orchestration or .agents/skills.

Decision Record impact: none.

Origin Session ID: cd67869d-cec2-4c36-99a6-aa521a73fddb

Retrieval Hint: "unit arm asserts a process-global registry is empty under parallel workers" · query_raw_memories on "an arm may assert the groups it created, never that the map is empty"

tobiu referenced in commit 99e15e2 - "test(dashboard): the registry arm asks about its own target, not about the map (#18785) (#18786) on Sep 16, 2026, 1:41 PM
tobiu closed this issue on Sep 16, 2026, 1:41 PM