Skip to content

perf(ci): speed up unit tests and CI setup - #805

Merged
devswha merged 7 commits into
mainfrom
cursor/test-parallelism-ci-caching-d33a
Oct 11, 2026
Merged

devswha merged 7 commits into
mainfrom
cursor/test-parallelism-ci-caching-d33a

Conversation

@devswha

@devswha devswha commented Oct 11, 2026

Copy link
Copy Markdown
Owner

Change

This PR improves test execution speed through several optimizations:

Unit test parallelism

  • Unit tests now run in parallel across multiple processes via UNIT_TEST_WORKERS
  • Default: min(cores/2, 8) locally, 4 in CI
  • Files are queued largest-first so long files start early
  • Each process runs independently with no shared state

Local measurements:

  • 1 worker (serial): ~145s
  • 2 workers: ~88s

Concurrent local full run

  • New bun run check concurrent mode builds once, then runs unit tests + integration + browser all in parallel
  • Faster alternative to check full which runs sequentially

CI caching

  • Pin Bun version at workflow level (BUN_VERSION: 1.4.2)
  • Cache ~/.bun/install/cache keyed by OS/arch/Bun version/lockfile hash
  • Cache ~/.cache/ms-playwright keyed by OS/arch/Playwright version

Draft PR optimization

  • Skip heavy tests on draft PRs while keeping required checks reporting
  • Jobs still run but skip the heavy test execution steps
  • Required checks (Fast checks, Integration and browser, Native Windows install) remain visible

Job timeouts

  • Add timeout-minutes to all jobs that didn't have one
  • changes job: 5 minutes
  • integration-browser summary: 5 minutes

Validation

  • bun run typecheck passes
  • check.test.ts passes with new concurrent mode tests
  • Unit tests run successfully with parallel workers (tested 1 and 2 workers locally)
  • CI workflow validates with actionlint (Linux x64)
Open in Web Open in Cursor 

cursoragent and others added 4 commits October 11, 2026 11:29
Unit tests now run in parallel across multiple processes. UNIT_TEST_WORKERS
sets the count (default: min(cores/2, 8) locally, 4 in CI). Each file runs
independently with no shared state; the queue is ordered largest file first.

Local measurements:
- 1 worker: ~145s
- 2 workers: ~88s

Co-authored-by: Hako <[email protected]>
New 'bun run check concurrent' mode builds once, then runs unit tests +
integration + browser all in parallel. This is faster than 'check full' which
runs them sequentially.

Also updates tests and exports for the new concurrent property in plan().

Co-authored-by: Hako <[email protected]>
- Pin Bun version at workflow level (1.4.2)
- Cache ~/.bun/install/cache keyed by OS/arch/Bun version/lockfile hash
- Cache ~/.cache/ms-playwright keyed by OS/arch/Playwright version
- Skip heavy tests on draft PRs (jobs still report success)
- Add timeout-minutes to all jobs (changes job: 5min, summary: 5min)
- Set UNIT_TEST_WORKERS=4 in CI for parallel unit tests

Required checks (Fast checks, Integration and browser, Native Windows install)
still report on draft PRs but skip the heavy test execution.

Co-authored-by: Hako <[email protected]>
Update AGENTS.md, docs/development.md, and scripts/AGENTS.md to document:
- UNIT_TEST_WORKERS environment variable for parallel unit tests
- 'bun run check concurrent' mode for faster local full runs

Co-authored-by: Hako <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: devswha/herdr-web-ui/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 946d66a3-bc88-43f8-9b22-5d65a21add87

📥 Commits

Reviewing files that changed from the base of the PR and between c776413 and ef851d9.


📒 Files selected for processing (7)
  • .github/workflows/ci.yml
  • AGENTS.md
  • docs/development.md
  • scripts/AGENTS.md
  • scripts/check.test.ts
  • scripts/check.ts
  • scripts/ci-tests.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.



📝 Summary

