Repository navigation
ref(lint): Enforce bounded async work and narrow query refreshes - #3573
Merged
Merged
Conversation
Add oxlint rules for unbounded Promise.all fan-out and for broad dashboard query invalidation, turn on no-await-in-loop and unicorn/no-array-for-each, and fix the existing sites. no-await-in-loop keeps a shrink-only baseline for package source. policies/performance.md lists each rule and its check. Co-Authored-By: BYK <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit f2e8a61. Configure here.
BYK
approved these changes
Nov 17, 2026
BYK
enabled auto-merge (squash)
November 17, 2026 13:14
Contributor
|
5 screenshot changes — 5 changed · 0 added · 0 removed Review screenshots in Frameshift |
This was referenced Nov 17, 2026
BYK
added a commit
that referenced
this pull request
Nov 17, 2026
…3578) Follow-up to review on #3573. - The `p-limit` fan-outs in `@sentry/junior` that each had their own cap of 8 now use one `FAN_OUT_CONCURRENCY` constant from `src/chat/fan-out.ts`. Caps of 5 for Slack lookups and plugin message sends stay local, because a provider rate limit sets them. `policies/performance.md` points at the constant. - Renaming a Conversation no longer refetches every feed, so the feed cache must hold the new title. It wrote the title only to top-level feed rows, and a renamed Thread nested under its parent row kept its old title. The rename now uses the same nested-row patch as archive, renamed from `markFeedConversation` to `patchFeedConversation`. <!-- 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]>
BYK
pushed a commit
that referenced
this pull request
Nov 17, 2026
First follow-up to the `no-await-in-loop` baseline from #3573. It clears every baseline file outside `packages/junior/src/chat`: 172 sites in 48 files. The baseline goes from 467 sites in 137 files to 295 sites in 89 files. **Fixed: about 52 sites, now run at once or batched** - `auto-archive`: one `UPDATE … WHERE conversation_id IN (…)` per page replaces one `UPDATE` per root. - memory store: one `inArray` read of alias targets. - Slack message links: look up all linked workspace domains at once. - Pending messages: read both web actor ids at once. - `junior check`: look for app markers at once. - github: parallel reaction deletes, notice closes and legacy item closes. Per-ref conflict checks and per-target syncs use p-limit at 5, under GitHub rate limits. - Test setup: read migrations at once, then apply them in order. One multi-statement sequence reset. Parallel `pool.end`. - Eval fixtures: delete auth state for all providers and users at once. **Disabled with a reason: 120 sites that must stay in order** - Pagination cursors, polls, retries and REPL loops. - Webhook and event publishes that keep delivery order. Ordered migrations. - Stream output (ACP transport). - `junior check` loops whose "first name wins" duplicate maps depend on order, and its local file reads. - Eval history replay and recorded uploads. - Sweeps and heartbeats that stay sequential under GitHub rate limits. Long loops use one `/* oxlint-disable no-await-in-loop -- reason */` block. Loops with one or two sites use next-line comments. A few loop bodies moved to functions (`reconcilePullRequest`, `checkConflict`, `prepareCheckout`, `refreshCheckout`), so one comment covers each loop. **Still in the baseline** - `packages/junior/src/chat`: 292 sites in 88 files. They follow in the next PRs. - `junior-google/src/tools/read-meeting-transcript.ts`: 3 sites. Its Drive reads can run at once, but `meet.test.ts` gives responses in call order. The fix needs a URL-routed fake, so it goes with the chat PRs. `junior-github` keeps local named caps (5 for GitHub calls, 8 for internal work), because a plugin does not import core internals. Core sites here do not use the shared `FAN_OUT_CONCURRENCY` from #3578 yet, so this PR does not depend on it. <!-- 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>
BYK
added a commit
that referenced
this pull request
Nov 17, 2026
Adds round-trip budgets for hot API routes and dashboard pages, so new code cannot quietly add SQL statements, serial rounds or page requests. #3573 added the matching lint rules. `expectSqlBudget` counts the SQL statements of one request and its serial rounds: the longest chain of statements where each one waits on the one before. It reads the `orchestrion:pg:query` and `orchestrion:pg-pool:connect` tracing channels. Sentry's Postgres integration reads the same channels to make database spans. In a production build, the Sentry Rollup plugin injects them into `pg`. In tests, `tests/fixtures/pg-tracing-hook.ts` injects them with the `--import` hook that Vitest passes to its workers. That hook uses Sentry's load-hook transform and covers only `pg` and `pg-pool`. Runtime code gets no wrapper, and the executor needs no test-only config. A `pool.query` statement starts when it is called, not when a client is free, so the count does not depend on the pool size. SQL budgets cover the conversation list, conversation detail, child agents, versions, and the review item list, count and waiting conversations. `expectRequestBudget` covers the first load of the home page, a conversation, and the review desk. Each budget equals the current value. The review desk read the selected item's Conversation twice on load: once for its full detail and once for its title. The title read now takes the title from the detail when the detail is cached or in flight, so the review desk budget drops from 10 requests to 9. Automations routes have no budget yet, because Otto's follow-up to #3570 still changes them. `policies/performance.md` gets the budget rules. <!-- 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 was referenced Nov 17, 2026
24 tasks done
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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.mdlists each rule and the check behind it. The DB and request budgets come in a follow-up PR.unicorn/no-array-for-eachquery-invalidation/no-broad-query-invalidation(new, dashboard JS plugin)srcjunior/bounded-fan-out(new)packages/*/srcpLimit, 5 batched reads)no-await-in-looppackages/*/srcPromise.all, 2 dashboard disablesquery-invalidation/no-broad-query-invalidationfails oninvalidateQueries,refetchQueries,resetQueriesorremoveQuerieswhen the key is missing, a literal of 2 or fewer parts, or a bare prefix const, unless the call passesexact: true. The fixes:invalidateConversationFeedsreplaces each["dashboard", "conversations"]refresh.reviewItemQueryKeyandinvalidateReviewItemCollectionslet Review item actions write item details from the response and refresh only count, list and waiting conversations.junior/bounded-fan-outflagsPromise.all/allSettled(<list>.map(async …))unless the callback calls ap-limitlimiter. A literal array is not flagged. Fixes use limits of 5 for provider APIs and 8 for internal storage. Batched fixes arereadSubscriptions(onemGet) inchat/events/store.tsandgetStateValuesin cache warming.junior-githubgets ap-limitdependency.no-await-in-loopuses 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.jsonturns the rule off only for the listed files, andscripts/await-in-loop-baseline.jsonholds their per-file counts.pnpm await-in-loop:check(part ofpnpm lint) fails when: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/**andreview-desk/inboxQueries.tshaveno-broad-query-invalidationandno-await-in-loopturned off. The server-side Automations files sit in theno-await-in-loopbaseline like any other file. None of them had fan-out sites. Remove the dashboard override when that rewrite lands.via @BYK.
--
View Session [Sentry]