Context
During the Engine 13.4 release-gate verification matrix on #20379 (Grid columns can sit under a shared group header, merged via #20397 + #20502, evaluated on dev at ccb30d8d6e), real-pointer Playwright + Neural Link testing on examples/grid/headerGroups surfaced three defects in Neo.draggable.grid.header.toolbar.SortZone and Neo.draggable.container.SortZone covering Matrix Rows 2 and 4.
The Problem
Measured in Chromium on examples/grid/headerGroups (dev at ccb30d8d6e):
- Row 2A & Row 4B — Dragging a non-boundary grouped leaf into another group or region scrambles its own group order instead of refusing the drop:
test/playwright/e2e/grid/HeaderGroups.spec.mjs:139-141, 177 only tested leaves that were already sitting at the boundary edge of their group (Mar at index 2 dragged right into Q2, Apr at index 3 dragged left into Q1, and Jan at index 0 dragged left onto Region).
- When dragging
Jan (index 0 of Q1: ['Jan', 'Feb', 'Mar']) rightward and releasing over May (in Q2), SortZone swaps Jan past Feb and Mar (0 → 1 → 2), refuses only the 2 → 3 boundary crossing, and commits currentIndex = 2 on drop — mutating Q1 to ['Feb', 'Mar', 'Jan'] (ROW_2A_JAN_TO_MAY_ORDER: ["Feb","Mar","Jan","Apr","May","Jun"]) even though the user dropped on Q2.
- Likewise, when dragging
Mar (index 2 of Q1) leftward and releasing over Region (locked: 'start'), Mar stays in center (SortZone.mjs:419-420), but Q1 is mutated to ['Mar', 'Jan', 'Feb'] (ROW_4A_MAR_TO_REGION: {"start":["Region"],"center":["Mar","Jan","Feb","Apr","May","Jun"]}).
- Row 2B — An ungrouped column is permanently trapped behind a group in the same region:
- When dragging ungrouped
Id (index 12, after Q4) leftward to place it before Q4 (Oct) in center, container/SortZone#onDragMove only steps currentIndex by ±1 (12 → 11, which is Dec in Q4). Because switchItems(12, 11) checks getHeaderGroupId(12) !== getHeaderGroupId(11) (null !== Q4), it refuses the swap and resets currentIndex = 12 (ROW_2B_ID_PAST_Q4_ORDER remains [...,"Oct","Nov","Dec","Id"]). An ungrouped column can never be reordered past a group within the same region.
- Row 4C — Overdrag loop at internal group boundaries (
src/draggable/container/SortZone.mjs:799-861):
- When a grouped leaf at an internal group boundary (
Apr at index 3 dragged left past localBoundary.left, or Mar at index 2 dragged right past localBoundary.right when the centre toolbar overflows) enters isOverDraggingStart / isOverDraggingEnd, onDragMove decrements/increments me.currentIndex, awaits me.scrollToIndex(), and calls me.switchItems(index, me.currentIndex), which resets me.currentIndex = index. Because me.currentIndex !== 0 && me.currentIndex !== maxItems (line 853), me.isOverDragging stays true and re-schedules onDragMove every 30ms.
The Architectural Reality
Neo.draggable.grid.header.toolbar.SortZone#switchItems(index1, index2) (src/draggable/grid/header/toolbar/SortZone.mjs:561-567) guards individual adjacent swaps (if (me.getHeaderGroupId(index1) !== me.getHeaderGroupId(index2)) { me.currentIndex = index1; return }), while Neo.draggable.container.SortZone#onDragMove (src/draggable/container/SortZone.mjs:827-839) advances currentIndex one neighbour at a time (index ± 1).
- Because swaps inside the dragged leaf's own group succeed while the pointer moves toward another group or another region,
me.indexMap and me.itemRects are already mutated by the time the pointer leaves the group. Simply clamping currentIndex at the group boundary leaves the leaf at the boundary edge instead of either restoring me.startIndex on an invalid cross-group/cross-region drop or keeping the leaf constrained cleanly.
- For an ungrouped column (
getHeaderGroupId(index1) === null) crossing an adjacent group (getHeaderGroupId(index2) !== null), the atomic unit in the leaf toolbar is the entire contiguous run of index2's headerGroup.id — an ungrouped column cannot land inside the group, but once the pointer crosses past the group's span, it must shift the contiguous group run as a block rather than halting at the first leaf of the group.
Design authority: #20379 (Grid columns can sit under a shared group header) + 13.4 release-gate verification matrix (Rows 2 & 4).
The Fix
- Preserve within-group order when a grouped leaf is released outside its group or over another region (Rows 2A & 4B):
- If a grouped leaf is released over a different group or a different region (
lastDragClientX outside its group / over another region), or if within-group clamping is used, ensure that releasing a non-boundary leaf (e.g. Jan dropped on May, or Mar dropped on Region) does not silently commit an unintended reorder of its own group (restore startIndex when released outside the group's valid drop zone, or only reorder while the pointer is within the group's horizontal bounds).
- Allow ungrouped columns to reorder past a group in the same region (Row 2B):
- When an ungrouped leaf (
getHeaderGroupId(index1) === null) is dragged across a group (getHeaderGroupId(index2) !== null), allow it to step across the entire contiguous group run ([groupStart..groupEnd]) as a unit once the pointer crosses the group's threshold, so Id dragged before Q4 lands at [..., 'Id', 'Oct', 'Nov', 'Dec'] without splitting Q4.
- Prevent
isOverDragging infinite retry when switchItems refuses a boundary step (Row 4C):
- In
src/draggable/container/SortZone.mjs:799-861, if switchItems refused the step (me.currentIndex === index), do not keep me.isOverDragging = true spinning when no further swap in that direction is possible.
Contract Ledger
| Target surface |
Source of authority |
Proposed behavior |
Fallback / edge case |
Docs |
Evidence |
SortZone#switchItems / onDragEnd (src/draggable/grid/header/toolbar/SortZone.mjs) |
#20379 Fix step 4 + Matrix Rows 2A, 2B, 4B |
Grouped leaf reorders inside its group when dropped inside its group; dropping a non-boundary leaf (Jan, Mar) on another group or region leaves its group's initial order intact; ungrouped leaf (Id) can cross past an entire group (Q4) without splitting it |
Single-leaf group or ungrouped columns without groups behave as today |
JSDoc on SortZone methods |
test/playwright/e2e/grid/HeaderGroups.spec.mjs (Jan → May, Mar → Region, Id before Q4) |
container/SortZone#onDragMove overdrag guard (src/draggable/container/SortZone.mjs:799-861) |
Matrix Row 4C |
isOverDragging terminates cleanly when a group boundary refuses switchItems |
Normal container SortZone overdrag at 0..maxItems unchanged |
Inline comment + JSDoc |
E2E cross-region / boundary drag in HeaderGroups.spec.mjs |
Decision Record impact: none.
Acceptance Criteria
Out of Scope
- Group-cell drag (
.neo-grid-header-group-cell in GroupRow, Matrix Row 3): #20379 explicitly scoped out dragging a whole group header cell; with clean leaf reorder + ungrouped-across-group stepping (AC-1..AC-3), group-cell drag is deferred to a post-13.4 feature leaf unless the operator rules otherwise.
- Emptying a locked region (
startEmptied / endEmptied in Wrapper.mjs) and runtime column.locked mutation splitting a group (tracked in #20511 under #20379).
- Column resize on
flex columns and mid-drag GroupRow#project() during resize (tracked in #20512 / PR #20514 under #20379).
Avoided Traps
- Only testing boundary leaves (
Mar → May, Apr → Jan, Jan → Region): a leaf already at the edge of its group has 0 in-group swaps before hitting the boundary, hiding the currentIndex mutation on every non-boundary leaf.
- Allowing an ungrouped column to stop mid-group: when an ungrouped column crosses a group, it must jump the full group span so the group's leaves never split into two runs.
Related
Parent #20379 · Shipped PRs #20397, #20502 (#20501) · #20511 · #20512 (#20514) · #12903 (within-region column drag) · #9486 / #9872 (multi-body grid architecture).
Sweeps
- Live latest-open + closed sweep: Checked latest 20 open issues (
#20506 down to #17889) and latest 20 closed issues (#20501, #9872, etc.) in neomjs/neo at 2026-11-07T00:16Z; read #20379 and #20501 in full. No duplicate open issue exists.
- A2A in-flight claim sweep: Checked latest 30 all-state messages (
2026-11-07T00:14Z); filed per @neo-fable-clio (MESSAGE:a01b83f0, MESSAGE:7a168cfd) and assigned to @neo-opus-grace per her explicit handoff (MESSAGE:4340bffa: "Any red row comes to me to fix today").
- Memory Core & KB sweep: Queried
query_raw_memories and ask_knowledge_base for grid headerGroups 20379 SortZone Wrapper Resizable onColumnLockChange.
- Own-assignment sweep: Checked
@neo-gemini-maryam open assignments in neomjs/neo (#19575 only; no overlap).
- Structure-map gate: N/A (existing Engine files
src/draggable/grid/header/toolbar/SortZone.mjs, src/draggable/container/SortZone.mjs).
Origin Session ID: 444579f0-7e38-4519-831e-f7e5aabe8f44
Retrieval Hint: "grid headerGroups SortZone switchItems Jan to May Mar to Region Id past Q4 20379"
🧠Maryam (@neo-gemini-maryam · Gemini 4 Argon · Antigravity)
Context
During the Engine 13.4 release-gate verification matrix on
#20379(Grid columns can sit under a shared group header, merged via#20397+#20502, evaluated ondevatccb30d8d6e), real-pointer Playwright + Neural Link testing onexamples/grid/headerGroupssurfaced three defects inNeo.draggable.grid.header.toolbar.SortZoneandNeo.draggable.container.SortZonecovering Matrix Rows 2 and 4.The Problem
Measured in Chromium on
examples/grid/headerGroups(devatccb30d8d6e):test/playwright/e2e/grid/HeaderGroups.spec.mjs:139-141, 177only tested leaves that were already sitting at the boundary edge of their group (Marat index2dragged right intoQ2,Aprat index3dragged left intoQ1, andJanat index0dragged left ontoRegion).Jan(index0ofQ1: ['Jan', 'Feb', 'Mar']) rightward and releasing overMay(inQ2),SortZoneswapsJanpastFebandMar(0 → 1 → 2), refuses only the2 → 3boundary crossing, and commitscurrentIndex = 2on drop — mutatingQ1to['Feb', 'Mar', 'Jan'](ROW_2A_JAN_TO_MAY_ORDER: ["Feb","Mar","Jan","Apr","May","Jun"]) even though the user dropped onQ2.Mar(index2ofQ1) leftward and releasing overRegion(locked: 'start'),Marstays incenter(SortZone.mjs:419-420), butQ1is mutated to['Mar', 'Jan', 'Feb'](ROW_4A_MAR_TO_REGION: {"start":["Region"],"center":["Mar","Jan","Feb","Apr","May","Jun"]}).Id(index12, afterQ4) leftward to place it beforeQ4(Oct) incenter,container/SortZone#onDragMoveonly stepscurrentIndexby±1(12 → 11, which isDecinQ4). BecauseswitchItems(12, 11)checksgetHeaderGroupId(12) !== getHeaderGroupId(11)(null !== Q4), it refuses the swap and resetscurrentIndex = 12(ROW_2B_ID_PAST_Q4_ORDERremains[...,"Oct","Nov","Dec","Id"]). An ungrouped column can never be reordered past a group within the same region.src/draggable/container/SortZone.mjs:799-861):Apratindex 3dragged left pastlocalBoundary.left, orMaratindex 2dragged right pastlocalBoundary.rightwhen the centre toolbar overflows) entersisOverDraggingStart/isOverDraggingEnd,onDragMovedecrements/incrementsme.currentIndex, awaitsme.scrollToIndex(), and callsme.switchItems(index, me.currentIndex), which resetsme.currentIndex = index. Becauseme.currentIndex !== 0 && me.currentIndex !== maxItems(line 853),me.isOverDraggingstaystrueand re-schedulesonDragMoveevery30ms.The Architectural Reality
Neo.draggable.grid.header.toolbar.SortZone#switchItems(index1, index2)(src/draggable/grid/header/toolbar/SortZone.mjs:561-567) guards individual adjacent swaps (if (me.getHeaderGroupId(index1) !== me.getHeaderGroupId(index2)) { me.currentIndex = index1; return }), whileNeo.draggable.container.SortZone#onDragMove(src/draggable/container/SortZone.mjs:827-839) advancescurrentIndexone neighbour at a time (index ± 1).me.indexMapandme.itemRectsare already mutated by the time the pointer leaves the group. Simply clampingcurrentIndexat the group boundary leaves the leaf at the boundary edge instead of either restoringme.startIndexon an invalid cross-group/cross-region drop or keeping the leaf constrained cleanly.getHeaderGroupId(index1) === null) crossing an adjacent group (getHeaderGroupId(index2) !== null), the atomic unit in the leaf toolbar is the entire contiguous run ofindex2'sheaderGroup.id— an ungrouped column cannot land inside the group, but once the pointer crosses past the group's span, it must shift the contiguous group run as a block rather than halting at the first leaf of the group.Design authority:
#20379(Grid columns can sit under a shared group header) + 13.4 release-gate verification matrix (Rows 2 & 4).The Fix
lastDragClientXoutside its group / over another region), or if within-group clamping is used, ensure that releasing a non-boundary leaf (e.g.Jandropped onMay, orMardropped onRegion) does not silently commit an unintended reorder of its own group (restorestartIndexwhen released outside the group's valid drop zone, or only reorder while the pointer is within the group's horizontal bounds).getHeaderGroupId(index1) === null) is dragged across a group (getHeaderGroupId(index2) !== null), allow it to step across the entire contiguous group run ([groupStart..groupEnd]) as a unit once the pointer crosses the group's threshold, soIddragged beforeQ4lands at[..., 'Id', 'Oct', 'Nov', 'Dec']without splittingQ4.isOverDragginginfinite retry whenswitchItemsrefuses a boundary step (Row 4C):src/draggable/container/SortZone.mjs:799-861, ifswitchItemsrefused the step (me.currentIndex === index), do not keepme.isOverDragging = truespinning when no further swap in that direction is possible.Contract Ledger
SortZone#switchItems/onDragEnd(src/draggable/grid/header/toolbar/SortZone.mjs)#20379Fix step 4 + Matrix Rows 2A, 2B, 4BJan,Mar) on another group or region leaves its group's initial order intact; ungrouped leaf (Id) can cross past an entire group (Q4) without splitting itSortZonemethodstest/playwright/e2e/grid/HeaderGroups.spec.mjs(Jan→May,Mar→Region,IdbeforeQ4)container/SortZone#onDragMoveoverdrag guard (src/draggable/container/SortZone.mjs:799-861)isOverDraggingterminates cleanly when a group boundary refusesswitchItemsSortZoneoverdrag at0..maxItemsunchangedHeaderGroups.spec.mjsDecision Record impact: none.
Acceptance Criteria
Jan(first leaf ofQ1) ontoMay(Q2) and draggingMar(last leaf ofQ1) ontoRegion(locked: 'start') both leaveQ1in its original order['Jan', 'Feb', 'Mar'](e2e).Idleftward pastQ4(Oct, Nov, Dec) placesIdimmediately beforeOctwhile keepingQ4contiguous (['Id', 'Oct', 'Nov', 'Dec']) andQ4's group cell aligned withOct..Dec(e2e).AprorMar) past the toolbar edge does not stickisOverDraggingin a loop whenswitchItemsrefuses the swap.Out of Scope
.neo-grid-header-group-cellinGroupRow, Matrix Row 3):#20379explicitly scoped out dragging a whole group header cell; with clean leaf reorder + ungrouped-across-group stepping (AC-1..AC-3), group-cell drag is deferred to a post-13.4 feature leaf unless the operator rules otherwise.startEmptied/endEmptiedinWrapper.mjs) and runtimecolumn.lockedmutation splitting a group (tracked in#20511under#20379).flexcolumns and mid-dragGroupRow#project()during resize (tracked in#20512/ PR#20514under#20379).Avoided Traps
Mar→May,Apr→Jan,Jan→Region): a leaf already at the edge of its group has0in-group swaps before hitting the boundary, hiding thecurrentIndexmutation on every non-boundary leaf.Related
Parent
#20379· Shipped PRs#20397,#20502(#20501) ·#20511·#20512(#20514) ·#12903(within-region column drag) ·#9486/#9872(multi-body grid architecture).Sweeps
#20506down to#17889) and latest 20 closed issues (#20501,#9872, etc.) inneomjs/neoat2026-11-07T00:16Z; read#20379and#20501in full. No duplicate open issue exists.2026-11-07T00:14Z); filed per@neo-fable-clio(MESSAGE:a01b83f0,MESSAGE:7a168cfd) and assigned to@neo-opus-graceper her explicit handoff (MESSAGE:4340bffa: "Any red row comes to me to fix today").query_raw_memoriesandask_knowledge_baseforgrid headerGroups 20379 SortZone Wrapper Resizable onColumnLockChange.@neo-gemini-maryamopen assignments inneomjs/neo(#19575only; no overlap).src/draggable/grid/header/toolbar/SortZone.mjs,src/draggable/container/SortZone.mjs).Origin Session ID:
444579f0-7e38-4519-831e-f7e5aabe8f44Retrieval Hint:"grid headerGroups SortZone switchItems Jan to May Mar to Region Id past Q4 20379"🧠Maryam (
@neo-gemini-maryam· Gemini 4 Argon · Antigravity)