Summary by CodeRabbit

  • New Features
    • Added a concurrent check option that runs unit tests alongside integration and browser checks. Check results and logs include the unit-test outcome.
    • Unit tests can now run in parallel, with the worker count configurable and automatically selected by default.
  • Documentation
    • Updated development and testing guidance with instructions for concurrent checks and unit-test worker settings.
  • Bug Fixes
    • Pull-request checks now resume when a draft is marked ready for review. Drafts no longer report skipped integration and browser checks as successful.

Walkthrough

The change adds parallel execution to the unit-test suite and a concurrent check mode. It also updates CI triggers, draft pull-request handling, dependency caches, and testing documentation.

Changes

Testing and CI Checks

Layer / File(s) Summary
Parallel unit-test execution
scripts/ci-tests.ts, scripts/AGENTS.md
The unit-test runner selects a worker count and runs files in separate processes when sh is available and more than one worker is effective. It processes larger files first and reports files that fail or produce no recognized test counts.
Concurrent check orchestration
scripts/check.ts, scripts/check.test.ts, AGENTS.md, docs/development.md
The concurrent mode runs unit tests alongside both lanes after the pre-check steps. It records unit-test output and status, stops the process groups on interruption, and includes tests and documentation for the mode.
Draft-aware CI and caches
.github/workflows/ci.yml
The workflow adds ready_for_review, a shared Bun version, and Bun and Playwright caches. Draft pull requests skip heavy checks on macOS, integration, and browser jobs; the integration-and-browser gate fails for drafts. The fast job sets four unit-test workers.

Priority: ⬇️ Low

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Feature


Merge Risk: ⚪ Minimal · up to ef851

The checks retain failure handling, and draft pull requests cannot pass the required heavy-test gate without running those tests. No identified issue blocks merging after normal checks.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 3 files. (4 skipped: 4… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check Passed The title clearly and concisely describes the primary changes: improving unit-test performance and CI setup.
Description check Passed The description includes the required Change and Validation sections. It explains the resulting behavior, reports relevant measurements, and lists validation results. No UI or HTTP/WS-specific evidenc…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.

Full details: Docstring Coverage

Explanation

Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 3 files. (4 skipped: 4 unsupported.)


  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR


🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

- ci.yml: trigger pull_request on ready_for_review; a draft run now fails the
  required "Native Windows install" and "Integration and browser" checks
  instead of reporting them green without running them.
- check concurrent: run the same pre-steps as full (workflow syntax, generated
  types, typecheck, build), reuse the preallocated report steps, track the unit
  process in the signal handler, and settle its logs on 'close'.
- ci-tests: fall back to a serial unit run when sh is unavailable.
@devswha
devswha marked this pull request as ready for review October 11, 2026 12:21
devswha added a commit that referenced this pull request Oct 11, 2026
Test-only de-flake. scripts/sticky-modifiers-regression.ts waited for
*any* new bytes after compositionend and then compared the full text, so
a split delivery failed CI with '한' !== '한글' (seen on #805, #616). It
now waits for the full UTF-8 byte count; the exact-text assertion is
unchanged.

Cross-model review: PASS for this change (the separate Escape/arrow
ordering flake in terminal-arrows-clicks-regression.ts is not included;
two attempts didn't converge without weakening that check).

Co-authored-by: devswha <[email protected]>
@devswha
devswha merged commit 27da3e8 into main Oct 11, 2026
9 checks passed
@devswha
devswha deleted the cursor/test-parallelism-ci-caching-d33a branch October 11, 2026 14:46
devswha added a commit that referenced this pull request Oct 11, 2026
## Change

Release 0.4.7, from main at 80ca9bb (47 PRs since v0.4.6).

- `package.json` and `herdr-plugin.toml`: 0.4.7.
- CHANGELOG: `[Unreleased]` becomes `[0.4.7] - 2026-10-12`, with the
compare links.
- #513's entry moves out of the 0.4.0 section, where its branch's merge
left it, and gets its credit; it says the pace is a setting, off by
default (#834).
- A Maintenance section covers the PRs that had no entry: #743, #756,
#767, #795, #805, #810, #813, #821, #826, #831.
- The note under the Hermes entry that asked for a runtime bump at
release now says what a remote PC needs.
- `release-summaries.json`: 0.4.7 in en/ko/ja/zh/tr (6 new, 6 improved,
5 fixed). The Turkish lines are not checked by a native speaker.
- `REMOTE_BUNDLE_VERSION` 25 -> 26. Since v0.4.5's runtime the bridge
gained Hermes transcripts (#604), conversation pushes (#689) and
Grok/Antigravity activity (#816), so `remote-v26` is published before
the app release.

Not in this release: #606.

## Validation

- `bun scripts/release-notes.ts 0.4.7` renders the summaries and the
full changelog (235 lines).
- `bun run typecheck` and `bun run build`: pass.
- `TMPDIR=/tmp bun run test:unit`: one failure, `server/voice.test.ts`
("audio.webm" vs "clip.webm"), which fails the same way on unmodified
`main` on this Mac (Bun 1.4.0); CI runs Bun 1.4.2.
- Every PR merged since v0.4.6 was checked against the changelog
section: all 47 are linked.

## Release

After this merges and its CI on `main` passes: push `remote-v26`, wait
for its release, then run the Release workflow with `0.4.7`.
devswha added a commit that referenced this pull request Oct 13, 2026
…d runner (#873)

## Change

Review of CI after the recent merges (#795 browser lane parallelization,
#805 CI setup speedups), with two defects fixed and an opt-in
self-hosted runner for Linux CI/CD.

### Fixes
- **Release/Pages validation could skip heavy tests.** Under
`workflow_call` (release.yml, pages.yml) and `workflow_dispatch`, Detect
changes diffed `HEAD~1`; a docs-only last commit set `code=false` and
the release was validated without integration and browser tests. Only a
`pull_request` may now skip them.
- **Docs-only regex.** `^(docs/|\.md$|...)` anchored `\.md$` to the path
start, so no `*.md` outside docs/ ever counted as docs. Now
`^docs/|\.(md|txt)$|^LICENSE$|^\.github/ISSUE_TEMPLATE/`.
- `${{ }}` values in `run:` scripts go through `env:`.
- The Bun/Node/herdr setup duplicated across 7 jobs is one composite
action (`.github/actions/setup-ci`); the Bun version is set once
(pages.yml and release.yml pinned it separately).

### Self-hosted runner (opt-in, default unchanged)
- Repository variable `CI_SELF_HOSTED_LABELS` (JSON array containing
`"self-hosted"`) routes Fast checks, Integration tests, both Browser
regression jobs, Pages build/deploy and Release preflight/publish. Unset
= `ubuntu-24.04` as today. ci.yml also takes a `self_hosted_labels`
dispatch input for one manual run.
- Fork PRs always get `ubuntu-24.04` (`scripts/ci-runner-route.sh`,
tested in `scripts/ci-runner-route.test.ts`). Since a fork PR can edit
`runs-on` itself, REVIEW.md now says not to approve such runs.
- `scripts/self-hosted-runner/`: an ephemeral Docker runner (one job per
container, `--cap-drop ALL`, `no-new-privileges`, no sudo, no host
mounts, registration token on stdin) with Chromium libraries and ffmpeg
baked in. The browser lane skips its sudo `install-deps` when
`RUNNER_ENVIRONMENT=self-hosted`.
- Note: GitHub-hosted minutes are free for this public repository, so
the gain is speed (a 32-core host vs 4-core runners), not cost.

## Validation
- `bun run check fast`: workflow syntax, generated types, typecheck,
build, unit (2952 pass, 0 fail).
- Route script cases (fork PR, variable, dispatch override, malformed
labels) in `scripts/ci-runner-route.test.ts`.
- Runner image: uid 1001, no sudo, Chromium launches without root under
`--cap-drop ALL`; token absent from `/proc/1/environ`.
- A workflow_dispatch run of this branch on the self-hosted runner: see
the comment below.
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.

2 participants