Repository navigation
Conversation
ymichael
force-pushed
the
bb/make-the-react-compiler-authoritative-in-the-app-thr_ynmbasp5aj
branch
4 times, most recently
from
November 17, 2026 05:00
840faef to
7967158
Compare
ymichael
added a commit
that referenced
this pull request
Nov 17, 2026
…hole timeline per push (#7613) ## Human comments ## What was wrong Streaming a long answer cost more per push the longer the answer got, in three places (perf audit hotspot 1, thr_qgyt9gkt9f): - **Wire.** A timeline delta upserted every changed row whole, so each push re-sent the full accumulated message text (up to ~27 KB per frame). - **Render.** Block-incremental markdown re-cloned every settled piece on every new body, so React re-rendered the entire settled message on each push. Mounting a table also walked its ancestors with `getComputedStyle` in a layout effect, forcing a style recalc. - **Layout.** The page scrollers (`data-page-scroll-viewport`) were also `@container/page` query containers. A scroll container that is a size container makes Blink lay out its whole scrolled subtree on every content change. An append that dirtied 27 layout objects still took ~8–10 ms of layout at 4× CPU, and in the trace that cost grew with the number of mounted objects. `scroll-position-keeper` `apply` was the top self-time entry because it was the first to read layout after each commit. ## What changed - **Append-only deltas** (`packages/server-contract`) - New optional field `delta.patchRows: { id, ops }[]` for rows the base window already holds. Ops are `["append", path, text]`, `["set", path, value]` and `["delete", path]` on JSON paths inside the row. - `computeThreadTimelineDelta` diffs each changed row. A string that grew at its end becomes an `append`. `upsertRows` now carries only rows that are new to the window. - `applyThreadTimelineDelta` applies patches with structural sharing. It returns `null`, and the client refetches instead of rendering the row, when an op does not fit the held row (a path that does not exist, an append to a non-string, an index past the end) or when the result changes the row's `id` or `kind`. - The patched row is not re-validated against `timelineRowSchema`. A delta applies only to the window whose tag it names, so the client patches exactly the row the server diffed against, and full rows in `upsertRows` are not schema-checked on the client either. Leaving the schema out keeps it off the boot path without a registry, and applying stays synchronous. - In a live stream on the built branch, every delta push applied with no timeline refetch, and the rendered message matched the server's text. - I chose JSON-path ops over a typed per-field append contract. Every streamed push also changes `sourceSeqEnd`, `createdAt` and `messageSeq`, and streamed output lives under different fields per row kind (message `text`, command and tool `output`, delegation `output`), so a typed contract would need a field list for each row kind. - HTTP reads with `afterTag` and WebSocket pushes share this code. The daemon wire is unchanged, so `HOST_DAEMON_PROTOCOL_VERSION` is not bumped. Documented in `docs/timeline-pagination.md`. - **Settled markdown stays put** (`markdown-incremental-pieces.ts`) - Reused pieces keep their elements and directive mounts by identity, so React skips them. - `MountedMessageDirectiveView` is now a memo boundary keyed on the mount. - The raw thread-mention hooks used to read the query cache without subscribing and depended on that re-render to pick up titles. They now subscribe to their cache entries. I copied this part verbatim from #7603, which makes the same change, so whichever PR lands first, the other rebases cleanly. - **Table geometry** (`markdown-preview.tsx`): the breakout width adds `--page-container-inset-end` to `100cqw`, because the page container now sits inside the context-card inset. Resolving the clip ancestor lazily instead of in the mount layout effect landed separately in #7612, so this PR no longer changes it. - **Query containers moved off scrollers** - `bottom-anchored-scroll-body` (thread timeline): the container moves to the existing content child. The context-card inset is passed as `--page-container-inset-end`, so the table breakout's `100cqw` math stays identical. - Static `PageShell`, `RootComposeHome` (non-compact) and the tasks list: a plain container wrapper inside the scroller. - Plugin Guide: the size container moves to the existing outer element. The `3cqh` stage gap subtracts the scroller padding it no longer sees, so the gap is unchanged. - New guard `scroll-container-queries.test.ts` fails on any class string that makes one element both a scroll container and a query container. It flags all five of these on main. I added the rule to AGENTS.md (UI). Not changed: how `TimelineWindowedItems` mounts rows. #7612 has since changed that path; this PR does not touch it. Old tabs: a tab still running the previous app ignores `patchRows`. That is acceptable because `AppUpdateHost` reloads the page when the server's version or commit changes, and the mobile and desktop apps load the app from the server. Refs #6816. ## How you verified **Benchmark.** Production builds of main (`da3e60b81d`) and this branch, each served by `pnpm start:worktree` with the same seeded 500-thread fixture and stream provider. The stream was 4 × 24 KB markdown messages with 3 streamed commands (`stream:120:40 rep:8`) into the 2.9k-item thread, with 48 characters typed during the stream. Headless Chrome 145 at 1600×1000. Three rounds, alternating main and branch run by run on a loaded machine. Medians of 3: | | main 1× | branch 1× | main 4× | branch 4× | |---|---|---|---|---| | Typing 48 chars during the stream | 3.37 s | 3.12 s | 5.51 s | **4.18 s** | | Long animation frames (count / total) | 3 / 243 ms | 3 / 223 ms | 187 / 17.9 s | **78 / 6.9 s** | | Frames > 100 ms | 0 | 0 | 55 | **10** | | Forced style + layout in LoAF | 92 ms | 83 ms | 9.8 s | **3.3 s** | | Layout time (`Performance.getMetrics`) | 2.78 s | 0.83 s | 10.4 s | **3.6 s** | | WebSocket bytes received | 3.48 MB | **0.55 MB** | 3.51 MB | **0.55 MB** | - **After the rebase onto #7599 and #7612, without patched-row validation** (echo provider streaming 199 chunks of paragraphs, links, inline code, tables and code blocks, about 25 KB, every 40 ms, into a thread with 8 earlier answers of that size; headless Chrome 1600×1000 at 4× CPU, typing 48 characters during the stream; main measured before those PRs landed, so this is not a strict A/B): - Timeline WebSocket bytes 1.46 MB → 0.15 MB; the last push 27.5 KB → 1.3 KB. - Layout 3.8 s → 0.33–0.35 s; long animation frames 68–72 → 4; forced style and layout 2.9 s → 40–48 ms; typing 5.7–6.0 s → 2.4–2.5 s. - **Wire.** Timeline frames for the same stream fell from 3.50 MB to 0.47 MB of deltas, with the same final text length. About 210 KB of the rest is `timelinePage.olderCursor` and `historySnapshot`. Both embed `maxSeq`, so they change on every push (~760 B each time). That cost is constant per push and does not grow with the answer, so I left it. - **Layout probe.** Appending text to the last paragraph of a 24 KB message and then reading layout costs 6–10 ms at 4× with the container on the scroller, and 1.4 ms with it on the child. `contain: layout` on rows, blocks or the preview, and replacing the flex columns with blocks, made no difference. - **iOS 18.4 Simulator Safari** (iPhone 16 Pro, same stream, alternating; noisy because another simulator was running on the same CPU): - Painted frames over the stream went from 352–468 to 548–612. Frame p95 went from 230–507 ms to 186–196 ms, and typing p95 from 243–1,187 ms to 275–353 ms. - Frames over 100 ms did not change (44–53). - WebKit does not have the container cost: both placements laid out in under 1 ms. - **Layout parity.** I compared the bounding rect of every text-bearing element on main and on this branch: a thread, Settings, Settings › Appearance, home, Tasks and the Plugin Guide, at 1600×1000, plus home, a thread and Settings at 500×900. They are identical except timestamp and relative-date text, because the two fixtures were seeded minutes apart. **Tests.** Each new test fails on main and passes here. - `thread-timeline-delta.test.ts` - A grown message row is sent as an `append` of only the new text; the delta does not contain the old text. - 300 random steps of growth, rewrites, added and removed keys and nested arrays round-trip exactly. - Patches that do not fit (append to a non-string, a missing key, an unknown row) return `null`. - A `__proto__` key stays data. - A patch that changes a row's `id` or `kind` returns `null`. - `thread-timeline-push.test.tsx`: a pushed row patch is applied, and a patch that does not fit the held row leaves the cache unchanged and refetches with the held tag. - `markdown-incremental-pieces.test.ts`: settled pieces keep their elements and directive mounts by identity when the body grows. - `markdown-preview.incremental.test.tsx` - While content grows, the DOM only gains nodes for new blocks; nothing inside a settled block is mutated or removed. On main, settled links get attribute rewrites on every body. - A settled plugin directive renders once and does not re-run its attribute effect. - `scroll-container-queries.test.ts` (the guard above). **Commands.** - `pnpm exec turbo run typecheck --filter=@bb/app --filter=@bb/server-contract --filter=bb-plugin-tasks --filter=bb-plugin-plugin-api-docs` - `pnpm exec turbo run lint` on the same packages: no new findings. - `pnpm exec turbo run test --filter=bb-plugin-tasks --filter=bb-plugin-plugin-api-docs` - Targeted vitest: the server timeline delta, push, scrollback, event-budget and pruning tests (78 passed); app markdown, timeline-push, scroll-keeper, page-shell, RootComposeHome and ThreadTitleMentions tests; and client-core `timeline-merge`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) > AGENT GENERATED --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
The compiler skipped 95 functions in apps/app and 6 in shared-ui (hot paths included), the rules that report those skips were warnings, and vitest ran without the compiler. Fix every skip, turn the compiler lint rules into errors for both packages, fail the app build on any compiler bailout, and run the compiler in both vitest configs. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The SDK bundles query-tags, whose selector cache changed, so its published files differ. The markdown-scroll test flipped a mock flag and rerendered with identical props; the mock is now a store. The remote checkout test saved before the lazily loaded remote browser fetched its listing; it now waits for that listing first. Co-Authored-By: Claude Opus 5.5 <[email protected]>
About 100 functions the React Compiler used to skip now carry memo caches, which adds 2 KB brotli to the boot payload. Also drop a leftover unused test binding. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Three changes that landed on main after this branch broke its compiler guards. The /handoff thread creation used try/finally, which the compiler skips, so it moves into a module-level helper like the other procedures. SplitThreadArea recorded the reconciled route content with setState in an effect; it now records the reconciliation during render and treats it as written once the stored layout moves past the layout it was derived from. TimelineWindowedItems scheduled its pending frame with ??=, which the compiler skips, so it uses an explicit check. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The wrapper existed so the compiler would accept passing the measuring ref callback into renderItem, but renderItem changes on every timeline push, so the wrapper re-rendered for every finished row and the render invariant suite caught it. The callback only reached a ref through the measurement revision counter; that counter now lives beside the measurements map, so renderItem is called directly again as on main. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Every markdown preview subscribed to the whole query cache to keep raw thread-mention titles live, even when it held no thread ids. With no ids there is nothing to watch, so it keeps the no-op store instead. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… note Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
force-pushed
the
bb/make-the-react-compiler-authoritative-in-the-app-thr_ynmbasp5aj
branch
from
November 17, 2026 05:09
7967158 to
2f0b523
Compare
ymichael
deleted the
bb/make-the-react-compiler-authoritative-in-the-app-thr_ynmbasp5aj
branch
November 17, 2026 05:14
VKirill
pushed a commit
to VKirill/bb
that referenced
this pull request
Nov 24, 2026
- packages/db/src/data/index.ts went to export * per module: keep the named isVkQuietChildThread export the inventory checks. - React Compiler is authoritative in apps/app (get-bb#7603): the image editor and experimental_vkAttachFiles refs are written in layout effects, not in render. - VK_PATCHES: the plugin-authoring api-index files are generated since 0.50. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 26, 2026
ymichael
pushed a commit
that referenced
this pull request
Nov 30, 2026
## Human comments ## What was wrong The React Compiler transform cache from #3520 ran only for `vite build`. `cachedReactCompiler()` returned from `configResolved` before it set up the cache whenever `config.command !== "build"`, so the dev server compiled every module again on each start. `testReactCompiler()`, which `apps/app/vitest.config.ts` uses since #7603, returned a plain Babel plugin with no cache. On app shard 3/8 the Babel pass was 80-91 s of Vitest transform time in a 113-131 s run. I measured the shard and a dev server start before changing anything (numbers below). #3520 gives no reason for the build-only limit, and the cache key already separates build, dev and test: Vite mode, `isProduction`, Vite environment, the content of each config file dependency (`vite.config.ts` and `vitest.config.ts` differ), `NODE_ENV`, `BABEL_*`, and the Node version and flags. ## What changed - `apps/app/vite-react-compiler.ts`: the cache wrapper takes the Babel options, and both `cachedReactCompiler()` and `testReactCompiler()` go through it. The `command !== "build"` early return is gone; `ENABLE_REACT_COMPILER_TIMINGS=1` and `BABEL_SHOW_CONFIG_FOR` still bypass the cache. The "React Compiler cache: N hits, M misses" line still prints for builds only, so test and dev output do not change. - Docs: `docs/configuration.md` and `docs/debugging-and-qa.md` say that builds, the dev server and tests use the cache. `docs/ci-performance.md` records the shard measurement and says that CI app test shards do not restore or save the cache. The cache still has no size limit, as for builds today; a dev server edit adds one entry for the edited module. No wire, CLI, protocol or CI workflow changes. `packages/shared-ui/vitest.config.ts` keeps its own inline preset; its suite is 65 tests. A cached result cannot change a test or dev result, only skip a Babel run. The key covers the source, the module id, the module type, the Vite environment and the compiler namespace above. A result that holds a worktree path, does not parse, or is corrupt on disk falls back to a fresh compile, as it does for builds today. ## How you verified New test in `apps/app/src/test/react-compiler-cache.test.ts`: "reuses dev server compiler output across servers" (`cachedReactCompiler`) and "reuses test compiler output across servers" (`testReactCompiler`). Each starts a Vite dev server twice on the same cache directory, transforms one component, and expects 1 miss and then 1 hit with identical code. Before the fix (origin/main `vite-react-compiler.ts`): ``` FAIL src/test/react-compiler-cache.test.ts > reuses dev server compiler output across servers AssertionError: expected { hits: +0, misses: +0 } to deeply equal { hits: +0, misses: 1 } FAIL src/test/react-compiler-cache.test.ts > reuses test compiler output across servers TypeError: Cannot read properties of undefined (reading 'compilerCache') Tests 2 failed | 4 passed (6) ``` After the fix: `Tests 6 passed (6)`. App shard 3/8, run like the Linux CI shard (`BB_CI_TEST_SHARD=3/8 VITEST_MAX_WORKERS=2`, pinned to four CPUs with `taskset`), Node 26, two alternating rounds: | Run | Round 1 wall | Round 2 wall | Vitest transform | |---|---|---|---| | origin/main | 131.2 s | 113.2 s | 90.8 s, 80.3 s | | Fix, empty cache | 113.1 s | 98.5 s | 90.2 s, 70.9 s | | Fix, warm cache | 64.5 s | 62.9 s | 14.7 s, 14.4 s | All six runs gave the same 701 test results (file, full name, status), compared from the Vitest JSON reports: 698 passed, 3 skipped. The shard's cache directory holds 43 MB. CI starts each app shard with an empty cache, so the "Fix, empty cache" row is the CI case: 18.1 s and 14.7 s less per shard (14% and 13%), because the shared and isolated Vitest projects transform the same modules in one run and the second project reuses the first one's output. The "warm cache" row is what a local rerun gets: 66.7 s and 50.3 s less per shard (51% and 44%). Dev server, created from `apps/app/vite.dev.config.ts`, transforming `src/main.tsx`, `AppLayout.tsx`, `ThreadDetailView.tsx` and `TimelineWindowedItems.tsx` with their pre-transformed imports, two server starts each: | Build | First start | Second start | Cache | |---|---|---|---| | origin/main | 15.7 s | 14.1 s | 0 hits, 0 misses | | Fix | 15.3 s | 2.1 s | 1/807, then 794/11 hits/misses | I did not run CI, so the CI saving is not measured. The tables above are local measurements on one machine. ## CI option left out App test shards could restore and save the compiler cache in CI with a per-shard key (`cache-react-compiler` with a `cache-prefix: test-<shard>-` input, for the 8 Linux and 4 Windows app shards). That would give CI the warm-cache row: 48.6 s and 35.6 s less per Linux shard than the empty-cache row, measured locally. This PR does not do it because of the cost: each run that tests the app would save 12 new entries of about 43 MB (about 0.5 GB), keyed on the commit, against the 10 GB Actions cache quota that the Turbo caches also use (GitHub-visible caches held 7.4 GB on 2026-11-26). `scripts/cleanup-actions-caches.mjs` deletes only pnpm store entries, not react-compiler entries, so the new entries could evict Turbo caches, which save more. A maintainer can ask for this option in a comment. Checks: - `pnpm exec turbo run typecheck test lint lint:type-aware --continue --filter=@bb/app`: all 10 tasks pass; 705 test files, 7485 passed, 20 skipped (run with `LANG=en_US.UTF-8`, because `UpdatePluginDialog.test.tsx` formats dates by the system locale); lint and lint:type-aware report 0 warnings and 0 errors Fixes #8226 > AGENT GENERATED
scowalt
pushed a commit
to scowalt/bb
that referenced
this pull request
Dec 1, 2026
…bb#8227) ## Human comments ## What was wrong The React Compiler transform cache from get-bb#3520 ran only for `vite build`. `cachedReactCompiler()` returned from `configResolved` before it set up the cache whenever `config.command !== "build"`, so the dev server compiled every module again on each start. `testReactCompiler()`, which `apps/app/vitest.config.ts` uses since get-bb#7603, returned a plain Babel plugin with no cache. On app shard 3/8 the Babel pass was 80-91 s of Vitest transform time in a 113-131 s run. I measured the shard and a dev server start before changing anything (numbers below). get-bb#3520 gives no reason for the build-only limit, and the cache key already separates build, dev and test: Vite mode, `isProduction`, Vite environment, the content of each config file dependency (`vite.config.ts` and `vitest.config.ts` differ), `NODE_ENV`, `BABEL_*`, and the Node version and flags. ## What changed - `apps/app/vite-react-compiler.ts`: the cache wrapper takes the Babel options, and both `cachedReactCompiler()` and `testReactCompiler()` go through it. The `command !== "build"` early return is gone; `ENABLE_REACT_COMPILER_TIMINGS=1` and `BABEL_SHOW_CONFIG_FOR` still bypass the cache. The "React Compiler cache: N hits, M misses" line still prints for builds only, so test and dev output do not change. - Docs: `docs/configuration.md` and `docs/debugging-and-qa.md` say that builds, the dev server and tests use the cache. `docs/ci-performance.md` records the shard measurement and says that CI app test shards do not restore or save the cache. The cache still has no size limit, as for builds today; a dev server edit adds one entry for the edited module. No wire, CLI, protocol or CI workflow changes. `packages/shared-ui/vitest.config.ts` keeps its own inline preset; its suite is 65 tests. A cached result cannot change a test or dev result, only skip a Babel run. The key covers the source, the module id, the module type, the Vite environment and the compiler namespace above. A result that holds a worktree path, does not parse, or is corrupt on disk falls back to a fresh compile, as it does for builds today. ## How you verified New test in `apps/app/src/test/react-compiler-cache.test.ts`: "reuses dev server compiler output across servers" (`cachedReactCompiler`) and "reuses test compiler output across servers" (`testReactCompiler`). Each starts a Vite dev server twice on the same cache directory, transforms one component, and expects 1 miss and then 1 hit with identical code. Before the fix (origin/main `vite-react-compiler.ts`): ``` FAIL src/test/react-compiler-cache.test.ts > reuses dev server compiler output across servers AssertionError: expected { hits: +0, misses: +0 } to deeply equal { hits: +0, misses: 1 } FAIL src/test/react-compiler-cache.test.ts > reuses test compiler output across servers TypeError: Cannot read properties of undefined (reading 'compilerCache') Tests 2 failed | 4 passed (6) ``` After the fix: `Tests 6 passed (6)`. App shard 3/8, run like the Linux CI shard (`BB_CI_TEST_SHARD=3/8 VITEST_MAX_WORKERS=2`, pinned to four CPUs with `taskset`), Node 26, two alternating rounds: | Run | Round 1 wall | Round 2 wall | Vitest transform | |---|---|---|---| | origin/main | 131.2 s | 113.2 s | 90.8 s, 80.3 s | | Fix, empty cache | 113.1 s | 98.5 s | 90.2 s, 70.9 s | | Fix, warm cache | 64.5 s | 62.9 s | 14.7 s, 14.4 s | All six runs gave the same 701 test results (file, full name, status), compared from the Vitest JSON reports: 698 passed, 3 skipped. The shard's cache directory holds 43 MB. CI starts each app shard with an empty cache, so the "Fix, empty cache" row is the CI case: 18.1 s and 14.7 s less per shard (14% and 13%), because the shared and isolated Vitest projects transform the same modules in one run and the second project reuses the first one's output. The "warm cache" row is what a local rerun gets: 66.7 s and 50.3 s less per shard (51% and 44%). Dev server, created from `apps/app/vite.dev.config.ts`, transforming `src/main.tsx`, `AppLayout.tsx`, `ThreadDetailView.tsx` and `TimelineWindowedItems.tsx` with their pre-transformed imports, two server starts each: | Build | First start | Second start | Cache | |---|---|---|---| | origin/main | 15.7 s | 14.1 s | 0 hits, 0 misses | | Fix | 15.3 s | 2.1 s | 1/807, then 794/11 hits/misses | I did not run CI, so the CI saving is not measured. The tables above are local measurements on one machine. ## CI option left out App test shards could restore and save the compiler cache in CI with a per-shard key (`cache-react-compiler` with a `cache-prefix: test-<shard>-` input, for the 8 Linux and 4 Windows app shards). That would give CI the warm-cache row: 48.6 s and 35.6 s less per Linux shard than the empty-cache row, measured locally. This PR does not do it because of the cost: each run that tests the app would save 12 new entries of about 43 MB (about 0.5 GB), keyed on the commit, against the 10 GB Actions cache quota that the Turbo caches also use (GitHub-visible caches held 7.4 GB on 2026-11-26). `scripts/cleanup-actions-caches.mjs` deletes only pnpm store entries, not react-compiler entries, so the new entries could evict Turbo caches, which save more. A maintainer can ask for this option in a comment. Checks: - `pnpm exec turbo run typecheck test lint lint:type-aware --continue --filter=@bb/app`: all 10 tasks pass; 705 test files, 7485 passed, 20 skipped (run with `LANG=en_US.UTF-8`, because `UpdatePluginDialog.test.tsx` formats dates by the system locale); lint and lint:type-aware report 0 warnings and 0 errors Fixes get-bb#8226 > AGENT GENERATED
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.
Human comments
What was wrong
The React Compiler silently skipped 95 functions in
apps/appand 6 inpackages/shared-ui, among them the hot paths:ThreadTimelineRowsForTimelineView,TimelineWindowedItems,ThreadDetailViewInternal,useComposerRendererHostApi,AppLayout,SidebarNavigationModeland shared-uiquestion-form. Most of the skips were refs read or written during render. The rest were syntax the compiler can't handle yet:try/finally,??=, getters in object literals, and hooks passed around as values.Nothing stopped new skips:
warn(228 warnings in apps/app).vitestran without the compiler, so render tests measured code that never ships.(The audit's counter missed files directly under
src/and missedpackages/query-tags, which the app build also compiles. The corrected count has no skips left.)What changed
Skips fixed (0 remain in app, shared-ui or query-tags source), with no
"use no memo"or lint disables. The two existingset-state-in-effectdisables were removed too. The patterns used:useLatestRefwrites inuseInsertionEffect, anduseEffectEventis used where a ref only fed an effect.useStableReadonlySet, terminal-row accumulation, sidebar navigation items, thread-title mention resources and others.useDisclosureFocusHandoff).try/finallyprocedures moved to module-level functions with the same error and early-return paths.@tanstack/react-virtualcall sites use a newhooks/useCompilerSafeVirtualizer.ts, which owns aVirtualizerand publishes snapshots throughuseSyncExternalStore.useVisible/useDatahooks run inside one cached wrapper component per slot.AppLayoutcallsuseCorePageTitledirectly and feeds the samePageTitleProvider.Guards
.oxlintrc.json:refs,immutability,preserve-manual-memoization,unsupported-syntax,incompatible-library,purityandset-state-in-effectare nowerrorforapps/app/**andpackages/shared-ui/**. All their findings are fixed.apps/app/vite-react-compiler.ts:panicThreshold: "all_errors", so any skip fails the build. That includes the "Todo" bailouts lint can't see.React Compiler could not compile <path>: …).testReactCompiler()runs the same compiler inapps/app/vitest.config.tsfor every test environment. Without that, node-environment tests were not compiled. It excludesplugins/, which ship without the compiler.packages/shared-ui/vitest.config.tsruns the compiler too; this adds three devDependencies.Real bugs that the compiled tests exposed (already live in production builds)
ThreadTitleMentions: raw-thread mention titles read the query cache during render, so a title that arrived later never replaced thethr_…id. Now read throughuseSyncExternalStore, which subscribes to the query cache only when the markdown actually contains thread IDs.system-queriesuseKnownProviderModelCatalogScope: readgetQueriesDataduring render and never re-resolved to the host scope.PluginComposerActions: a plugin plus/send menu row'sdisabled(composer)was cached against the stable composer handle and went stale. Now evaluated as a store snapshot.BbSourceCode: the counter it bumped to force a re-render did nothing once compiled, so worker highlighting went stale. The pool version is now state.Boot bundle budget:
maxBootBrotliBytesrose 3 KiB (425,055 → 428,127). About 100 newly compiled functions now carry memo caches; the boot payload measures 417.2 KB brotli. The raw limit is unchanged, and the reason is recorded inbundle-budget.json.Plugin SDK bump to 0.6.149. The SDK bundles
query-tags, whoseuseQuerySelectioncache moved into a module-level getter factory, so its published files changed.Tests that faked updates by mutating mocks and calling
rerender()with identical props now deliver updates through reactive mocks (useSyncExternalStore). This covers composer-contract, PluginNewThreadComposer, SidebarUpdatesBadge, PluginTabs, CommandPalette, ThreadTableOfContents, MachineAccessSettings, PromptBoxInternal and ThreadSecondaryPanel.markdown-scroll.ProjectDetailSettingsViewnow waits for the lazily loaded remote browser's listing before saving. It raced that dynamic import, and the slower compiled transform exposed the race. Tests that calledexperimental_use*as members useuse*aliases.Small visible changes (no others intended):
InfoRowTimerelative times now tick once a minute while on screen. Before, they only refreshed when a parent happened to re-render, which compiled parents no longer do.Rule workaround left in place:
useAgentSignInsresolves pending sign-in exits in an effect, through the file's existing latest-callback ref. The effect does real side effects when provider states settle (telemetry, closing terminals). A cleaner version would resolve from the refetch promise, which changes that contract.Rebase onto main: "Keep main's new handoff, split-layout and timeline code compilable" moves the
/handofftry/finallyinto a module-level helper, recordsSplitThreadArea's layout reconciliation during render instead of in an effect, and replaces a??=inTimelineWindowedItems. "Render timeline items without a per-item wrapper component" keeps the measurement revision counter in aWeakMapbeside the measurements map, sorenderItemis called directly as on main and finished timeline rows no longer re-render on a streaming push. Main's same-frame resize work (#7635) arrived after this PR; its newuseMeasuredValuekeeps the element in a ref so its pre-paint measurement satisfiesset-state-in-effect, and the table of contents' visibility check now uses it.How you verified
Compiler coverage: a counter runs the compiler over every git-tracked
.ts/.tsxsource. Source skips: apps/app 95 → 0, shared-ui 6 → 0, query-tags 1 → 0. The production profiling build passes withpanicThreshold: "all_errors". Before the query-tags fix, the panic caught that skip and failed the build.Static checks:
pnpm exec turbo run typecheck lint --filter=@bb/app --filter=@bb/shared-ui --filter=@bb/query-tags --filter=@bb/plugin-registrypasses, andoxlint apps/app/src packages/shared-ui/srcreports 0 problems.Targeted tests: I ran the tests for every changed module with the compiler on in vitest, and they pass. That includes PluginNewThreadComposer 64/64, the composer-contract suites, sidebar navigation, ThreadDetailPromptArea 72/72, TimelineWindowedItems, query-tags, react-compiler-cache, and shared-ui 65/65. CI runs the full suites.
Render counts on the real built app. Profiling build (react-dom/profiling plus a fiber-counting DevTools hook), the same dev server and fixture for both builds (a 122-item thread and 15 sidebar threads), and the same Chromium. Before is origin/main
da3e60b81d.The remaining fan-out comes from context-held collections (sidebar entries, sender metadata, the composer
api, plugin slots). Other threads own those.Smoke test on the built app, before and after:
Both builds behaved the same, with no page errors.
🤖 Generated with Claude Code