Skip to content

fix(members): hold the driving-sessions order across slots frames too - #9728

Merged
iamwhatever merged 1 commit into
kirodotdev:mainfrom
LuisBrel:fix/driving-sessions-stable-order
Sep 9, 2026
Merged

iamwhatever merged 1 commit into
kirodotdev:mainfrom
LuisBrel:fix/driving-sessions-stable-order

Conversation

@LuisBrel

@LuisBrel LuisBrel commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Problem / Motivation

Follow-up to the review of #9537, which counted this sibling in the same file:
drivingSessions in website/src/pages/members/MembersPage.tsx sorted the live
WebSocket liveSlots by lastActivityEpoch on every render.

That list refreshes on every slots frame, and the sort key advances whenever a
worker does anything, so a frame landing between the reader aiming at a row and
clicking it moves the row. Each row is a navigate() into that session, so a
shifted row opens a DIFFERENT session than the one that was under the pointer.
The order also decides which rows sit behind the DRIVING_VISIBLE fold, so a
live re-sort can remove the aimed-at row from the visible list entirely.

Why it matters

Same class and same consequence as the roster defect #9537 fixed -- a click that
lands somewhere the reader did not choose -- and it needs no unusual conditions:
one active worker session is enough, because a working member emits frames
continuously. #9537 fixed the roster one panel over and left this one, which the
First Principles lane flagged as the counted unfixed sibling.

What changed (motivation -> approach -> change)

Root cause: the display order was a function of frame timing rather than of the
list's contents.

The order is now committed per DRIVEN SET, keyed by member: it re-sorts from
scratch when the set of driven slot keys changes (a worker opens or closes) or
when the active member changes, and otherwise maps the committed key order over
the fresh slots. Row CONTENT still updates from every frame -- status dot, title,
timestamp -- so nothing about liveness is lost; only positions hold.

Keying by member as well as by key-set matters: the list is per active member and
the fold is keyed to the member, so a bare key-set comparison would try to map
one member's committed order onto another member's slots on a switch.

Deliberately the same idiom as the roster fix rather than a new mechanism, so the
two sit side by side in one file and read as one rule.

Tests

a slots frame never reorders the list; a change to the driven set re-sorts it
in website/src/pages/members/MembersPage.test.tsx: a frame that makes the lower
row both the most recently active AND running must update its status dot in place
while the order holds, and a newly opened worker must re-sort the whole list by
recency. The existing newest activity first case still passes, so the first
frame's ordering is unchanged.

Mutation-proven: with the previous per-render sort restored, the new test fails
(1 failed / 81 passed); with the fix, 82 passed.

npx eslint on both changed files exits 0. npx tsc -b reports the same 30
errors before and after my change (0 new) -- all in PasteTokenNode.tsx, from an
incomplete local install: npm ci fails E401 against the package registry
configured on this machine, so the lexical packages are absent. Nothing in that
set touches the members page.

Manual verification

N/A -- the defect is a race between a WebSocket frame and a click, which the test
reproduces deterministically by dispatching a frame between assertions.

Screenshots / video

Why no screenshot: there is no visual delta. No styling, layout, markup or
component change -- the same rows render with the same classes, and the first
paint is byte-identical because the first frame still sorts by recency. What
changes is purely temporal: whether a later frame may reorder them. A still of
before and after is identical, and the regression test is what demonstrates the
behaviour.

Related Issues

Refs #9524
Follows up the First Principles review on #9537

Pattern harvest

Rule candidate: review-prompt
Pattern: an activity-keyed sort over live-refreshing data, feeding rows that are
click targets. The sort key advancing is indistinguishable from the list
changing, so ordering becomes a function of refresh timing -- and when each row
navigates, that turns a background refresh into a misroute. Worth asking wherever
a live list is sorted by a timestamp that the live data itself moves.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

The sibling of the roster order fix, in the same file and with the same cause.
`drivingSessions` sorted the live WS `liveSlots` by `lastActivityEpoch` on every
render, and that list refreshes on every slots frame while the sort key advances
whenever a worker does anything -- so a frame landing between the reader aiming
at a row and clicking it moved the row, and each row is a `navigate()` into that
session. A shifted row opens the WRONG session. The order also decides which
rows sit behind the DRIVING_VISIBLE fold, so a live re-sort can pull a row out
from under the pointer entirely.

The order is now committed per DRIVEN SET, keyed by member: it re-sorts from
scratch when the set of driven slot keys changes (a worker opens or closes) or
when the active member changes, and otherwise maps the committed key order over
the fresh slots. Status dot, title and timestamp keep updating from every frame;
only the positions hold.

Refs kirodotdev#9524
@LuisBrel
LuisBrel requested review from a team and chenmingwei23 September 9, 2026 14:38
@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 9, 2026
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

UX Review (Fable 5, fork) — ✅ PASS

