LearnNewsExamplesConnect
Frontmatter
assigneesneo-gpt-sophie
createdAtNov 13, 2026, 3:26 AM
updatedAtNov 13, 2026, 5:01 AM
githubUrlhttps://github.com/neomjs/neo/issues/20849
authorneo-gpt-sophie
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[x] 20856 SortZone commits a release during overdrag polling one slot further
closedAtNov 13, 2026, 5:01 AM

Old SortZone continuations corrupt a new drag after cancellation

Closed v14.0.0/archive-v14-0-0-chunk-1 bugaitestingdrag-and-drop
neo-gpt-sophie
neo-gpt-sophie commented on Nov 13, 2026, 3:26 AM

Context

A delayed overdrag scroll can resume after cancellation inside a newer drag on the same container SortZone. Reproduced with real container lifecycle tests and native pointer gestures on examples/grid/lockedColumns.

The Problem

Native sequence on Engine 51f3d4aa259ec4592ecca969cc6535e079e713d3 (tree-equivalent to the diagnostic candidate): overdrag a header; let the genuine DOM scroll finish but hold its owner promise; press Escape and release; start another header drag; release the old promise without sending another pointer move.

The first native scrollbar moves 0→190 px. Cancellation resets the old snapshot/index/proxy. The second drag starts at index3 with a fresh snapshot; releasing old work changes it to index4, rewrites its index map and wrapper positions, while the dragged component is still the second header. The native invariant fails:

old work cannot change the new gesture index
Expected: 3
Received: 4

The owner-model item order stays unchanged in this witness; the defect is corruption of the active gesture's presentation/mapping, not proof of an already-committed wrong drop. Unit controls reproduce both start-edge and end-edge continuations using startDrag → onDragMove → onDragCancel → startDrag, without assigning protected snapshot/index state.

The Architectural Reality

src/draggable/container/SortZone.mjs#onDragMove captures itemRects and the current index, then awaits scrollToIndex in both overdrag directions. Its post-await null checks detect an ended drag only while no newer snapshot exists. A new start makes that check pass again. The polling tail also awaits 30 ms before replaying the old pointer data, checking only the new gesture's isOverDragging.

The start/end queue in container/DragZone serializes lifecycle transitions, not outstanding move continuations. The captured rectangle-array identity already distinguishes snapshots, including a remote dashboard entry. No new token or public config is needed.

Design authority: existing cancellation contract restores the captured layout and commits no reorder (onDragCancel / processDragEnd); the failing native and unit invariants above show retired work mutating the subsequent operation.

Prescription checked: src/draggable/container/SortZone.mjs owns the concern. The continuation consumes that owner's captured geometry/index and must retire when its snapshot changes; a toolbar-specific patch or consumer delay would leave the shared defect. Independent zone-side source review agrees; the polling await is included in the same repair.

The Fix

Use the already-captured snapshot identity to retire an obsolete continuation after each owner-scroll await and before the polling tail replays pointer data. Preserve same-snapshot swapping and repeated edge scrolling. Extend the existing container SortZone unit coverage and retain a native public-example regression.

Surface Authority Behavior Fallback Documentation Evidence
SortZone move continuation captured itemRects in onDragMove only its still-current snapshot may swap or replay obsolete continuation returns owning method JSDoc/comments both directions, polling, same-gesture controls
Public drag lifecycle startDrag, onDragCancel, end reset a new gesture remains untouched by old awaited work existing cancel cleanup existing lifecycle contract real native overdrag/cancel/restart

Decision Record impact: none; preserves existing gesture ownership, no new API.

Acceptance Criteria

  • Pending owner scroll in either direction cannot change a new gesture's index, map, geometry or wrapper positions after cancel/restart; end-only cancellation remains safe.
  • The 30 ms polling continuation cannot replay an old gesture's pointer data into a new one. Include a separate red control and a same-gesture polling liveness control.
  • Normal same-gesture edge scrolling and switching still work; no duplicate lifecycle queue, per-consumer guard or new public state.
  • A trusted-pointer public-example test demonstrates the first native scroll, cancellation cleanup, a new gesture, and inert old completion. Release holds and clean up on failures.
  • Existing container/grid-header/dashboard SortZone unit coverage passes; the PR states source pins and native red/green evidence.

Out of Scope

Reworking scroll echo synchronization, drag admission, coordinate spaces, pin/refill policies, rejection handling in scrollToIndex, or adding generic drag generations/queues.

Avoided Traps

An end-only null check accepts the next gesture. Serializing every pointer move adds a queue to avoid recognizing stale work. A subclass workaround copies a base lifecycle obligation. Blanket cancellation that suppresses current polling would hide the defect by disabling autoscroll.

Related and ownership

#12906 (scroll term and original end-only checks), #12932 (scroll echoes), #14980 (gesture cancellation), #20517 (cancel body resync), #20641 (start/end queue), #20605 (pinning hooks). Their completed scopes remain intact.

Self-owned by @neo-gpt-sophie for the active drag reliability work; not a newcomer handoff. Engine-only defect and public reproducer. AI structure-map: N/A, Body runtime method repair; unit tests use the existing owner spec and native tests use the grid e2e family.

Live latest-open + closed sweep: latest20 open and closed SortZone search read on 13 November around02:28Z;31 open (orange), no equivalent owner found. Read relevant closed Out of Scope/Avoided Traps, own-assignment list (one unrelated open issue), and latest30 all-status A2A claims. Three Memory Core problem-framed queries found adjacent scroll/gesture history but no prior mapping of this exact stale continuation; KB returned the related closed tickets above.

Origin Session ID: 9bf9ac41-3a89-436f-9bdb-2e38327937eb

Retrieval Hint: "SortZone delayed overdrag scroll cancellation new drag old polling continuation snapshot"

tobiu referenced in commit cef256e - "fix(drag): retire replaced SortZone continuations (#20849) (#20851)" on Nov 13, 2026, 5:01 AM
tobiu closed this issue on Nov 13, 2026, 5:01 AM