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
Commit ac14a74
Browse filesBrowse the repository at this point in the historyBrowse files
fix(app-shell): count the record discussion reaction read's batches against the row budget as one read (#39342)
Fixes#39313
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 设了单次读取行数上限的部署上,超过 100
条评论的记录,列表页评论栏和手机评论页对表情回应的判断改为与记录页一致:整串评论的表情回应合计超上限时都不显示,合计没超时都显示。
- 属于记录评论专题,替这类部署上的用户解决「同一条记录的表情回应在记录页被拒、在列表页却显示」的不一致。
- 只影响这类部署上评论超过 100
条且表情回应接近上限的记录;最坏情况是多发一次只取一行的读取,或表情回应不显示而评论照常显示,改动可直接撤回。
- 无
## What changes
On a deployment with `OS_DATA_QUERY_ROW_BUDGET`, the record page payload
(`readReactions` in `packages/rest/src/record-page-routes.ts`) counts
every id chunk's reaction rows against the budget, so the thread's
reactions together past the budget refuse the `reactions` part. The
client's direct read (`readCommentReactionRows` in
`ui/packages/app-shell/src/views/useRecordDiscussion.ts`, used by the
list-page comments column, the phone comments page and every comment
read the payload does not serve) reads the thread in batches of
`REACTION_READ_COMMENT_IDS` (100) comment ids, in parallel, each batch
its own query, so the door judged each batch alone. A thread over 100
comments whose reactions together were past the budget, with no batch
past it, showed its reactions there and none on the record page.
Premise re-read on `main` at 6b2e596 (includes #39308 and #39309):
holds as the card states.
The fix keeps the batches parallel and adds the one thing the door could
not see: when more than one batch answered rows, the client asks the
door its own budget rule of the whole walk, with one read of the last
answering batch at `$skip` = (rows read together) minus 1 and `$top` =
1. The door judges `$skip` plus `$top` against the budget before it runs
anything (`planQueryReadWindow`), so it refuses exactly when the rows
together are past the budget, the same rule `budgetRefusalOfWalk`
applies server side. The client never learns or infers the budget
number; the door's `QUERY_ROW_BUDGET_EXCEEDED` rejects the read, as a
page past the budget already does, and the caller shows the comments
without reactions, as the payload's refused part does. A `400` that is
not the budget's leaves the rows standing (as a later page's does in
`readEveryPage`); a failure or a refusal rejects. Cost: one extra
one-row GET, only for a thread whose reactions span more than one
100-comment batch. No new client or server surface, and the data door's
budget means the same for every other consumer. `record-page-routes.ts`
is unchanged: the payload already applies the rule; its test file gains
the twin table.
Files edited:
- `ui/packages/app-shell/src/views/useRecordDiscussion.ts`
- `ui/packages/app-shell/src/views/useRecordDiscussion.test.tsx`
- `packages/rest/src/record-page-routes.test.ts`
- `.changeset/39313-reaction-read-budget-one-walk.md`
(`@object-ui/app-shell` patch)
Read first:
1. `readCommentReactionRows` in `useRecordDiscussion.ts`: the walk read
and its catch (which verdicts reject, which leave rows standing).
Highest risk: the `$skip` arithmetic (rows read together minus 1, `$top`
1).
2. The new `#39313` describe in `useRecordDiscussion.test.tsx`: the door
double filters by `comment_id` `$in` and applies the page/budget rule
per query.
3. The `[#39313]` describe in `record-page-routes.test.ts`: the same
case table against the payload.
## Tests
Both doors are pinned with one case table (150 comments, so two client
batches; reactions on comment 1 and comment 101; budget 10): rows
together past the budget with no batch past it (6 + 6), with and without
a page size of 4, are declined on both; rows that fit exactly (5 + 5,
and 6 + 4 paged) are shown on both; one batch past the budget (11 + 0, 0
+ 11 paged) is declined on both. One more client test pins the walk
read's window (`[11, 1]` for 6 + 6) and that a thread whose reactions
sit in one batch sends none.
<details><summary>Local runs at fb3b009</summary>
- `pnpm --dir ui exec vitest run --maxWorkers=2
packages/app-shell/src/views/useRecordDiscussion.test.tsx
packages/app-shell/src/views/ObjectView.phoneCommentsPage-39086.test.tsx`:
2 files, 40 passed.
- The seven `RecordDetailView.*` suites that read
`sys_comment_reaction`: 7 files, 71 passed.
- `pnpm --filter @objectstack/rest exec vitest run --maxWorkers=2
src/record-page-routes.test.ts`: 60 passed (the 6 new `[#39313]` cases
confirmed by `-t 39313 --reporter=verbose`: 6 passed, 54 skipped).
- `@object-ui/app-shell` `type-check` (src + `tsconfig.test.json`): exit
0, after building its dependency closure. `@objectstack/rest`
`typecheck` (tsc + check:test-typecheck): exit 0.
- Ablation (committed first, `scripts/ablation-replace.mjs`, anchor `if
(answering.length > 1) {` replaced by `if (answering.length > 1 &&
false) {`, landed x1 to x0, blob 6a0a093 to b8619467): 3 failed, 21
passed; the two "rows together past the budget, no batch past it" cases
and the walk-window test went red. Restored: blob equals HEAD, `git diff
HEAD` empty.
</details>
## Acceptance notes
- Observation C (read, not measured): the reaction read gate's candidate
pre-scan (`computeReactionVisibilityFilter` in
`packages/plugins/plugin-audit/src/comment-access-hooks.ts`,
`READ_SCAN_LIMIT` = 2,000) reads at most 2,000 reaction rows of the
read's `where` in the caller's order, under system context, and narrows
the read to `comment_id` in the comments those rows name. A comment none
of whose reactions falls in those first 2,000 rows is filtered out, fail
closed, with one warn line. Its own comment says a comment feed "never
hits this", but one 100-comment client batch or one 500-id payload chunk
with more than 2,000 reaction rows does, and the two doors hit it at
different sizes. It bites only with no budget or a budget over 2,000.
Not changed here (outside this card's file surface); reported to the
seat.
- The walk read returns at most one row, which is not used.
## Verification
Two-minute check: `pnpm --dir ui exec vitest run
packages/app-shell/src/views/useRecordDiscussion.test.tsx -t 'past one
reaction batch'`, expect 7 passed. Gates: `node
scripts/pm/dispatch-gates.mjs --ran` over the 68 derived commands at
fb3b009: 66 run with exit 0, 2 NOT MEASURED (exit 3, prerequisite not
met: `check-plugin-teardown-shape.mjs --self-test` needs an unshallowed
clone; `check:dual-build-cjs-loads` needs every package's `dist`).
`overlap-check.mjs`: clean against origin/main 170f9f8, 0 PR heads.
Every other family is CI's.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01Utp6Ca2yTZZiHWkyVgD2oK)_
---------
Co-authored-by: Claude <noreply@anthropic.com>
fix(app-shell): a record discussion's reaction read counts the row budget over the whole thread, as the record page does
6
+
7
+
Clause-②: no
8
+
Metadata-protocol: none
9
+
10
+
On a deployment with a row budget (`OS_DATA_QUERY_ROW_BUDGET`), the record page payload refuses a discussion's reactions when the thread's reaction rows together are past the budget, while the list page's comments and the phone comments page read a thread of more than 100 comments in batches of 100 comment ids and let the budget judge each batch alone. So a thread whose reactions together were past the budget, with no batch past it, showed its reactions on those surfaces and none on the record page. Those surfaces now read the batches as one read: when more than one batch has reactions, the server is asked its own budget rule of the whole read (one extra one-row read), and rows together past the budget show the comments without reactions, as the record page does; reactions that fit are all shown, as before.
0 commit comments