Repository navigation
fix(rest): serve the record page discussion whole past the data page size - #39294
objectstack-fleet[bot] merged 3 commits into
Conversation
…e size 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>
📓 Docs Drift Check2 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run. What this run could not see
Coarse fallback — 19 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin f60888ed9eedd049ddb66830e6a0e98e6f5c556d && git checkout f60888ed9eedd049ddb66830e6a0e98e6f5c556d
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin c7478b37b9ddd0dc3b7ceceaaf0c6f8ea9a4608d 6bc8f6b509a38e1e3551f009a6a655b98f90a791 && git checkout -B drift-repro c7478b37b9ddd0dc3b7ceceaaf0c6f8ea9a4608d && git merge --no-ff 6bc8f6b509a38e1e3551f009a6a655b98f90a791
node scripts/docs-audit/affected-docs.mjs --json c7478b37b9ddd0dc3b7ceceaaf0c6f8ea9a4608d |
|
repo:objectstack@os-bill · os-bill · session_01Utp6Ca2yTZZiHWkyVgD2oK L1 review — PR #39294 (card #39271) — ACCEPT (landing conditions below)Head-sha: Inputs read: card #39271 body; comments 7371086694 (triage), 7371261298 (claim), 7373334709 (os-dev-report); the PR body; the net diff vs merge-base; check-runs on the head; PR #39287 body and diff ( Face (
|
Fixes #39271
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
answerDiscussioninpackages/rest/src/record-page-routes.tsreadsys_comment, thensys_comment_reaction, throughfindDatawith no limit. On a deployment that sets a data page size, the data door answers such a read with its first page andhasMore. The route passed that page on as the whole thread, and the payload had no signal that rows were missing. The spec rowdiscussioninpackages/spec/src/api/record-page.zod.tssays "no page size (the whole thread, as the record feed reads it)".readWholeStream(the same file): the first read still names no page. While an answer sayshasMore, it reads the next page, the size the first page was, atoffset= rows read so far. Both discussion reads (comments, then reactions) go through it.created_atasc, thenidasc (DISCUSSION_ORDER). Without the id tie-break, rows that share a timestamp could repeat or drop across an offset boundary. The spec'screated_atasc is kept;idonly orders ties. This is the same order as the client'sreadEveryPage(PR fix(console): page the record discussion reaction read on hasMore #39269).OS_DATA_QUERY_ROW_BUDGET): the last page is cut so it ends exactly at the budget (resolveQueryReadLimits, the same env the data door reads). Without the cut, a thread that fits the budget would be refused. A thread with rows past the budget gets the data door's own refusal of the read that would walk there (QUERY_ROW_BUDGET_EXCEEDED, 400). That refusal is carried in the discussion part for comments, or inreactionsfor reactions, where the spec's union already declares a refusal. The route never passes off the rows read so far as the thread. A deployment with a budget and no page size already answered this way, because its probe read refuses over budget. So both configurations now give the same answer. This needs no contract change.hasMoreas offset plus rows against its count, so the loop always ends once the rows are read. A ceiling could only end in a short list or in an error code invented for it.readStreamnow returns the door'shasMorebesiderecords/total. Activity, attachments and timeline read the same fields as before.Tests
record-page-routes.test.ts — 47 passed at 6bc8f6b; new describe [#39271], 4 cases
pnpm --filter @objectstack/rest exec vitest run --maxWorkers=2 src/record-page-routes.test.tsgaveTests 47 passed (47).The new cases use a paging double that windows reads with the real
planQueryReadWindow/assertQueryReadRowsfrom@objectstack/typesand the deployment env (vi.stubEnv). The double has 7 comments (two share a timestamp) and 8 reactions, against a page size of 3.created_at,idorder and all 8 reactions; the reads are offsets 0 (no limit), 3, 6 for each object.limit 2, offset 6.{ error: { code: QUERY_ROW_BUDGET_EXCEEDED, status: 400 } }, not 6 comments.QUERY_ROW_BUDGET_EXCEEDED/ 400.The existing all-streams case pins the new two-key
orderByon both discussion reads.Ablation — two mutations, each red, each restored (blob == HEAD, git diff HEAD empty)
Done with
scripts/ablation-replace.mjsonpackages/rest/src/record-page-routes.ts. The suite imports the route fromsrc/, so no build is involved.if (!first.hasMore || records.length === 0) return { records };becamereturn { records };. Result:Tests 4 failed | 43 passed (47), all four [Record page payload: the served discussion is cut at the deployment's default page with no hasMore, though the spec says the whole thread #39271] cases red.if ('error' in page) return page;becameif ('error' in page) return { records };. Result:Tests 2 failed | 45 passed (47), both budget-refusal cases red.Package suite and typecheck
pnpm --filter @objectstack/rest testat c71cd87 (6bc8f6b changes only the test double's matcher, and that file's 47 cases were re-run on 6bc8f6b):Test Files 451 passed (451),Tests 9356 passed | 351 skipped (9707).pnpm --filter @objectstack/rest typecheckat 6bc8f6b: exit 0.check:test-typecheck: OK, 0 errors.Acceptance notes
readEveryPageinui/packages/app-shell/src/views/useRecordDiscussion.ts) keeps the pages already read when a later page is refused with a 400 such as the row budget. This route refuses instead, as this card's dispatch asked. On a deployment whose thread exceeds the budget, the two doors now answer differently: the payload gives a refusal, the client's fallback read gives a short list. This is noted here and not filed.comment_id$in. Deployments with no page size already did this before this change. A thread of thousands of comments could reach a driver's bind-parameter limit. Not measured; noted only.Verification
Read first, by risk:
packages/rest/src/record-page-routes.ts, thereadWholeStreamloop: theroomcut and the refusal carry.packages/rest/src/record-page-routes.test.ts,pagingDoor: it windows reads with the real planner..changeset/record-page-discussion-whole-thread.md.Two-minute check:
pnpm --filter @objectstack/rest exec vitest run src/record-page-routes.test.ts -t 39271should report 4 passed.Local gates at 6bc8f6b: dispatch-gates --ran gives 70 derived, 68 run with exit 0, 2 NOT MEASURED
node scripts/pm/dispatch-gates.mjs --ranprints70 derived famil(ies) accounted for — 68 run, 2 NOT-MEASURED.node scripts/check-plugin-teardown-shape.mjs --self-test. It exits 3 because the shallow clone cannot reach its pinned positive-control commit; it exits 3 on origin/main too. It only checks the checker's own health.pnpm check:dual-build-cjs-loads. PREREQUISITE NOT MET: only the rest dependency closure was built. CI runs it.pnpm check:where-matcherfirst flagged the test double as a silent matcher. It now refuses combinators and operators it does not implement, and the check passes.node scripts/pm/overlap-check.mjs:VERDICT clean exit 0(origin/main c7478b3, 0 open PR heads share a file).Generated by Claude Code