Skip to content

Reduce host test setup and lifecycle waits - #6234

Merged
ymichael merged 3 commits into
mainfrom
bb/ci-test-setup-speed
Oct 24, 2026
Merged

ymichael merged 3 commits into
mainfrom
bb/ci-test-setup-speed

Conversation

@ymichael

@ymichael ymichael commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

Five host plugin lifecycle tests spent about 31 seconds waiting for real cancellation grace periods and survivor calls. A directory-merge regression also created and deleted 150,000 empty files just to exercise merging a large listing. Host fixtures also spawned Git three times per repository to set fixed configuration values and rebuilt the same three-file Git reader fixture repeatedly. Faster setup exposed an existing fixture collision: independent squash-check tests could create identical commits within one second, allowing an earlier content-addressed result to bypass a later test's injected timeout.

What changed

  • Hold survivor calls in the real child worker until an explicit fixture RPC releases them. Advance only the parent manager's deadline/grace timers; retain real worker startup, IPC, cancellation, process exits, PID checks, and environment assertions. Restore clocks in finally. The 1500ms cold-start regression remains unchanged.
  • Append the fixed test identity and autocrlf settings to Git's initialized config, removing three subprocesses per initRepo call while preserving platform/template settings. Build the Git reader fixture once and copy the full repository for each test, with independent refs, objects, index, worktree, and cleanup.
  • Expand one real leaf-directory entry into 150,000 distinct entries at the filesystem boundary. The real traversal, path normalization, and merge still run; the other nine filesystem cases remain unchanged. Assert total and distinct counts plus first/last paths, restore the scoped spy in finally, and remove the large disk-fixture timeout.
  • Give diverged squash-check fixtures unique commit subjects using their temporary directory names, preserving patch contents and timeout/resume assertions.

Only tests and test support change. No production, cache invalidation, CI selection, shard count, or worker count changes.

How you verified

Combined host execution benchmark: two baseline/candidate replicas on four-vCPU Linux and Windows runners, Node 22, with an empty Turbo cache. It compares all changes against the PR base and runs the daemon and CLI with Turbo concurrency 1, the same package selection and concurrency as the Windows host test job. All eight runs passed with unchanged inventories: Linux 1,699 passed/9 existing skips; Windows 1,667 passed/40 existing skips.

Platform Baseline command, two runs Candidate command, two runs Mean reduction
Windows 80.84s / 118.55s 60.93s / 43.38s 99.7s → 52.2s, about 48%
Linux 63.96s / 59.00s 58.31s / 44.27s 61.5s → 51.3s, about 17%

Windows daemon task alone fell from 50.3–79.9s to 23.2–31.5s. The path-listing file fell from 32.8–69.7s to 1.10–1.69s; the lifecycle file from 41.1–47.8s to 8.2–10.1s. Runner variability is substantial, especially for the disk-heavy baseline. These are measured package-command gains from two runs per variant, not a claim that the whole CI workflow becomes 48% faster.

Git fixture benchmark: all eight runs passed. Windows workspace task improved from 25.4–26.2s to 22.6–24.2s; Git reader file from 9.49–9.71s to 7.11–7.49s. This smaller change did not consistently improve the combined three-package command.

Local verification through Turbo:

  • Full host workspace (160 passed), watcher (59 passed/4 existing skips), and daemon (816 passed/12 existing skips) suites passed. Final lifecycle file: 33 passed; the five affected cases: 31.69s → 0.905s. Git reader file also passed shuffled execution. After the directory fixture change, the full daemon suite passed in 7.72s locally, and the 10-case path-listing file improved from 8.53s to 0.606s.
  • Independent mutation proof: omitting the real abandon message failed both old and new tests on the rotated-environment assertion; disabling stale cancellation-timer guards failed all three old and new survivor cases after a real SIGKILL. Reinstating results.push(...childResults) failed both old and new directory tests with the same RangeError: Maximum call stack size exceeded; the restored candidate passed all 10 cases. Restored focused tests passed; production sources were restored byte-for-byte.
  • Real Git checks confirmed equivalent effective config, main branch, clean state, tracked files, and author, including template settings and empty-repository mode. Fixed commit dates reproduced the squash fixture collision before correction (17 pass/1 fail), then all 18 cases passed.
  • Lint/typecheck passed for all affected packages, formatting/diff checks passed, and independent review found no issues. Final-head PR CI passed on 03af7872cc5eb770d04c08bd6acb3a1de43f3324; all checks are green or non-applicable skips.

Benchmark workflows live on separate branches and are excluded from this PR.

AGENT GENERATED

@ymichael ymichael changed the title Reduce repeated Git fixture setup in host tests Reduce host test setup and lifecycle waits Oct 24, 2026
@ymichael
ymichael merged commit 5b2620f into main Oct 24, 2026
52 checks passed
@ymichael
ymichael deleted the bb/ci-test-setup-speed branch October 24, 2026 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant