Skip to content

ci: parallelize PR checks and accelerate Vite builds - #10989

Merged
nwparker merged 6 commits into
mainfrom
nwparker/faster-CI
Jul 27, 2026
Merged

nwparker merged 6 commits into
mainfrom
nwparker/faster-CI

Conversation

@nwparker

@nwparker nwparker commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This change makes pull-request CI substantially faster by splitting independent checks into parallel jobs, sharding the general Vitest suite 16 ways, building Electron targets concurrently, and reusing the renderer build for the standalone web client.

The required aggregate check remains named verify and waits for every lane. Faster here means less waiting and less duplicate work—not fewer safety checks.

What changed

Parallel PR workflow

  • Added superseded-run cancellation keyed by PR number.
  • Added explicit read-only GitHub Actions permissions (contents: read).
  • Split the old serial job into static analysis, typecheck, Git compatibility, shell contracts, 16 test shards, and packaging.
  • Kept fail-fast: false so one failing shard does not hide other results.
  • Kept the final verify job as the aggregate gate; it fails unless every dependency succeeds.
  • Moved real-shell/native tests to one dedicated lane and excluded those exact files from general shards, preserving coverage without duplicate execution.

Dependency and runtime safety

  • Added one composite dependency action using the repository-pinned Node and pnpm versions.
  • Uses script-free installs for jobs that do not need lifecycle work, then explicitly prepares either the Node or Electron native runtime when required.
  • Keeps the external node-gyp workaround only for native-runtime lanes.
  • Installs optional packages through the existing pnpm.supportedArchitectures configuration instead of repeated OS/CPU flags.
  • Verifies dependency installation does not modify package.json or pnpm-lock.yaml.
  • Installs the Electron package binary explicitly for Node-run tests that import Electron metadata.
  • Retries only transient Electron download failures, clears partial cache state before retrying, and fails immediately for permanent errors. Tests cover recovery, permanent failure, exhausted retries, invalid retry settings, partial extraction, and unsettled downloads.

Faster builds without changing runtime contracts

  • Aliases vite to the pinned [email protected] compatibility package.
  • Builds Electron main, preload, and renderer targets concurrently through target-specific configuration.
  • Preserves stable CommonJS .js entry paths used by Electron and plain-Node sidecars.
  • Externalizes packaged main-process dependencies while continuing to bundle the pure-JS xterm graph required by the unpacked daemon.
  • Keeps the plain-Node daemon guard as one TypeScript source of truth and runs its filesystem smoke after Rolldown has materialized output.
  • Adds strict renderer entry signatures so desktop, pop-out, and web entry side effects cannot execute one another.
  • Emits and validates a renderer manifest, projects only the web dependency closure into a staging directory, includes referenced workers/assets, minifies it, and swaps it into out/web.
  • Excludes the build-only renderer manifest from packaged apps.
  • Lets electron-builder reuse a prepared native runtime only when target platform and architecture exactly match the host; cross-target packages still force the correct rebuild.

Why the package files are safe

package.json changes are limited to build-script wiring and the pinned Vite-to-Rolldown alias. Runtime dependencies were not removed or silently moved. pnpm-lock.yaml is the deterministic resolver update produced by that alias: Rollup/Vite-specific transitive packages are replaced by Rolldown's platform bindings while existing application dependency versions remain locked.

Safety evidence:

  • pnpm install --frozen-lockfile --ignore-scripts succeeds locally.
  • Installation leaves package.json and pnpm-lock.yaml byte-for-byte unchanged.
  • CI repeats a resolver-based install and fails if either file changes.
  • supportedArchitectures retains current, macOS, Linux, Windows, x64, and arm64 optional-package coverage.
  • Hosted packaging and native smoke checks pass on Linux and Windows; Golden Electron E2E passes on Linux and macOS.

Testing

  • Changed-area contracts: 8 files / 61 tests passed on the final current-main merge.
  • Full general suite previously passed: 3,563 files / 37,637 tests.
  • Typecheck, targeted lint, formatting, max-lines ratchet, and diff whitespace checks passed.
  • Frozen script-free install and lockfile immutability passed.
  • Full desktop build passed: relay, CLI, Electron main/preload/renderer, and projected web client.
  • Parallel Electron build and projected web verification passed.
  • Hosted static analysis, typecheck, Git 2.25/2.38/2.49 compatibility, shell contracts, package, all 16 shards, and aggregate verify passed.
  • Hosted Golden Electron E2E passed on Linux and macOS.
  • Hosted native smoke passed on Ubuntu and Windows.
  • Hosted Windows terminal restart and packaged crash-survival E2E passed.

The final hosted PR lanes completed in parallel: static analysis 37s, typecheck 1m02s, Git compatibility 1m10s, shell contracts 51s, package 1m23s, and the slowest test shard 1m55s, followed by the 4s aggregate verify gate.

Screenshots

Not applicable. This is CI/build/runtime-safety work with no UI changes.

AI Review Report

CodeRabbit reviewed each change stack. All actionable findings were addressed: read-only workflow permissions, target-key validation, cache-step ordering assertions, removal of incorrect repeated pnpm OS/CPU flags, removal of duplicated guard implementation, and Electron retry edge-case coverage. Its review of the final head reported no new actionable comments.

Cross-platform assumptions were reviewed for macOS, Linux, Windows, SSH, folder workspaces, and Git 2.25 compatibility. This change does not alter workspace or source-control behavior; platform-specific native reuse is guarded by exact runtime platform and architecture checks.

Security Audit

  • GitHub Actions tokens are explicitly read-only.
  • Checkout credentials are not persisted.
  • No secrets, telemetry paths, or production permissions were added.
  • Electron artifacts continue to use package checksums where applicable; retries do not weaken validation.
  • Manifest output paths are rejected if absolute, drive-qualified, backslash-based, or parent-traversing.
  • Renderer entries are validated against cross-entry execution before web projection.

Notes

This trades more parallel job usage for lower wall-clock time. Superseded-run cancellation limits wasted runner capacity. The added build scripts use concise contract tests and targeted Why comments instead of broad generated docstrings, consistent with repository style.

ELI5

The old CI was one person doing a long checklist from top to bottom. Now several people do independent parts at the same time, and the big test pile is split into 16 smaller piles. The desktop and web builds also reuse the same prepared pieces instead of assembling everything twice.

There is still a final teacher called verify who waits for every person and refuses to pass the PR if any part failed. The runtime checks are like labels on puzzle pieces: Node pieces are prepared for Node, Electron pieces for Electron, and cross-platform pieces are rebuilt when the label does not match—so making the line faster does not mix incompatible parts into the app.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The pull-request workflow is split into reusable dependency installation, static analysis, type checking, compatibility, shell-contract, sharded test, packaging, and aggregate verification jobs. Electron Vite builds now support target-specific parallel execution, explicit main-process outputs, and manifest-backed renderer entries. A new script projects selected renderer web assets into a minified output. Plain-Node bundle checks, native runtime rebuild handling, and Electron download retries are updated with corresponding tests.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly summarizes the main CI parallelization and Vite build acceleration work.
Description check ✅ Passed The description matches the template well, covering summary, screenshots, testing, AI review, security audit, and notes.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (1)
build-plugins/plain-node-entry-guard.ts (1)

133-140: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy lift

plain-node-entry-guard.ts and plain-node-entry-guard.js duplicate the entire guard implementation. collectReachableChunks, assertNoElectronRequire, smokeLoadDaemonEntry, and the writeBundle/closeBundle deferral logic are re-implemented identically in both files — a change or fix to one (e.g., patching a gap in the electron-detection regex, or the deferred-smoke sequencing) can silently be missed in the other, undermining a guard that exists specifically to prevent a repeat production outage.

  • build-plugins/plain-node-entry-guard.ts#L133-L140: keep this as the single source of truth for the writeBundle/closeBundle deferral logic.
  • build-plugins/plain-node-entry-guard.js#L84-L119: replace this duplicated implementation with a thin re-export/wrapper around the .ts module's compiled output (or otherwise share the logic) instead of maintaining a parallel copy.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d7bb4e8f-021a-4f66-97b2-f7fe946a68ae

📥 Commits

Reviewing files that changed from the base of the PR and between 560f853 and 40b8e5e.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (18)
  • .github/actions/install-node-dependencies/action.yml
  • .github/workflows/pr.yml
  • build-plugins/plain-node-entry-guard.js
  • build-plugins/plain-node-entry-guard.ts
  • config/electron-builder.config.cjs
  • config/electron-vite-target.config.ts
  • config/scripts/electron-builder-native-rebuild.cjs
  • config/scripts/electron-builder-native-rebuild.test.mjs
  • config/scripts/electron-vite-output-contract.test.ts
  • config/scripts/git-binary-compatibility-workflow.test.mjs
  • config/scripts/package-electron-runtime-contract.test.mjs
  • config/scripts/plain-node-entry-guard.test.ts
  • config/scripts/pr-workflow-parallelism.test.mjs
  • config/scripts/project-renderer-web-client.mjs
  • config/scripts/project-renderer-web-client.test.mjs
  • config/scripts/run-electron-vite-targets-in-parallel.mjs
  • electron.vite.config.ts
  • package.json

Comment thread .github/workflows/pr.yml Resolved
Comment thread config/electron-vite-target.config.ts Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4df8812f-1ccf-4131-a62e-af8d3f9ca867

📥 Commits

Reviewing files that changed from the base of the PR and between 40b8e5e and d221fa8.

📒 Files selected for processing (7)
  • .github/actions/install-node-dependencies/action.yml
  • .github/workflows/pr.yml
  • config/scripts/electron-vite-output-contract.test.ts
  • config/scripts/pr-workflow-parallelism.test.mjs
  • config/scripts/project-renderer-web-client.mjs
  • config/scripts/project-renderer-web-client.test.mjs
  • electron.vite.config.ts
🚧 Files skipped from review as they are similar to previous changes (5)
  • config/scripts/project-renderer-web-client.test.mjs
  • config/scripts/electron-vite-output-contract.test.ts
  • .github/workflows/pr.yml
  • electron.vite.config.ts
  • config/scripts/project-renderer-web-client.mjs

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
config/scripts/install-electron-package-binary.test.mjs (1)

96-145: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add coverage for "retries exhausted" and invalid retry-delay config.

Current tests cover success-after-one-retry and immediate-permanent-failure, but not the case where a transient error persists beyond all configured retries (exercising the retryDelay === undefined throw branch), nor invalid ORCA_ELECTRON_PACKAGE_RETRY_DELAYS_MS parsing.

✅ Suggested additional test
it('fails after exhausting configured retries on persistent transient errors', () => {
  const projectDir = mkTempProject()
  try {
    writeFakeElectronPackage(projectDir)
    writeFakeElectronGet(projectDir, {
      downloadFailures: 5,
      downloadErrorCode: 'ECONNRESET'
    })
    writeFakeExtractor(projectDir, { createExecutable: true })

    const result = runInstallScript(projectDir, {
      ORCA_ELECTRON_PACKAGE_RETRY_DELAYS_MS: '0,0'
    })

    expect(result.status).toBe(1)
    expect(
      readFileSync(join(projectDir, 'electron-get.log'), 'utf8').trim().split('\n')
    ).toHaveLength(3)
  } finally {
    rmSync(projectDir, { recursive: true, force: true })
  }
})

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 979c819e-cd08-408f-91d8-421dc008a357

📥 Commits

Reviewing files that changed from the base of the PR and between 23cb89b and 8d74880.

📒 Files selected for processing (2)
  • config/scripts/install-electron-package-binary.mjs
  • config/scripts/install-electron-package-binary.test.mjs

@nwparker
nwparker merged commit 0f91af8 into main Jul 27, 2026
31 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* ci: parallelize and accelerate PR checks

* fix(ci): make accelerated checks runtime-safe

* fix(ci): address review findings

* fix(ci): retry transient Electron downloads

* test(ci): cover Electron download retry limits
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