Skip to content

fix(console): open a phone list-page comment thread past the first page of its record discussion - #39252

Draft
objectstack-fleet[bot] wants to merge 4 commits into
mainfrom
claude/issue-39195-thread-past-first-page
Draft

objectstack-fleet[bot] wants to merge 4 commits into
mainfrom
claude/issue-39195-thread-past-first-page

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #39195
Clause-②: no
Metadata-protocol: none

维护者速读

  • 手机上的列表评论页里,点开某条记录靠后的评论串时,现在会直接打开这串评论,不再被当成「已不存在」退回卡片;记录页和电脑端列表评论栏也会显示这条记录最新的评论。
  • 属于「列表页评论」专题,替在设置了数据分页上限的部署上使用评论的成员解决看不到后几页评论的问题。
  • 出错时最坏情况是某条评论串打开后停在该记录的评论串列表而不是退回卡片,或评论区多发几次读取请求;改动只在前端,可以直接撤回。
  • 无

What changes

Part of #39077, the list-page comments topic; that topic stays open after this PR.

On a deployment with a data page size (OS_DATA_DEFAULT_PAGE_SIZE / OS_DATA_MAX_PAGE_SIZE), a list read that names no limit answers the first page and hasMore: true (packages/types/src/query-read-limits.ts, "refuse, never clamp"). The record discussion's comment read in useRecordDiscussion.ts named no limit and never looked at hasMore, so it held only the oldest page. A thread whose top-level comment sat past that page was missing from useRecordComments().threads, and the phone list page's ThreadGone sent the reader back to the cards.

  • useRecordDiscussion.ts: the non-payload comment read is now readRecordComments: while the answer says hasMore, it reads the next page with $top = the first page's length (so never over the deployment's maximum) and $skip = the rows read so far. A later page that fails (5xx, network) or is refused (401/403) fails the read, as the first page's would. A later page refused with a 400 (the row budget, a refusal no retry changes) ends paging and the pages read stand. With no page size the first answer is the whole discussion, so nothing changes there: one request, as before. The record page's payload path (served) is untouched.
  • objectViewCommentsPage.tsx: ThreadGone no longer decides "gone" from absence in the discussion. When the thread is absent from the read discussion, it reads the thread's top-level comment by id (dataSource.findOne('sys_comment', id)). Gone means no row, or a row that is not a top-level comment of this record's discussion. A refused or failed root read says nothing, so the page stays.

The record page (when it reads the discussion itself) and the desktop list column use the same readComments, so they now show the newest comments past the first page too. That is the same fix, in the same file.

Read first (riskiest first):

  1. useRecordDiscussion.ts, readRecordComments: the paging loop and how a later-page error is handled.
  2. objectViewCommentsPage.tsx, ThreadGone and isThreadRoot: when a thread counts as gone.
  3. The objectstack#39195 describe block in ObjectView.phoneCommentsPage-39086.test.tsx: the paging mock (page cap, row budget).

Tests

New describe block objectstack#39195 — a thread past the first page of its record discussion in ObjectView.phoneCommentsPage-39086.test.tsx. Its mock data source answers sys_comment like a capped deployment: with no $top it returns the first page, otherwise $skip/$top, with hasMore. It refuses a $top over the cap, refuses a walk past an optional row budget with a 400, and findOne returns the row by id or null.

  • opens a thread that starts past the first page (page cap 2, three threads), shows its late reply, stays on it, and the reads were pages [none], [skip 2, top 2], [skip 4, top 2];
  • a deleted thread still falls back to the cards, and the root read asked sys_comment for that id;
  • a thread the row budget keeps out of the read is not reported gone (the page stays on the thread's record);
  • a link that names a reply, not a thread, falls back to the cards.

The existing case falls back to the cards when the thread is gone from its record still passes unchanged.

Test runs (head a020f36, from ui/, under the shared verify lock)
  • vitest run ObjectView.phoneCommentsPage-39086.test.tsx useRecordDiscussion.test.tsx: Test Files 2 passed (2), Tests 20 passed (20), VERDICT command-exit 0.
  • The 30 app-shell test files that mention sys_comment (record page, desktop list column, feed tests): Test Files 30 passed (30), Tests 449 passed (449), VERDICT command-exit 0 (run at the code-identical commit before the changeset commit).
  • pnpm --filter @object-ui/app-shell type-check (both tsc --noEmit and tsc -p tsconfig.test.json): VERDICT command-exit 0.
Ablation (each leg via scripts/ablation-replace.mjs, restored to the HEAD blob, git diff HEAD empty)
  • Paging removed (the comment read put back to the single unpaged find): opens a thread that starts past the first page, with its replies, and stays on it turns red, Tests 1 failed | 14 passed (15). The other new cases stay green, because they are about the gone check, not about paging.
  • Root confirmation removed (ThreadGone calls back on absence alone): does not report gone a thread the deployment's row budget keeps out of the read turns red, Tests 1 failed | 14 passed (15).

Acceptance notes

  • Served payload not measured. The record page's payload path (recordPageComments, served) is outside this change. I did not measure whether the server caps the discussion in the page payload.
  • Offset paging under concurrent deletes. A comment deleted between two page reads shifts the offsets, so one row can be skipped until the next read. New comments sort last (oldest first), so they do not shift anything. Rows are merged by id, so nothing is duplicated.
  • Corner case left as is. With a row budget smaller than a record's discussion, a thread beyond the budget is not reported gone. The page shows the record's thread list (CommentsPage with the thread not in its rows) instead of the thread. Pinned as "not gone". Showing the thread itself there would need a per-thread read, which this PR does not add.
  • Same family, reported, not fixed here: the reaction read readCommentReactionRows (same file) sends each page of 100 comment ids with no $top and ignores hasMore. Under a page cap smaller than those comments' reaction rows, it shows fewer reactions than are stored. It goes to the seat for the family's card.

Verification

Two-minute check: from ui/, run pnpm exec vitest run packages/app-shell/src/views/ObjectView.phoneCommentsPage-39086.test.tsx. Expected: 15 tests pass, including the four in the objectstack#39195 block.

Local gates (head a020f36)
  • node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack derived 38 commands for this diff. All 38 ran, plus pnpm check:changeset-fixed (its roster is under .changeset/). Every one exited 0.
  • dispatch-gates --ran with exit codes recorded: 38 derived famil(ies) accounted for — 38 run, 0 NOT-MEASURED (a DERIVED zero — all 38 recorded an exit code and none of them is 3).
  • node scripts/pm/overlap-check.mjs: origin/main: merges cleanly, 0 open PR heads share a file, VERDICT clean exit 0.
  • test:repo, the type-check lanes and the full farm run in CI; I did not re-run them here.

Generated by Claude Code

…; judge a phone thread gone by its root

Claude-Session: https://claude.ai/code/session_01Utp6Ca2yTZZiHWkyVgD2oK
Co-authored-by: Claude <noreply@anthropic.com>
…ad is not reported gone

Claude-Session: https://claude.ai/code/session_01Utp6Ca2yTZZiHWkyVgD2oK
Co-authored-by: Claude <noreply@anthropic.com>
@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

This branch has not been deployed

No deployments
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.

Phone list comments: a thread past the first page of its record's comment read is reported gone

2 participants