Repository navigation
Conversation
…ed-menus-in-more-in-the-thread-thr_h6cfedfsgn
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
brsbl
deleted the
bb/on-mobile-the-nested-menus-in-more-in-the-thread-thr_h6cfedfsgn
branch
September 24, 2026 23:57
ymichael
pushed a commit
that referenced
this pull request
Oct 10, 2026
The same audit found tests that keep passing when the behavior they name is removed, and tests that only restate inventories, class tokens or library behavior. About 50 tests are fixed so they fail when their named guard is removed, each proven by applying that mutation and reverting it. Examples: - MarketplacesSettingsSection asserted no "Remove BB Official" button against a fixture named "BB Community", so nothing guarded removing the official marketplace. - scheduled-send's "stays closed in another composer" passed because the second composer's empty draft closed the dialog anyway. - clipboard's "desktop clipboard first", detail-page-recipes' code-fence split, the plugin install/update "reports once" checks, ThreadDetailHeader's edit-time pane drag, TimelineSelectionMenu's flushSync focus, mobile-guide's vertical swipe and SidebarVisibilityControls' #4245 overlap. Three whose guard cannot be observed at that boundary are deleted instead (sidebar-navigation storage rejection, native-shell bridge version, theme preview epoch). About 110 junk tests are trimmed: registration and manifest inventories, class assertions whose expected value is the constant under test, tests of TipTap, shared-ui menus or React itself, and duplicates of a stronger owner. Every test the audit found load-bearing stays. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
pushed a commit
that referenced
this pull request
Oct 10, 2026
The same audit found tests that keep passing when the behavior they name is removed, and tests that only restate inventories, class tokens or library behavior. About 50 tests are fixed so they fail when their named guard is removed, each proven by applying that mutation and reverting it. Examples: - MarketplacesSettingsSection asserted no "Remove BB Official" button against a fixture named "BB Community", so nothing guarded removing the official marketplace. - scheduled-send's "stays closed in another composer" passed because the second composer's empty draft closed the dialog anyway. - clipboard's "desktop clipboard first", detail-page-recipes' code-fence split, the plugin install/update "reports once" checks, ThreadDetailHeader's edit-time pane drag, TimelineSelectionMenu's flushSync focus, mobile-guide's vertical swipe and SidebarVisibilityControls' #4245 overlap. Three whose guard cannot be observed at that boundary are deleted instead (sidebar-navigation storage rejection, native-shell bridge version, theme preview epoch). About 110 junk tests are trimmed: registration and manifest inventories, class assertions whose expected value is the constant under test, tests of TipTap, shared-ui menus or React itself, and duplicates of a stronger owner. Every test the audit found load-bearing stays. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
pushed a commit
that referenced
this pull request
Oct 10, 2026
The same audit found tests that keep passing when the behavior they name is removed, and tests that only restate inventories, class tokens or library behavior. About 50 tests are fixed so they fail when their named guard is removed, each proven by applying that mutation and reverting it. Examples: - MarketplacesSettingsSection asserted no "Remove BB Official" button against a fixture named "BB Community", so nothing guarded removing the official marketplace. - scheduled-send's "stays closed in another composer" passed because the second composer's empty draft closed the dialog anyway. - clipboard's "desktop clipboard first", detail-page-recipes' code-fence split, the plugin install/update "reports once" checks, ThreadDetailHeader's edit-time pane drag, TimelineSelectionMenu's flushSync focus, mobile-guide's vertical swipe and SidebarVisibilityControls' #4245 overlap. Three whose guard cannot be observed at that boundary are deleted instead (sidebar-navigation storage rejection, native-shell bridge version, theme preview epoch). About 110 junk tests are trimmed: registration and manifest inventories, class assertions whose expected value is the constant under test, tests of TipTap, shared-ui menus or React itself, and duplicates of a stronger owner. Every test the audit found load-bearing stays. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
pushed a commit
that referenced
this pull request
Oct 14, 2026
The same audit found tests that keep passing when the behavior they name is removed, and tests that only restate inventories, class tokens or library behavior. About 50 tests are fixed so they fail when their named guard is removed, each proven by applying that mutation and reverting it. Examples: - MarketplacesSettingsSection asserted no "Remove BB Official" button against a fixture named "BB Community", so nothing guarded removing the official marketplace. - scheduled-send's "stays closed in another composer" passed because the second composer's empty draft closed the dialog anyway. - clipboard's "desktop clipboard first", detail-page-recipes' code-fence split, the plugin install/update "reports once" checks, ThreadDetailHeader's edit-time pane drag, TimelineSelectionMenu's flushSync focus, mobile-guide's vertical swipe and SidebarVisibilityControls' #4245 overlap. Three whose guard cannot be observed at that boundary are deleted instead (sidebar-navigation storage rejection, native-shell bridge version, theme preview epoch). About 110 junk tests are trimmed: registration and manifest inventories, class assertions whose expected value is the constant under test, tests of TipTap, shared-ui menus or React itself, and duplicates of a stronger owner. Every test the audit found load-bearing stays. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
pushed a commit
that referenced
this pull request
Oct 14, 2026
The same audit found tests that keep passing when the behavior they name is removed, and tests that only restate inventories, class tokens or library behavior. About 50 tests are fixed so they fail when their named guard is removed, each proven by applying that mutation and reverting it. Examples: - MarketplacesSettingsSection asserted no "Remove BB Official" button against a fixture named "BB Community", so nothing guarded removing the official marketplace. - scheduled-send's "stays closed in another composer" passed because the second composer's empty draft closed the dialog anyway. - clipboard's "desktop clipboard first", detail-page-recipes' code-fence split, the plugin install/update "reports once" checks, ThreadDetailHeader's edit-time pane drag, TimelineSelectionMenu's flushSync focus, mobile-guide's vertical swipe and SidebarVisibilityControls' #4245 overlap. Three whose guard cannot be observed at that boundary are deleted instead (sidebar-navigation storage rejection, native-shell bridge version, theme preview epoch). About 110 junk tests are trimmed: registration and manifest inventories, class assertions whose expected value is the constant under test, tests of TipTap, shared-ui menus or React itself, and duplicates of a stronger owner. Every test the audit found load-bearing stays. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
added a commit
that referenced
this pull request
Oct 14, 2026
…M-free tests out of jsdom (#5261) ## Human comments ## What was wrong Test time went to repeated setup, not to the tests themselves. Server tests ran all migrations against a fresh `:memory:` database per test, even though a cached-template helper already existed: 607 `migrate` calls and about 58 s of CPU per `@bb/server` run, at about 80 ms each against 0.4 ms to deserialize a template. Small helpers were copied per file (`makeTempDir` ×45, `initRepo` ×9, `LocationProbe` ×12, `deferred` and `jsonResponse` copies), `react-resizable-panels` was mocked 9 times, and the two `ThreadDetailPromptArea` test files duplicated 21 module mocks. A handful of tests (listed below) asserted guide prose or restated the implementation. In the app and plugins, every jsdom test file pays about 3.8 s of fixed cost (environment 1.7 s, imports 1.4 s, setup 0.3 s) before 0.44 s of tests. A mutation audit of all 496 jsdom files found most of them are the only guard on DOM behavior (keyboard, IME and focus paths, portals, observers, iframe sandboxes, stale-response races tied to fix commits), but about 100 ran in jsdom for logic that needs no DOM, 14 duplicated stronger tests, about 50 passed for the wrong reason, and about 110 restated inventories, class tokens or library behavior. ## What changed Eight original commits plus rebase integration fixes. Commits 1–6 touch test code and test support only. Commits 7–8 also change production code, but only to extract logic into functions the component or hook still calls (behavior-preserving, reviewed for parity below). 1. **One migrated template database.** `@bb/db/testing` exports `createMigratedConnection()` and `prepareMigratedConnectionTemplate()`. The db and server `globalSetup` build the template once and hand it to workers through `BB_TEST_MIGRATED_DB_TEMPLATE`, so isolated files deserialize instead of re-migrating. Full-schema setup sites in apps/server and packages/scripts use it. A guard test in apps/server fails on new `migrate(` calls in its tests. Three files keep raw `migrate` on purpose: an empty pre-migration schema, child-process scripts, and a 0117 backfill replay that reads `migrate`'s TEMP table. Still a real SQLite database built by the real migrations. 2. **Shared small helpers.** `@bb/test-helpers` gains `makeTempDir`/`makeTempDirSync` (cleanup through `onTestFinished`, with the Windows retry budget from #4776) and `initRepo`. Local `deferred` copies use `createDeferredPromise`, and `jsonResponse` copies use `Response.json`. apps/app gets one `LocationProbe`, two shared `react-resizable-panels` modules (real browser build, layout stub) and one shared question-shortcut `system-queries` mock. `plugins/theme-preview/server.test.ts` uses the SDK fake host instead of 8 `as unknown as BbPluginApi` casts. `@/lib/sdk` and `system-queries` factories were not added: 57 of 61 and 31 of 35 blocks are distinct, so a factory would only move code. Plugins keep local copies (forkable rule). 3. **Shared `ThreadDetailPromptArea` harness** (`apps/app/src/test/thread-detail-prompt-area-harness.tsx`). The two "every atom returns 40" jotai mocks became a store with `secondaryPanelWidthPercentAtom` set. Changing it to 33 fails 2 and 1 tests, so the store is load-bearing. 4. **Evidence-backed deletions**, each checked against the test-audit skill and with mutation checks: - Deleted: prose-matching tests in `plugin-authoring-docs.test.ts` (4) and `submit-a-plugin.test.ts` (4), and `create-via-prompt-examples.test.ts`, which built its expectations with the same `map` the code uses (`getCreateExamples` is now un-exported). - Trimmed: colour and size class assertions in `SecondaryPanelTabStrip.test.ts`. Visibility, no-drag and touch-target assertions stay. - Replaced: `MachineLabel.test.tsx` now covers an ephemeral host whose provider is not loaded instead of the trivial persistent branch. - Kept after the mutation check showed they were the only guard: `route-loading-skeleton.test.tsx`, the release-approval/`--ignore-scripts` skill test, and the changelog footer colour pair. 5. **`pnpm exec turbo run bench`** runs the three opt-in benchmarks (sidebar, composer paste, watcher recovery), documented in `docs/debugging-and-qa.md`. Per-file jsdom cost was measured; no config change (below). 6. **`createMemoryStorage()`** in `@bb/test-helpers`, for node tests that only need `localStorage`/`sessionStorage`. 7. **Move DOM-free tests out of jsdom and delete duplicated ones.** jsdom test files go from 496 to 403. - Pragma only: files that pass unchanged in node drop the jsdom line. - Storage only: node tests stub storage with `createMemoryStorage()` (plugins keep a local copy). - TanStack Query hooks with no DOM assertions: option factories are exported and driven with `QueryObserver`/`MutationObserver` on a `QueryClient`. - Pure logic inside components and hooks is extracted into functions the component still calls and table-tested in node; hooks that only need React render through `renderHookStatically` (`renderToStaticMarkup`). - Partial files are split; DOM-needing cases stay in jsdom. - 14 files deleted where every catch is also caught elsewhere, the test covers story-only code, or it passes for an unrelated reason; a single unique catch moves into the stronger owner's test. - `sidebar.bench.test.tsx` leaves the default include (`bench` still runs it). `plugin-scaffold-external.test.ts` declares the node environment, since a template literal containing the jsdom pragma was selecting jsdom. theme-preview declares the SDK test host's optional peers (`better-sqlite3`, `cron-parser`, `hono`) now that its server test uses the fake host, so its fork installs them. - Kept in jsdom on purpose: `useThreadSecondaryPanelVisibility` (moving it changed callback identities), `root-compose-selection` (`atomWithStorage` only hydrates on mount) and plugin-api-tester's smoke test (the plugin fork check runs `npm test` in every forkable plugin). 8. **Fix tests that passed for the wrong reason and trim junk.** About 50 tests now fail when their named guard is removed. Examples: `MarketplacesSettingsSection` asserted no "Remove BB Official" button against a fixture named "BB Community", so nothing guarded removing the official marketplace. scheduled-send "stays closed in another composer" passed because the second composer's empty draft closed the dialog anyway. Others include clipboard "desktop clipboard first", detail-page-recipes' code-fence split, the plugin install/update "reports once" checks, ThreadDetailHeader's edit-time pane drag and SidebarVisibilityControls' #4245 overlap. Three tests whose guard cannot be observed at that boundary are deleted. About 110 junk tests are trimmed. Net vs main after the October 14 rebase: 572 files, +13.6k / −19.0k. ## How you verified Local timings, one package at a time (`turbo run test --filter=<pkg> --only --force -- --reporter=json`), 16-core macOS shared with other threads (load 10–16): | Package | Wall | Vitest `tests` sum | | --- | ---: | ---: | | @bb/server | 106.6s → 91.6s | 532.0s → 398.3s | | @bb/app | 63.5s → 67.4s | 177.7s → 190.1s | | @bb/db | 5.0s → 6.7s | 20.0s → 19.8s | | @bb/host-daemon | 30.8s → 31.0s | 72.7s → 85.6s | | @bb/cli | 13.4s → 9.0s | 40.4s → 35.4s | | @bb/scripts | 18.6s → 18.2s | 31.0s → 31.8s | Only the server change is outside noise. `migrate` calls per server run went from 607 to 24, and migrate CPU from 58 s to about 2 s. The 51 converted server files went from 201 s to 109 s summed. Largest drops: plugin-catalog-service 13.1 → 1.6 s, third-party-marketplaces 6.3 → 1.2 s. Per-file jsdom cost (402 isolated files, medians): environment 1.66 s, import 1.42 s, setup file 0.30 s, tests 0.44 s. `vmForks` was slower on an 80-file sample (13.2–14.3 s vs 10.8–11.1 s) and failed 6 tests. The Vite deps optimizer gave no gain and broke 2 `importOriginal` mocks. Neither was adopted. Checks: `pnpm exec turbo run lint typecheck test --filter='...[origin/main]'` after rebasing onto current main: 246 of 247 tasks passed. The failure was `PluginSettings.test.tsx` "autosaves the latest text value on blur" at load ~22. That test body is unchanged; the file only swapped its local `deferred` for `createDeferredPromise` in other tests. It has failed once in each full parallel run, and a standalone `turbo run test --filter=@bb/app --only --force` rerun passed (594 files, 5568 tests). The same test passed 8/8 alone and 9/9 under parallel stress on the base commit. **jsdom audit and cleanup (commits 7–8).** Audit method per file: read against the test-audit skill, 2–4 realistic mutations of the code under test, then which other test files fail on the same mutation; about 1,500 mutations over 496 files. For every moved file, each unique catch the audit recorded was re-applied: the moved test fails with it and passes without it. Every fix in commit 8 was proven the same way (fails with the mutation, passes after revert). Behavior parity: three independent reviews read every production diff (82 files) against the old code. No user-visible change. Fixed from the review: an attachment-failure check that had moved one React tick earlier, two no-op state updates while a panel is closed or a folder chain is empty, merged panel-opener callbacks (reverted, see above), and test-only exports (moved into their own modules with production importers, or reached through public hooks). A dead `useUiPreferencesReady`/`isUiPreferencesReady` pair with no production caller is deleted. Known coverage losses: thin hook wiring that now only forwards to extracted functions (thread-list held read status effect and reveal atom setters, a tasks scheduler null-check, the mobile recents collapsed-id filter, the timeline panel's background-agent count). One new React Compiler warning (not error) in `plugins/tasks/shell/data.ts`, next to five existing ones. Timing, before (0da6f19) vs after, back to back, two rounds, load 15–19: | Package | Wall | Vitest file-time sum | Files / tests | | --- | ---: | ---: | --- | | @bb/app | 71 / 73 s → 61 / 66 s | 202 / 204 s → 179 / 195 s | 605 / 5711 → 602 / 5634 | | bb-plugin-tasks | 6 / 7 s → 5 / 8 s | 17 / 21 s → 15 / 21 s | 40 / 412 → 37 / 409 | | bb-plugin-thread-list | 4 / 5 s → 5 / 4 s | 11 / 13 s → 11 / 12 s | 37 / 451 → 35 / 444 | Final checks: `pnpm exec turbo run lint typecheck test --filter='...[origin/main]'` passed every package except `@bb/app`, which failed on a fixup the rebase had dropped; after restoring it, `turbo run lint typecheck test --filter=@bb/app` passed (7/7). `PluginSettings.test.tsx` "autosaves the latest text value on blur" fails occasionally under heavy parallel load. Its test and component are unchanged from main except the `deferred` helper swap in other tests of the file. Interleaved stress runs: 0/18 failures on main, 0/18 on this branch. Windows shard timings were not measured locally; compare them on this PR's CI run. October 14 rebase: updated onto `origin/main` at `efb7d12f2f` (#5494). Conflict resolutions preserve shared temp-directory cleanup retries, mobile queue defaults, project-specific model catalog caching, title-mention regressions, inline-vis preview helpers, and the Plugin Guide code-fence surface. The new HTML-preview routing regression stays in a separate jsdom file; Markdown image routing stays in Node. The new status-cap tests use the shared repository fixture, and `WorkspaceChangesList` retains main's server-provided total count and omitted-file coverage. Rebase verification: `pnpm exec turbo run lint typecheck test --filter=@bb/app --filter=@bb/host-workspace --filter=bb-plugin-inline-vis --filter=bb-plugin-plugin-api-docs` passed lint/typechecks and the host-workspace (161 tests), inline-vis (50 tests), and Plugin Guide (72 tests) suites. The full app run passed 5,691 tests and exposed one HTML-preview static-render failure; after moving that test to jsdom, both preview files passed (6 tests), and app lint/typecheck passed. After including #5494, the workspace list/summary tests passed (10 tests), the host-workspace suite and typecheck passed again, and app typecheck passed. `git diff --check` passed. > AGENT GENERATED --------- Co-authored-by: qa <qa@x> Co-authored-by: Claude Opus 5.5 <[email protected]>
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
On mobile, opening a hidden thread section from More stacked two drawers. The section also drew a divider above Add to list.
What changed
How you verified
Before:
9bfe862b35(merge base) · After:74c5b77f97· Captured at 2×The row below compares against the previous PR head
0d1475e8a5, where review found this regression; it did not exist on the merge base in this form.0d1475e8a5)74c5b77f97)BB-Thread-ID: thr_h6cfedfsgn
🤖 Generated with Claude Code