Skip to content

perf(dashboard): Refresh only the open Conversation's Review items on a detail change - #3184

Merged
BYK merged 3 commits into
mainfrom
perf/side-reads-review-items
Nov 11, 2026
Merged

BYK merged 3 commits into
mainfrom
perf/side-reads-review-items

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

A new detail ETag invalidated every Review item read under ["dashboard", "review-items"]: the count, the waiting Conversations, every list, and every single item. Now it invalidates only the open Conversation's Review item list. The transcript's Review item rows read their items from that list.

What refreshes each read

reviewItemsNeedingUserVersionQuery is count(*) and max(updated_at) over reviewItemNeedsUser(userId). A change to an item's links (replaceLinks) always comes with an updated_at write.

Read Rows it reads Refreshed by
count countReviewItemsNeedingUser: same reviewItemNeedsUser filter reviewItems token
waiting-conversations listWaitingConversations: same filter, with title, plugin, created time and links reviewItems token
list for the open Conversation Open items linked to it, any assignee Detail ETag change
detail (review-items/:id) One item, for an item that the list leaves out Its own read

Change

  • refreshSideReadsOnChange now invalidates only reviewItemListQueryKey({ conversationId }), not the whole prefix. Its doc comment says why.
  • useConversationReviewItemData(conversationId, id) is new. It reads the item from the Conversation's list, using the same useReviewItemsData query. It reads review-items/:id by itself only when the list has loaded and leaves the item out: a closed item, an item on a later page, or an item that the viewer cannot read. The list and the single read use the same reviewItemSchema payload (reviewItemPayload), so a row has every field it shows.
  • ReviewItemChangeRow, ReviewItemChangeLabel and ReviewItemAskRow take conversationId and use the new hook. TranscriptEventView, TranscriptToolView, TranscriptMessageView and PendingMailboxStack pass it through.
  • useReviewItemAction still invalidates every Review item read when it settles. A row that someone answers, takes or dismisses refreshes right away. When an answer closes the item, the item leaves the open list and the row reads it by itself.
  • review-desk/queries.ts exports reviewItemListQueryKey, so the list key shape lives in one place.
  • Side-read key and refresh move from conversations/queries.ts to conversations/conversationSideReads.ts, so queries.ts stays under the 1,000-line limit.

No visible UI change.

Tests

  • tests/client-api.test.ts
    • The detail-ETag case now checks that the open Conversation's list is invalidated. It also checks that a single item, another Conversation's list, the count and the waiting Conversations are not invalidated.
    • A new case renders the hook against a cached list. A listed item comes from the list and creates no review-items/:id query. An item that the list leaves out gets its own read.
  • Passed: pnpm typecheck, pnpm lint, and the dashboard unit tests (62 files, 436 tests).

via @BYK.

--

View Session in Sentry

… a detail change

A new detail ETag refetched every Review item read: the count, the
waiting Conversations, every list and every single item. The count and
the waiting Conversations read only the open items that need the
viewer, which the reviewItems token in /api/versions already covers.
So a detail change now refreshes only the open Conversation's list and
the single items, which the token does not cover.

The side-read refresh moves to conversationSideReads.ts, which keeps
queries.ts under the file-length limit.

Co-Authored-By: BYK <[email protected]>
@vercel

vercel Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
junior-docs Ready Ready Preview Nov 11, 2026 3:53pm UTC

Request Review

@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 11, 2026
@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

221 screenshot changes — 0 changed · 221 added · 0 removed

Review screenshots in Frameshift

… list

Transcript Review item rows read their item from the open Conversation's
list and fetch it by itself only when the list leaves it out, such as a
closed item or one on a later page. A detail change now refreshes only
that list, not every single item.

Co-Authored-By: BYK <[email protected]>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b6ca954. Configure here.

…es the list

