You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
perf(platform): page the chat thread list and read generations per page #5153
Split from #4708 (item 1 of 7), as triaged on TALE-117.
What the read does now
At feature-train9173785 (paths under services/platform/):
listThreads (backend/domains/chat/threads.ts:304-326) is "deliberately unpaginated": ORDER BY t.updated_at_ms DESC with no LIMIT.
Every call also runs generatingThreadIds (backend/domains/chat/threads.ts:287-296), SELECT thread_id FROM app.generations WHERE org_id = …: the thread ids of every generation of the whole organization, served only by generations_org (org_id) (backend/db/migrations/0016_chat.sql:27).
It is served by GET /api/app/chat/threads (backend/domains/chat/routes.ts:396-401) and read by useChatThreads (app/features/chat/data/chat-backend.ts:306) on Home (app/features/home/hooks/use-home-data.ts:174) and in the chat surface (app/features/chat/components/chat-surface.tsx:277). It is read again on every stream settled and idle (app/features/chat/data/thread-stream.ts:120,178).
What to do
Keyset pages for listThreads and its client, instead of the full set (the panel's date buckets then fill page by page).
Mark a thread as generating by joining the page's own threads to app.generations, instead of reading the organization-wide set of generating thread ids.
Done means: one call reads one page of the caller's threads and only their generations, and tests prove the page and the generating flag.
Activity
test(platform): give the paging fixtures the failed-page fields
perf(platform): page the chat thread list and read generations per page
test(platform): give the paging fixtures the failed-page fields
perf(platform): page the chat thread list and read generations per page
test(platform): give the paging fixtures the failed-page fields
perf(platform): page the chat thread list and read generations per page
test(platform): give the paging fixtures the failed-page fields
perf(platform): page the chat thread list and read generations per page
test(platform): give the paging fixtures the failed-page fields
perf(platform): page the chat thread list and read generations per page
test(platform): give the paging fixtures the failed-page fields
perf(platform): page the chat thread list and read generations per page
perf(platform): page the chat thread list and read generations per page
8 remaining items
perf(platform): page the chat thread list and read generations per page
perf(platform): page the chat thread list and read generations per page
perf(platform): page the chat thread list and read generations per page
perf(platform): page the chat thread list and read generations per page
perf(platform): page the chat thread list and read generations per page
perf(platform): page the chat thread list and read generations per page
perf(platform): page the chat thread list and read generations per page
perf(platform): page the chat thread list and read generations per page
perf(platform): page the chat thread list and read generations per page
perf(platform): page the chat thread list and read generations per page
perf(platform): page the chat thread list and read generations per page
perf(platform): page the chat thread list and read generations per page
perf(platform): page the chat thread list and read generations per page
perf(platform): page the chat thread list and read generations per page
perf(platform): page the chat thread list and read generations per page