Repository navigation
Run every test suite on Windows CI - #4776
Merged
Merged
Conversation
SawyerHood
marked this pull request as ready for review
October 2, 2026 22:50
SawyerHood
force-pushed
the
bb/windows-all-tests-thr_g2ychqg7i9
branch
from
October 2, 2026 22:52
71afc05 to
1c2e675
Compare
Base automatically changed from
bb/composer-popup-focus-thr_g2ychqg7i9
to
main
October 2, 2026 22:59
SawyerHood
added a commit
that referenced
this pull request
Oct 2, 2026
## Human comments ## What was wrong The composer popup switch test could pass when the first popup’s pending focus animation frame ran after opening the second popup. That timing masked a focus-transfer regression: switching popup content while the host stayed open did not focus the new input. ## What changed Wait for the first popup to receive focus before opening the second, making the existing focus assertion reliably exercise switching after the initial animation frame has completed. The equivalent product fix already landed in #4765, which re-runs focus when the popup key changes; this PR adds its deterministic regression coverage. This is layer 1 of 2, based on `main`. Layer 2 is #4776, which extends Windows CI and needs reliable popup switching coverage. ## How you verified - `pnpm exec turbo run test --filter=@bb/app -- src/components/promptbox/PromptBoxInternal.test.tsx`: all 151 tests passed after resolving the overlap with #4765. - `pnpm exec turbo run lint typecheck --filter=@bb/app`: passed before the rebase; CI checks the final head. - The original investigation reproduced this deterministic test failure before the equivalent product fix on Linux. - Formatting and `git diff --check`: passed. This PR also runs the full CI workflow on its final head. > AGENT GENERATED Co-authored-by: Claude Code <[email protected]>
SawyerHood
force-pushed
the
bb/windows-all-tests-thr_g2ychqg7i9
branch
from
October 2, 2026 22:59
1c2e675 to
bab68ef
Compare
Add a Windows tests matrix that runs the suites outside the nine host packages in seven shards, with Bun for the Pi plugin suite. The test step runs under cmd with a short, long-named TEMP so the runner's MSYS tools and 8.3 temp path do not change what the suites see. Process-heavy shards run fewer suites at a time; with two at a time the host daemon, CLI, parity, and integration suites timed out on four-vCPU runners. Fix the tests that failed there: - The shell intent parsing performance test compared against a baseline that rounded to zero, because thread CPU time advances in 15.6 ms steps on Windows. - A QA test wrote its log to a hard-coded /tmp path, and a clone test depended on core.autocrlf. - Recorded replay cleanup, and two host daemon test cleanups, removed directories that a just-stopped child process still held. They now retry; the replay cleanup no longer blocks its worker while it does. - The CLI, server, and GitHub plugin suites get the 15 second test timeout other process-spawning suites already use. - A Codex connection test accepts a stdin EPIPE that Windows can report before the child's exit. Co-Authored-By: Claude Code <[email protected]>
SawyerHood
force-pushed
the
bb/windows-all-tests-thr_g2ychqg7i9
branch
from
October 2, 2026 23:00
bab68ef to
80b7c00
Compare
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
Windows CI ran only nine host package suites and application smoke checks, leaving the app, server, plugins, CLI, parity, and other package tests untested on Windows. Running those suites on actual runners exposed filesystem assumptions, process cleanup races, coarse CPU timing, and contention on four-vCPU machines.
What changed
Add seven Windows test shards for the app, server, plugins, and remaining packages. Run the test step under
cmdwith the runner temp directory, install Bun for the Pi plugin suite, and retain bounded OS-specific Turbo caches and timing artifacts. Serialize the process-heavy host shard and limit plugin and other-package concurrency.Fix the observed test portability failures: use an actual temporary log directory, disable Git text conversion in the clone fixture, increase the CPU measurement sample, retry asynchronous cleanup while child processes release directories, allow Windows stdin EPIPE during child exit, and use 15-second timeouts for process-spawning suites. Update the Windows coverage, platform support, and CI performance docs.
This is layer 2 of 2, based on #4775. The equivalent popup focus fix landed in #4765; #4775 retains its deterministic regression test. Bump the Plugin SDK from 0.6.15 to 0.6.16 because the replay helper is bundled into its published provider testing entry point. No server/daemon wire fields change.
How you verified
pnpm exec turbo run build lint typecheck --filter=@get-bb/plugin-sdk --filter=@bb/provider-bridge-protocol: passed.pnpm exec turbo run test --filter=@bb/provider-bridge-protocol: passed.node packages/plugin-sdk/scripts/check-npm-version-guard.mjs: passed after the patch bump.git diff --check: passed. The final PR workflow passed all 26 jobs on commit2f26b6ca6112e74098a3875e3724bde15396b9fa, including all seven new Windows test shards, Linux tests, Linux/macOS/Windows packaging smoke checks, lint, typechecks, and the npm version guard. The conditional compatibility and mobile E2E jobs were skipped.Seven additional Windows runners took approximately 3.8–5.3 minutes each in the original final run. Serializing the host shard avoids an unresolved integration-server close hang under contention; broader cleanup retries and short-path plugin validation remain follow-up work.