An item that closes leaves the Conversation's open list. Its row now
keeps the last listed item until its own read finishes, and a Review
item action seeds that read with the item it returns.
@BYK
BYK merged commit 89ef52f into main Nov 11, 2026
43 checks passed
@BYK
BYK deleted the perf/side-reads-review-items branch November 11, 2026 18:11
sentry-junior Bot added a commit that referenced this pull request Nov 11, 2026
…ne-nav

#3184 keys the Review item list by its filters; the Done list's
`closed` filter joins that key.

Co-Authored-By: BYK <[email protected]>
BYK added a commit that referenced this pull request Nov 17, 2026
Turns the perf patterns from #3184,
#2820, #2991, #3271,
#2921 and #3449 into checks that fail
CI, and fixes the code that breaks them. `policies/performance.md` lists
each rule and the check behind it. The DB and request budgets come in a
follow-up PR.

| Rule | Where | Fixed | Left |
| --- | --- | --- | --- |
| `unicorn/no-array-for-each` | root + dashboard | 43 | 0 |
| `query-invalidation/no-broad-query-invalidation` (new, dashboard JS
plugin) | dashboard `src` | 20 calls | 5 disable comments with reasons |
| `junior/bounded-fan-out` (new) | `packages/*/src` | 24 (19 behind
`pLimit`, 5 batched reads) | 13 disable comments naming the cap |
| `no-await-in-loop` | `packages/*/src` | 3 moved to bounded
`Promise.all`, 2 dashboard disables | 467 sites in 137 files, baselined
|

**`query-invalidation/no-broad-query-invalidation`** fails on
`invalidateQueries`, `refetchQueries`, `resetQueries` or `removeQueries`
when the key is missing, a literal of 2 or fewer parts, or a bare prefix
const, unless the call passes `exact: true`. The fixes:
- `invalidateConversationFeeds` replaces each `["dashboard",
"conversations"]` refresh.
- Rename writes the response title into the feeds and does not refetch.
- `reviewItemQueryKey` and `invalidateReviewItemCollections` let Review
item actions write item details from the response and refresh only
count, list and waiting conversations.

**`junior/bounded-fan-out`** flags
`Promise.all`/`allSettled(<list>.map(async …))` unless the callback
calls a `p-limit` limiter. A literal array is not flagged. Fixes use
limits of 5 for provider APIs and 8 for internal storage. Batched fixes
are `readSubscriptions` (one `mGet`) in `chat/events/store.ts` and
`getStateValues` in cache warming. `junior-github` gets a `p-limit`
dependency.

**`no-await-in-loop` uses a baseline** because 467 sites is too many to
triage safely in one PR. Many are intentionally sequential: cursor
pages, ordered writes, rate limits, stop-on-first-failure.
`tools/oxlint/await-in-loop.json` turns the rule off only for the listed
files, and `scripts/await-in-loop-baseline.json` holds their per-file
counts. `pnpm await-in-loop:check` (part of `pnpm lint`) fails when:
- a count goes up,
- a count goes down and the entry is not lowered or removed,
- the two file lists drift.

New files get the rule with no exemption.

**Automations exclusion:** Otto is rewriting this code in
#3570, so it is left alone. In the dashboard,
`pages/automations/**`, `inbox/pages/automations/**` and
`review-desk/inboxQueries.ts` have `no-broad-query-invalidation` and
`no-await-in-loop` turned off. The server-side Automations files sit in
the `no-await-in-loop` baseline like any other file. None of them had
fan-out sites. Remove the dashboard override when that rewrite lands.

<!-- junior-request-attribution:start -->
via @BYK.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:agent%3A7e1432c2f4a2110ee7bb48718f8b6fad -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/agent%3A7e1432c2f4a2110ee7bb48718f8b6fad)
[[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A7e1432c2f4a2110ee7bb48718f8b6fad/?project=4510944073809921)

<!-- junior-session-footer:end -->

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: BYK <[email protected]>

This branch was successfully deployed

1 active deployment
Preview – junior-docs — 6643400d Deployed Nov 11, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant