cx-wtndw acpmux: the session list pages by keyset cursor
cx-wtndw. This is the second slice of Leo's 10-14 ask for cursor-based paging on the unbounded lists that cross the daemon/server boundary. All Chats landed in #20554; this one covers the session list.
What changes
_acpmux/sessionsand_acpmux/watchtake an optionallimitandcursor.- With a limit, the reply is
{sessions, nextCursor}, andnextCursoris null on the last page. - Without a limit, the reply is the full list, unchanged, with no
nextCursor. The app's sidebar, permission and census feeds keep working as they are.
- With a limit, the reply is
- The cursor uses the same keyset design as #20554:
k<updatedAt hex>.<FNV-1a of sessionId>, at most 30 characters. The time is clamped the same way where the cursor is built and where it is looked up. If the named session is gone, the next page starts at the first session no newer than it. A bad cursor or limit is refused with invalid_params. - The list now has a stable order: updatedAt descending, then sessionId ascending.
- The
_acpmux/presetsrequest arm moves verbatim intoserver/requests/presets.rs, sorequests.rsstays under the god-file budget. That check passes for every touched file.
Evidence
session_list_order::session_list_pages_neither_repeat_nor_skip_while_sessions_move pages a list with limit 5 while sessions move and leave. It also checks that a call without a limit still returns everything.
- Red at 38f2b4a558933: page one is the whole list, because the limit was ignored.
- Green at 72b4977bfe29f.
- Merged head b1aba2b115a8e:
session_list2 passed,chats_deltas+chats12 passed,cargo clippy -p acpmux --tests -D warningsclean. - All of the above ran on the private Linux builder.
crash_ratchet.pyandcheck-no-godfiles.sh --only rustpass.
The sessionId tie-break is not exercised directly, because the fixtures use distinct times. macOS hosted Rust jobs did not run.
Changelog
- none (daemon API addition; no client uses the limit yet)
🤖 Generated with Claude Code
Need help on this PR? Tag @codesmith-bot with what you need.
Summary by cubic
Adds keyset cursor paging to _acpmux/sessions and _acpmux/watch so clients can page through long session lists without fetching them all at once.
New Features
- With
limitand optionalcursor, the reply is{sessions, nextCursor}, withnextCursornull on the last page; withoutlimit, the full list is returned unchanged, so the sidebar, permission, and census feeds keep working as before. - The cursor is
k<updatedAt hex>.<FNV-1a of sessionId>, at most 30 characters, and pages neither repeat nor skip a session when sessions move or leave between pages. - A bad cursor, a zero limit, or a limit that is not a positive integer is refused with
invalid_params. - The session list now has a stable order:
updatedAtdescending, thensessionIdascending. _acpmux/presetsmoved verbatim intoserver/requests/presets.rs, keepingrequests.rsunder the god-file budget.