Repository navigation
fix(console): page the record discussion reaction read on hasMore - #39269
Conversation
Claude-Session: https://claude.ai/code/session_01Utp6Ca2yTZZiHWkyVgD2oK Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6Ca2yTZZiHWkyVgD2oK Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6Ca2yTZZiHWkyVgD2oK Co-authored-by: Claude <noreply@anthropic.com>
…action-read-paging
|
repo:objectstack@os-bill · os-bill · session_01Utp6Ca2yTZZiHWkyVgD2oK L1 · ACCEPT (code) · PR #39269 @ bf62d0d L1 read at 2026-12-03T06:15Z. Inputs read: card #39253 body + comments 7366993097 (family scope 2026-12-03T03:50Z), 7367231143 (first touch 2026-12-03T04:04Z), 7368306950 (claim 2026-12-03T05:02Z), 7369590224 (os-dev-report 2026-12-03T06:13Z); PR body (updated 2026-12-03T06:12Z); net diff Face ( Footer items, judged
readEveryPage against
Tests and ablation
Changeset, sentence by sentence (
File size: the file is 1,550 lines on head (1,523 on main), net +27. The PR's "grows by about 75 lines" counts lines added, not net. It stays under the checklist's 2,000-line / +300 trigger. Keeping the helper in the file is reasonable: it is the merged loop lifted out, a sibling module would break the claim surface, and both callers live here. Family items (a)(b)(c)
Nits (non-blocking, can be fixed in a patch round)
Landing to-dos, recorded at ACCEPT
Seat landing note (2026-12-03T06:49Z)
|
Fixes #39253
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
readCommentReactionRows(ui/packages/app-shell/src/views/useRecordDiscussion.ts) now pages eachsys_comment_reactionread onhasMore, the wayreadRecordCommentsalready pages the comment read. Both reads share one helper,readEveryPage, lifted from the mergedreadRecordCommentsloop: while an answer sayshasMore, read the next page with$top= the first page's length and$skip= rows read so far.400(the row budget) ends the paging and the rows already read are kept. A later401/403/5xx/network failure fails the whole read, so the comments show without reactions, as when the first page fails.created_atand thenid. Rows that share a timestamp keep one order across pages, so a page boundary between them neither repeats nor skips a row.DISCUSSION_READ_MAX_PAGES) and print oneconsole.warn, so a server that answershasMoreforever (for example, one that ignores$skip) cannot loop the read.@object-ui/app-shell.Family items, weighed
idtie-breaker and an iteration ceiling for both paged reads: IN. Both are in the shared helper, so the comment read and the reaction read cannot drift apart. Onmain,readRecordCommentshas no ceiling. When the whole file was reverted tomain(ablation below), the ceiling test never finished: the old loop ran until the vitest worker died.packages/types/src/query-read-limits.tsdocuments this as the behaviour (an unpaged list read overOS_DATA_QUERY_ROW_BUDGETis refused withQUERY_ROW_BUDGET_EXCEEDED). The client cannot pick a safe first$topwithout knowing the budget, and naming one risksMAX_RECORDS_EXCEEDEDon a deployment that has a page cap. TodayfeedReadVerdictOfmaps that first-page400toanswered, so the panel says there are no comments. That misleading empty state is reported to the seat as a separate finding. It is not fixed here because the fix chooses a new verdict and new panel text.answerDiscussioninpackages/rest/src/record-page-routes.tsreadssys_commentand thensys_comment_reactionthroughp.findDatawith nolimit.ProtocolDataCrud.findData(packages/metadata-protocol/src/protocol-data-crud.ts, thelistPlanfromplanQueryReadWindow) applies the deployment's default page size to such a read. The part returnscomments: comments.recordsandreactions.records, with nohasMoreand nototal, sorecordPageComments(recordPagePayload.ts) cannot tell the answer was cut. The spec's stream table inpackages/spec/src/api/record-page.zod.tsdeclares this read as "no page size (the whole thread, as the record feed reads it)". The fix belongs to the producer (page the read on the server, or carryhasMore), not to a client fallback, sorecordPagePayload.tsis untouched.findcalls onsys_comment*). Inui/packages,objectViewCommentsPage.tsxreads one row withfindOne.plugin-detail/src/comments/recordCounts.tsalready readshasMore.useViewCommentThreads.tspages by cursor. Thesys_userresolver read names its$top. No other unpaged list read onsys_comment*remains on the client.Tests
App-shell tests: 9 passed on bf62d0d
pnpm exec vitest run --root ../.. --maxWorkers=2 packages/app-shell/src/views/useRecordDiscussion.test.tsx, run under the verify lock fromui/packages/app-shell:The new block is
useRecordDiscussion — reactions past the deployment page cap. Its data source answers 2 rows per page withhasMore, plus400 MAX_RECORDS_EXCEEDEDfor a$topover 2. It holds four cases:$skip/$top= (none), (2,2), (4,2) with$orderbycreated_at,id;400keeps the pages already read;503shows the comments without reactions;hasMoreforever stops at 100 reads and warns once.Ablation: on-disk mutations of the committed file, each restored with git restore --source=HEAD --staged --worktree (blob a8966b19 matched before and after)
readCommentReactionRowsset back to a single unpaged read per batch: 3 failed, 6 passed. "shows every reaction" fails withc-2reactionsundefinedwhere its two emoji groups were expected. The 400-keeps case and the 503 case also fail.DISCUSSION_READ_MAX_PAGESset to 150 and theidtie-breaker removed: 2 failed, 7 passed. The ceiling test fails withexpected … to have a length of 100 but got 150. The order assertion fails withexpected { created_at: 'asc' } to deeply equal { created_at: 'asc', id: 'asc' }.origin/main: the vitest worker died (Worker exited unexpectedly), because the unbounded loop onmainnever ends on the ceiling case. This run proves nothing either way and is recorded as NOT MEASURED. Mutations 1 and 2 are the evidence.Type-check and the derived gates on bf62d0d
pnpm --filter @object-ui/app-shell type-check: exit 0, bothtsc --noEmitandtsc -p tsconfig.test.json. This came after rebuilding@object-ui/plugin-chatbot, whosedistwas stale after theorigin/mainmerge. Before the rebuild the check failed onAppAskPage.tsximports this diff does not touch.node scripts/pm/dispatch-gates.mjs --commands: 38 commands, all exit 0.pnpm --dir ui exec vitest run scripts/gave 172 test files passed and 2 skipped.pnpm check:query-options-erasureexited 0 on its second run; the first run hit a 280 s harness timeout (exit 124).--ranreconciliation:38 derived, 38 run, 0 NOT-MEASURED, 0 UNRUN, with each exit code recorded (a derived zero).node scripts/pm/overlap-check.mjs:VERDICT clean exit 0(origin/main merges cleanly; no open PR shares a file).Acceptance notes
useRecordDiscussion.tsis over 1,000 lines.readEveryPageis the mergedreadRecordCommentsloop, lifted so the reaction read can share it. It is not a new concern. A sibling module would also break the claim's file surface, so the helper stays in the file. The file grows by about 75 lines, mostly doc comments.404still counts asansweredand keeps the pages read, the same as in the merged comment read (feedReadVerdictOf).Verification
Read first, by risk:
ui/packages/app-shell/src/views/useRecordDiscussion.ts,readEveryPage: the failure split in the loop'scatchand the ceiling.ui/packages/app-shell/src/views/useRecordDiscussion.ts,readCommentReactionRows: the batches are now paged reads, joined withflat().ui/packages/app-shell/src/views/useRecordDiscussion.test.tsx: the newdescribeblock.Two-minute check: from
ui/packages/app-shell,pnpm exec vitest run --root ../.. packages/app-shell/src/views/useRecordDiscussion.test.tsx. ExpectTests 9 passed (9).Generated by Claude Code