[GH-ISSUE #8032] [Feature]: Shard Node regressions, enable NODE_COMPILE_CACHE and exclude the regression harness from CodeQL #7528

Closed
opened 2026-10-24 04:03:54 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @Promansis on GitHub (Oct 21, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/8032

Originally assigned to: @Promansis on GitHub.

What problem does this solve?

Since #7971 the complete-node-regressions job runs 968 regression files in a worker pool, which brought it from ~35 min down to 11–20 min (median ~16–17 min over the 58 runs since merge). It is still the longest job on most PRs together with CodeQL, and it is CPU-bound on the 4-vCPU ubuntu-latest runner: a local run pinned to 4 cores takes the same time with 4 and 8 workers, so more workers on one runner cannot help.

Measured on the merged runs and local profiles:

  • Per-file fixed cost dominates: tsx start-up plus loading packages/shared and packages/server sources is ~60% of the CPU time; the median regression file runs in 2.0 s of which only a fraction is the test itself.
  • CodeQL's javascript-typescript analysis takes 9–12 min on PRs. scripts/regressions is ~30% of the extracted lines of code (358k LOC, 956 files) and is test harness code that never ships.
  • The PR critical path is currently CodeQL (~15 min) and complete-node-regressions (~13–17 min); the native macOS build and container matrix are the next ceiling at ~10–13 min.

Proposed solution

Three independent, revertible tooling changes in one PR, each in its own commit:

  1. Shard the regression job across 3 runners. Add a --shard <i>/<n> option to scripts/run-regressions.mjs that deals files from the existing slow-first order, run it as a matrix of 3 jobs, and keep a gate job named complete-node-regressions that needs the shards and fails when any shard failed, was cancelled or was skipped, so the required check keeps its name. Expected job time ~5–7 min.
  2. Set NODE_COMPILE_CACHE for the regression job so Node caches compiled bytecode across the 968 processes within one job. Measured 10–15% per-file saving locally; no functional risk (a cache miss just compiles normally).
  3. CodeQL paths-ignore for scripts/regressions (test harness) via a config on the init step. Expected ~2.5–3.5 min off the JavaScript analysis. The actions leg still scans .github/workflows.

Local pnpm regression behaviour is unchanged; sharding only applies when --shard is passed.

Alternatives considered

  • More workers per runner: no gain, the job is CPU-bound (measured 177 s at both --concurrency 4 and 8 on 4 pinned cores).
  • Precompiling the regression tree once and running plain Node: up to ~35% CPU saving, but a probe hit CJS/pnpm resolution failures in fastify internals and it changes what the suite imports. Not pursued here.
  • Selecting regressions by changed files: loses the whole-suite guarantee on every PR.
  • Larger or paid runners: the repository is public and uses free standard runners.
  • Skipping TypeScript type extraction in CodeQL: precision loss, not recommended.

Additional context

  • #7970 / #7971 (concurrent runner).
  • CI workflow: .github/workflows/playwright.yml job complete-node-regressions; CodeQL: .github/workflows/codeql.yml.
  • There are currently no open CodeQL alerts under scripts/regressions, so excluding it closes nothing.
  • Risks and how each is checked on the PR's own runs: gate job wiring (verified by shard results + gate status on the PR), uneven shards (shard times compared), compile-cache saving smaller on CI (log timings), CodeQL extracted-file count before/after.

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @Promansis on GitHub (Oct 21, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/8032 Originally assigned to: @Promansis on GitHub. ## What problem does this solve? Since #7971 the `complete-node-regressions` job runs 968 regression files in a worker pool, which brought it from ~35 min down to 11–20 min (median ~16–17 min over the 58 runs since merge). It is still the longest job on most PRs together with CodeQL, and it is CPU-bound on the 4-vCPU `ubuntu-latest` runner: a local run pinned to 4 cores takes the same time with 4 and 8 workers, so more workers on one runner cannot help. Measured on the merged runs and local profiles: - Per-file fixed cost dominates: tsx start-up plus loading `packages/shared` and `packages/server` sources is ~60% of the CPU time; the median regression file runs in 2.0 s of which only a fraction is the test itself. - CodeQL's `javascript-typescript` analysis takes 9–12 min on PRs. `scripts/regressions` is ~30% of the extracted lines of code (358k LOC, 956 files) and is test harness code that never ships. - The PR critical path is currently CodeQL (~15 min) and `complete-node-regressions` (~13–17 min); the native macOS build and container matrix are the next ceiling at ~10–13 min. ## Proposed solution Three independent, revertible tooling changes in one PR, each in its own commit: 1. **Shard the regression job across 3 runners.** Add a `--shard <i>/<n>` option to `scripts/run-regressions.mjs` that deals files from the existing slow-first order, run it as a matrix of 3 jobs, and keep a gate job named `complete-node-regressions` that `needs` the shards and fails when any shard failed, was cancelled or was skipped, so the required check keeps its name. Expected job time ~5–7 min. 2. **Set `NODE_COMPILE_CACHE`** for the regression job so Node caches compiled bytecode across the 968 processes within one job. Measured 10–15% per-file saving locally; no functional risk (a cache miss just compiles normally). 3. **CodeQL `paths-ignore`** for `scripts/regressions` (test harness) via a config on the init step. Expected ~2.5–3.5 min off the JavaScript analysis. The `actions` leg still scans `.github/workflows`. Local `pnpm regression` behaviour is unchanged; sharding only applies when `--shard` is passed. ## Alternatives considered - More workers per runner: no gain, the job is CPU-bound (measured 177 s at both `--concurrency 4` and `8` on 4 pinned cores). - Precompiling the regression tree once and running plain Node: up to ~35% CPU saving, but a probe hit CJS/pnpm resolution failures in fastify internals and it changes what the suite imports. Not pursued here. - Selecting regressions by changed files: loses the whole-suite guarantee on every PR. - Larger or paid runners: the repository is public and uses free standard runners. - Skipping TypeScript type extraction in CodeQL: precision loss, not recommended. ## Additional context - #7970 / #7971 (concurrent runner). - CI workflow: `.github/workflows/playwright.yml` job `complete-node-regressions`; CodeQL: `.github/workflows/codeql.yml`. - There are currently no open CodeQL alerts under `scripts/regressions`, so excluding it closes nothing. - Risks and how each is checked on the PR's own runs: gate job wiring (verified by shard results + gate status on the PR), uneven shards (shard times compared), compile-cache saving smaller on CI (log timings), CodeQL extracted-file count before/after. ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
Author
Owner

@Promansis commented on GitHub (Oct 21, 2026):

Taking this one (Promansis, via Claude Code). Branch: chore(ci)/regression-shards.

<!-- gh-comment-id:6329051689 --> @Promansis commented on GitHub (Oct 21, 2026): Taking this one (Promansis, via Claude Code). Branch: `chore(ci)/regression-shards`.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#7528
No description provided.