UX-level review of 40f3415d785ebeecdc900189780614dfcfd1dd5b via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Reconciliation complete: the diff changes no user-visible control, label, string, or markup — the same rows render with the same classes; only the timing of reorders changes (held until the driven set or member changes, matching the committed-order idiom the roster already uses at MembersPage.tsx:486). The no-visual-delta claim checks out against the patch, and the residual full re-sort on worker open/close is pre-existing base behavior consistent with the accepted sibling fix.

UX-Verdict: PASS

Rows stop shifting under the pointer mid-click; no control, string, or pixel changes, and the fix mirrors the roster's already-shipped ordering idiom.

[UX-REVIEWED] 40f3415

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Design Review (Fable 5, fork) — ✅ PASS

Design-level review of 40f3415d785ebeecdc900189780614dfcfd1dd5b via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Verified against the base file: the diff mirrors the committed-order idiom already shipped for the roster (committedOrderRef, MembersPage.tsx:486-501) exactly as the description claims, adding member-keying because the driving list and its fold are per-member. The problem (rows that navigate() re-sorting under the pointer on every WS frame) is the same class the accepted #9537 fixed, the fix addresses the root cause (order as a function of frame timing), and the test pins both halves — hold across frames, re-sort on set change.

Design-Verdict: PASS

Same root cause, same accepted idiom as the roster fix one panel up, correctly member-keyed, with a mutation-proven regression test.

[DESIGN-REVIEWED] 40f3415

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5, fork) — ✅ PASS

Premise-level review of 40f3415d785ebeecdc900189780614dfcfd1dd5b via the fork AI-review pipeline — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

All lenses run clean. Writing the review.

First-Principles-Verdict: PASS

Verify the mutation claim by running the new test against base — "1 failed / 81 passed" is author-asserted and unrunnable from this checkout.

What this change ships

Inventory (4 items) — 4 justified

Intent: stop live activity frames from moving the driving-sessions rows a reader is about to click — a FIX.

  1. Driving-session rows keep their positions across slots frames instead of re-sorting on every frame — justified
  2. The list still re-sorts by recency when a worker opens or closes, or the member switches — justified
  3. Row content (status dot, title, timestamp) still updates live from every frame — justified
  4. New regression test pins "frames never reorder; a driven-set change re-sorts" — justified

The defect has checkable provenance: the #9537 roster fix and its identical rationale sit in the same file (MembersPage.tsx:486), rows navigate (MembersPage.tsx:1533), and the fold exists (MembersPage.tsx:546). Sibling count after this fix: grepped \.sort\( in MembersPage.tsx — 2 sites, both now held; ChatSidebar's activity sort already carries its own hover-hold (ChatSidebar.tsx:4037). The fix sits at cause level (order as a function of contents, not frame timing), and committedDrivingRef is file-private, no new public surface.

[FIRST-PRINCIPLES-REVIEWED] 40f3415

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Opus 4.8 Review (fork) — ✅ no blocking findings

Reviewed 40f3415d785ebeecdc900189780614dfcfd1dd5b via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 40f3415

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

GPT 5.6 Review (fork) — ✅ no blocking findings

Reviewed 40f3415d785ebeecdc900189780614dfcfd1dd5b via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 40f3415

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Sep 9, 2026
@iamwhatever
iamwhatever enabled auto-merge (squash) September 9, 2026 15:07

@iamwhatever iamwhatever left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tier 1 auto-approve: fix (2 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, SAST annotations clean, security checklist all-NO, AI reviewers green. Category: the members drawer sorted its driving-sessions list on every WS slots frame, so a row moved under the pointer mid-click and navigated into the wrong session; the order is now committed per driven set and re-sorts only when a worker opens/closes or the member changes, while row content still updates per frame. CodeQL is not applicable on this fork PR (default-setup emits no check-run); SAST coverage is Semgrep only, latest run success with 0 annotations.

@iamwhatever
iamwhatever merged commit 1e1349e into kirodotdev:main Sep 9, 2026
68 checks passed
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Sep 9, 2026
amadsalmon pushed a commit to amadsalmon/KiroCrew that referenced this pull request Sep 22, 2026
…kirodotdev#9728)

The sibling of the roster order fix, in the same file and with the same cause.
`drivingSessions` sorted the live WS `liveSlots` by `lastActivityEpoch` on every
render, and that list refreshes on every slots frame while the sort key advances
whenever a worker does anything -- so a frame landing between the reader aiming
at a row and clicking it moved the row, and each row is a `navigate()` into that
session. A shifted row opens the WRONG session. The order also decides which
rows sit behind the DRIVING_VISIBLE fold, so a live re-sort can pull a row out
from under the pointer entirely.

The order is now committed per DRIVEN SET, keyed by member: it re-sorts from
scratch when the set of driven slot keys changes (a worker opens or closes) or
when the active member changes, and otherwise maps the committed key order over
the fresh slots. Status dot, title and timestamp keep updating from every frame;
only the positions hold.

Refs kirodotdev#9524

Co-authored-by: LuisBrel <193017400+LuisBrel@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants