Skip to content

fix(console): page the record discussion reaction read on hasMore - #39269

Merged
objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/issue-39253-reaction-read-paging
Dec 3, 2026
Merged

objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/issue-39253-reaction-read-paging

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #39253

Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:在设置了较小分页上限的部署上,记录讨论区(记录页、列表页评论列、手机评论页)里超出首页的评论表情回应现在都会显示;未设上限的部署用户无感。
  • 为什么做:属于「记录讨论与评论」专题,补齐上一张修评论分页的卡留下的同族缺口:表情回应的读取也要翻页。
  • 出错会怎样:最坏是某条评论的表情回应显示不全或不显示,评论本身照常显示;改动只在前端读取,可直接撤回。
  • 要你做什么:无

What changes

  • readCommentReactionRows (ui/packages/app-shell/src/views/useRecordDiscussion.ts) now pages each sys_comment_reaction read on hasMore, the way readRecordComments already pages the comment read. Both reads share one helper, readEveryPage, lifted from the merged readRecordComments loop: while an answer says hasMore, read the next page with $top = the first page's length and $skip = rows read so far.
  • Failure rules match the comment read. A later page refused with a 400 (the row budget) ends the paging and the rows already read are kept. A later 401/403/5xx/network failure fails the whole read, so the comments show without reactions, as when the first page fails.
  • Both paged reads now order by created_at and then id. Rows that share a timestamp keep one order across pages, so a page boundary between them neither repeats nor skips a row.
  • Both paged reads stop after 100 pages (DISCUSSION_READ_MAX_PAGES) and print one console.warn, so a server that answers hasMore forever (for example, one that ignores $skip) cannot loop the read.
  • A patch changeset for @object-ui/app-shell.

Family items, weighed

  • (a) Stable id tie-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. On main, readRecordComments has no ceiling. When the whole file was reverted to main (ablation below), the ceiling test never finished: the old loop ran until the vitest worker died.
  • (b) A deployment with a row budget and no page cap, where the first over-budget read is refused whole: OUT. No first page arrives, so there is nothing to page from. packages/types/src/query-read-limits.ts documents this as the behaviour (an unpaged list read over OS_DATA_QUERY_ROW_BUDGET is refused with QUERY_ROW_BUDGET_EXCEEDED). The client cannot pick a safe first $top without knowing the budget, and naming one risks MAX_RECORDS_EXCEEDED on a deployment that has a page cap. Today feedReadVerdictOf maps that first-page 400 to answered, 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.
  • (c) Does the server cap the record-page discussion it serves? Yes. Out of this claim (server-side) and reported to the seat. answerDiscussion in packages/rest/src/record-page-routes.ts reads sys_comment and then sys_comment_reaction through p.findData with no limit. ProtocolDataCrud.findData (packages/metadata-protocol/src/protocol-data-crud.ts, the listPlan from planQueryReadWindow) applies the deployment's default page size to such a read. The part returns comments: comments.records and reactions.records, with no hasMore and no total, so recordPageComments (recordPagePayload.ts) cannot tell the answer was cut. The spec's stream table in packages/spec/src/api/record-page.zod.ts declares 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 carry hasMore), not to a client fallback, so recordPagePayload.ts is untouched.
  • Family sweep (card: further unpaged find calls on sys_comment*). In ui/packages, objectViewCommentsPage.tsx reads one row with findOne. plugin-detail/src/comments/recordCounts.ts already reads hasMore. useViewCommentThreads.ts pages by cursor. The sys_user resolver read names its $top. No other unpaged list read on sys_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 from ui/packages/app-shell:

 Test Files  1 passed (1)
      Tests  9 passed (9)
os-verify-lock: VERDICT command-exit 0

The new block is useRecordDiscussion — reactions past the deployment page cap. Its data source answers 2 rows per page with hasMore, plus 400 MAX_RECORDS_EXCEEDED for a $top over 2. It holds four cases:

  • every reaction shows (five rows over three pages), and the reads ask $skip/$top = (none), (2,2), (4,2) with $orderby created_at, id;
  • a later page refused with 400 keeps the pages already read;
  • a later page answering 503 shows the comments without reactions;
  • a server answering hasMore forever 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)
  1. readCommentReactionRows set back to a single unpaged read per batch: 3 failed, 6 passed. "shows every reaction" fails with c-2 reactions undefined where its two emoji groups were expected. The 400-keeps case and the 503 case also fail.
  2. DISCUSSION_READ_MAX_PAGES set to 150 and the id tie-breaker removed: 2 failed, 7 passed. The ceiling test fails with expected … to have a length of 100 but got 150. The order assertion fails with expected { created_at: 'asc' } to deeply equal { created_at: 'asc', id: 'asc' }.
  3. The whole file reverted to origin/main: the vitest worker died (Worker exited unexpectedly), because the unbounded loop on main never 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, both tsc --noEmit and tsc -p tsconfig.test.json. This came after rebuilding @object-ui/plugin-chatbot, whose dist was stale after the origin/main merge. Before the rebuild the check failed on AppAskPage.tsx imports 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-erasure exited 0 on its second run; the first run hit a 280 s harness timeout (exit 124).
  • --ran reconciliation: 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).
  • CI runs the families not in the derived list (Type Check UI, Test UI, Lint UI, and the rest). They were not re-run locally.

Acceptance notes

  • useRecordDiscussion.ts is over 1,000 lines. readEveryPage is the merged readRecordComments loop, 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.
  • A later-page 404 still counts as answered and keeps the pages read, the same as in the merged comment read (feedReadVerdictOf).
  • Reported to the seat, not fixed here: the served record-page discussion is capped (item c above), and a first-page row-budget refusal shows an empty panel (item b above).

Verification

Read first, by risk:

  1. ui/packages/app-shell/src/views/useRecordDiscussion.ts, readEveryPage: the failure split in the loop's catch and the ceiling.
  2. ui/packages/app-shell/src/views/useRecordDiscussion.ts, readCommentReactionRows: the batches are now paged reads, joined with flat().
  3. ui/packages/app-shell/src/views/useRecordDiscussion.test.tsx: the new describe block.

Two-minute check: from ui/packages/app-shell, pnpm exec vitest run --root ../.. packages/app-shell/src/views/useRecordDiscussion.test.tsx. Expect Tests 9 passed (9).


Generated by Claude Code

@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Dec 3, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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 origin/main...bf62d0db (3 files, +187/-48); check-runs on bf62d0d at 2026-12-03T06:15Z. Head confirmed bf62d0db911bfe8c7318038441744401fb9e01b2 (PR API and origin/claude/issue-39253-reaction-read-paging agree).

Face (l1-face.mjs --pr 39269, 2026-12-03T06:14Z): shape, first line Fixes #39253, no keyword on another card, no releases path, changeset present (app-shell is private: true), Clause-②: no / Metadata-protocol: none, Skills-docs not owed, dogfood not owed. INCOMPLETE: floor checks (Lint & Repo Gates, TypeScript Type Check) absent and 14 runs in progress at 2026-12-03T06:15Z (11 success, 0 failed). ⛔ Not ready, not queued until both floor jobs and every check read success on this head.

Footer items, judged

  • Fixes is right: the card's acceptance (every reaction shows under a page cap; a test that goes red without the fix) is met on every client read path. The served record-page path is item (c): server-side, out of the claim, reported.
  • Files are all within the claim surface (useRecordDiscussion.ts, its test, a changeset). recordPagePayload.ts is untouched. No adjacent in-place fix, no codegen, no move or split.
  • Clause-②: no, confirmed. No packages/spec, zod, REST or published package changes, so no accept-set change and no contract review owed.
  • Dev evidence makes no API reads that git could answer. The classifier refusal (sed … :: exit 0 into --ran) is recorded word for word, was not resent, and the --ran file was rebuilt from the real exit codes.

readEveryPage against packages/types/src/query-read-limits.ts

  • Termination: the read stops on hasMore !== true, on an empty page, or after 100 reads (first page plus 99 more; the check runs before each read, so a page that ends cleanly at the 100th read stops without a false warning). $top is the first page's length, which is never over max because the default is ≤ max (that file throws at boot otherwise). $skip is the number of rows read so far.
  • Error mapping uses feedReadVerdictOf. A later 400 (QUERY_ROW_BUDGET_EXCEEDED / MAX_RECORDS_EXCEEDED, 'rejected' → 'answered') stops paging and keeps the rows read. 401/403 ('refused') and 5xx/network ('failed') re-throw. For reactions this lands in the existing catch { records = null }, so comments show without reactions. A later 404 or other non-401/403 4xx also keeps the rows read; that is the same as merged fix(console): open a phone list-page comment thread past the first page of its record discussion #39252 and the body says so.
  • readRecordComments compared with merged fix(console): open a phone list-page comment thread past the first page of its record discussion #39252 (7c513de, the last change to this file on main): the loop is identical line for line. The only differences are the id tie-breaker in $orderby, the 100-page ceiling and the row type (unknown[] → Record<string, unknown>[]). Behaviour is otherwise unchanged.
  • At the ceiling there is one console.warn per read that reaches it (no-console allows warn in ui/eslint.config.js:186). The rows read so far are returned and the verdict stays 'answered'. The UI shows those rows (duplicates by id collapse in mergeFeedRows) and says nothing to the user, so a real thread past 100 pages would be cut silently. That is an accepted bound for a misbehaving server, not a defect for this card.

Tests and ablation

  • The 4 new cases cover the 3-page read ($skip/$top = none, (2,2), (4,2)), a later-page 400 that keeps rows, a later-page 503 that drops reactions, and the 100-read ceiling with one warning.
  • Ablation is pinned to this head: blob a8966b19 is bf62d0db:ui/packages/app-shell/src/views/useRecordDiscussion.ts (I checked). Mutation 1 (unpaged reaction read) gives 3 failed: the fix is red without it. Mutation 2 (ceiling 150 and no id) gives 2 failed. Mutation 3 (whole file reverted to main) is honestly recorded as NOT MEASURED.
  • My own re-run is NOT MEASURED: this checkout's ui/node_modules is partial (@vitejs/plugin-react missing), and the scratch worktree was removed. CI Test UI shards are pending.

Changeset, sentence by sentence (.changeset/39253-reaction-read-paging.md)

  1. Title "a record discussion shows every comment reaction, not only the deployment's first page of them": true for the client read paths. It is broader than the diff for the record page with its served payload, which is still capped server-side (item c). Body sentence 3 scopes it. Nit: suggest "…shows every comment reaction the console reads itself…".
  2. "On a deployment with a data page size … read past their first page … each the size of the first, as the comment read already does": true.
  3. "Where the discussion is read by the console itself (record page without its page payload, list page's comments column, phone comments page), every reaction shows": true. Those surfaces reach readComments(null) through RecordDetailView:3293 and objectViewCommentsShared.
  4. "A later page refused with a 400 … ends the paging and the reactions read are shown": true.
  5. "a later page that fails or is refused otherwise leaves the comments shown without reactions, as a failed first page does": true in the file's own vocabulary ('refused' = 401/403). A later 404 or other non-401/403 4xx keeps the rows instead. Nit, not false.
  6. "Both discussion reads now order by created_at and then id … stop after 100 pages with a console warning": true.

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)

  • (a) IN, confirmed in the diff and pinned by ablation 2.
  • (b) OUT, reason confirmed. query-read-limits.ts documents that a read with a row budget and no page size is refused whole (QUERY_ROW_BUDGET_EXCEEDED), so there is no first page to page from. The empty-panel finding needs a verdict and panel-text decision.
  • (c) Server cap confirmed by reading the code. answerDiscussion returns comments.records / reactions.records with no hasMore, and findData applies listPlan (protocol-data-crud.ts:749), which contradicts the spec stream row "no page size (the whole thread …)". The fix belongs to the producer.

Nits (non-blocking, can be fixed in a patch round)

  • In the "shows every reaction" case, the $orderby assertion reads calls[0], which is the sys_comment read, not a reaction read. It is the same helper, so ablation 2 still goes red.
  • The ceiling test does not assert what items shows.
  • Changeset title wording (sentence 1 above).

Landing to-dos, recorded at ACCEPT

Seat landing note (2026-12-03T06:49Z)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Record discussion: comment reactions past the deployment's first page are not shown (the reaction read ignores hasMore)

2 participants