perf(cloud): batched roster entitlements + paged session listings#509
Merged
Conversation
Pre-commit hook ran. Total eslint: 1, total circular: 0
Pre-commit hook ran. Total eslint: 1, total circular: 0
Pre-commit hook ran. Total eslint: 1, total circular: 0
Pre-commit hook ran. Total eslint: 1, total circular: 0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Client side of ORGII-cloud-infra migration
0004_roster_and_listing_scalability.sql(one paste, all offline-validatable scalability fixes). Every path is fully backward compatible with pre-0004 backends.Part 1 — batched org entitlements (audit B1). Eliminates the
get_entitlement_state × Nfan-out on every roster read (measured live: 7 extra RPCs per org activation and per coarse-signal refresh). Roster rows carrying anentitlementpayload seed the coordinator directly (seedOrgEntitlement: floor mirror + TTL stamp); only unresolved rows fall back to the per-org RPC. Malformed payloads degrade via.catchwithout failing the roster parse.Part 2 — keyset-paged full session listings (audit C2). Full
cloud_list_org_sessionspulls walkp_limit=200keyset pages untilnextCursordisappears, so a large org can never push one unbounded aggregate through the managed statement timeout. Delta pulls stay single-shot. A pre-0004-signature backend answers the first paged call with PGRST202; the client falls back to the legacy call and remembers per endpoint. Runaway guard at 50 pages.Part 3 — keyset-paged full collab-state listings (audit H3). Same treatment for
cloud_list_org_collab_state: full listings walk the server's unified(updated_at, kind, id)cursor (one cursor pages projects and work items together), delta pulls stay single-shot, PGRST202 falls back with per-endpoint memory, 50-page guard. Ascending keyset order makes mid-walk writes safe — an update moves its row toward the unread tail, never behind the cursor.Server-only parts of 0004 with no client change needed: work-item project-lock narrowing (M1 — steady-state edits stop locking the project row), comments
p_sincedelta (M4 — client adoption deferred; threads are small), service-role GC for collab tombstones and bookkeeping tables (H3/L2).Test plan
tscclean; full suite green (6156 tests / 684 files); 15 new Org2Cloud tests across entitlement seeding, session paging, and collab paging (multi-page walk + cursor threading, PGRST202 fallback + endpoint memory, delta single-shot body, malformed-cursor degrade, page-cap guard, non-signature error propagation).pg_locks-level proof that steady-state work-item edits no longer wait on the project row.🤖 Generated with Claude Code