Files
TX/artifacts/tx-os
riyadhafraa b880dd3c37 fix(executive-meetings): keep visible drag-reorder chronological with cancelled rows
Task #311. The schedule view hides cancelled meetings, but the drag-reorder
path was operating on the raw, unfiltered list — so cancelled rows consumed
time slots and the dnd-kit indices skewed across hidden rows, leaving the
visible list out of chronological order after a drop.

Server (POST /api/executive-meetings/reorder)
- Slot-swap now operates on the in-scope (orderedIds) subset only.
  Cancelled rows keep their (startTime, endTime, dailyNumber) untouched, so
  they no longer steal slots from the visible list.
- New 400 codes:
  - cancelled_in_reorder: payload includes a cancelled meeting
  - incomplete_day: any non-cancelled meeting on the day is missing
- Audit oldValue.order now reflects the visible order the user actually saw.
- Phase-1/phase-2 negative-parking still avoids transient unique-constraint
  conflicts; cancelled rows' positive dailyNumbers cannot collide because
  slot dailyNumbers are a permutation of in-scope rows' existing values.

Client (executive-meetings.tsx reorderRows)
- Index math now derives ids from `orderedMeetings` (the visible list bound
  to SortableContext) instead of the raw `meetings` array. useCallback deps
  updated.

Tests
- artifacts/api-server/tests/executive-meetings.test.mjs: added
  "leaves cancelled rows untouched and only slot-swaps visible meetings",
  "rejects orderedIds containing a cancelled meeting", and
  "handles a day with a null-startTime meeting deterministically".
- artifacts/tx-os/tests/executive-meetings-keyboard-editing.spec.mjs: added
  two real dnd-kit drag tests driven through the keyboard sensor (Space +
  ArrowUp + Space on the row's grip handle):
  - "Schedule drag-reorder: cancelled rows ... do not disturb the visible
    chronological order" — cancelled row keeps its slot, visible rows end
    up chronological after the drop.
  - "Schedule drag-reorder: a null-startTime row drags deterministically
    and inherits its new slot" — null-time row dragged to top inherits the
    first chronological slot; the originally-null slot shifts to the row
    that lands at the bottom.

Code-review follow-ups addressed:
- Reverted the unrelated artifacts/tx-os/public/opengraph.jpg binary change.
- Added the explicit null-startTime regressions at both API and Playwright
  drag levels per review request.
- Replaced the fetch-based UI test with real dnd-kit keyboard-sensor drags
  to fully exercise the client onDragEnd path including the patched index
  math.

All 8 reorder API tests and both new Playwright drag tests pass. Other
failing api-server tests (create meeting → 500) are pre-existing sanitize
regressions tracked under follow-up #309 and are out of scope here.
2026-05-02 09:25:37 +00:00
..