Skip to content

perf(ci): use four ARM test workers and remove repeated compilation - #23685

Merged
nwparker merged 10 commits into
mainfrom
nwparker/ci-next-optimizations
Sep 28, 2026
Merged

nwparker merged 10 commits into
mainfrom
nwparker/ci-next-optimizations

Conversation

@nwparker

@nwparker nwparker commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

CI repeats compilation work and leaves one ARM CPU unused by test workers. These changes make the same checks finish sooner without dropping tests or adding runners.

What Changed

  • Run four Vitest workers on the measured four-core ubuntu-24.04-arm runner. Other runner types keep their defaults.
  • Upgrade i18next-cli from 1.74.1 to 1.74.2, which avoids unnecessary syntax walks during localization extraction. Its new prefilter silently drops commented calls and escaped identifiers, so a small pnpm patch keeps name matching conservative in both ESM and CommonJS. New regression tests preserve all eight supported fixture forms. Keep the lockfile change scoped to the CLI and its required resource-generator update; the fresh release has an exact-version release-age exception.
  • Build the six platform-independent relay JavaScript files once, then copy them into each freshly cleaned platform directory. Native addons, platform patches, manifest validation, and version hashing still run separately per platform.

Why

Hosted ARM benchmarks support each change. Compilation reuse avoids remote-cache storage and invalidation costs. Increasing workers retains process isolation and complete test coverage. A separate Node compile-cache trial had no consistent material benefit and is not included. Vitest5 saved only 1–3% and failed an existing transport/fake-clock test; esbuild, Tailwind, and lint-tool upgrades showed no material speed gain, so those versions remain unchanged.

Experiment Baseline Candidate Result
Full unit shard 2, three vs four workers 368s 302s 18% faster
Full unit shard 4, four-worker run first 345s 290s 16% faster
Localization extraction, three-pair median 38.45s 26.18s 32% faster, with conservative prefilter correction
Standalone relay build, three-pair median 1.90s 0.46s 76% faster; 1.44s absolute saving

These are component timings, not a claim that the entire CI pipeline improves by those percentages. Package builds already overlap relay work.

Linked Issue

N/A — internal CI performance work.

Visual Proof

N/A — build and CI changes only.

Testing

  • Manually tested locally with background launch enabled.
  • Updated the existing relay artifact test to seed stale files before rebuilding; added extraction syntax regression tests for ESM and CommonJS.
  • Hosted worker comparison: same-runner pairs in opposite orders; identical assignments, file verdicts, test counts, and zero unhandled errors. Both shards contain 1,257 files.
  • Hosted localization comparison: three alternating pairs, all 13,257 keys and placeholders preserved. Six existing duplicate keys choose different defaults because upstream sorts file order; applying sorting alone to the old CLI produces an exactly identical full catalog. The English-catalog verification passes. The six default differences are acceptable here: extraction writes only a temporary diagnostic catalog, defaults remain report-only, and no application translations change. Sorting-only baseline comparison proves that these differences come from ordering rather than lost calls.
  • Hosted relay comparison: three alternating pairs; all 56 output files, modes, and version hashes match exactly.
  • Frozen-lockfile install; normal localization verification; focused workflow, localization, and relay contract tests; lint/format and changed-code quality checks.
  • Full normal PR CI passed on final head, including all eight unit shards and Linux/Windows packaging. Unit test steps took 290–322 seconds (303-second median). The unchanged Wayland Hangul input job initially failed one of three repetitions; its unchanged rerun passed. No test was weakened or bypassed.

Review

Review covered cleanup before copying, failed-build behavior, Windows addon selection, content-hash stability, and dependency ranges. Additional syntax probes caught the upstream CLI regression; the included patch and permanent tests correct it. The unpatched dependency bump is not shipped. macOS local and Linux hosted verification completed; normal PR CI covers Windows packaging. Runtime SSH, folder-workspace, and mixed-version wire behavior are unchanged because relay output bytes match.

Agent skill upstream boundary

  • Not applicable; no upstream skill content copied.

Checklist

  • This PR is focused on measured CI/build savings.
  • Explained the before/after, mechanism, and alternatives.
  • Visual proof is N/A with reason.
  • Self-reviewed correctness, security, and performance.
  • Cross-platform and SSH/remote impact considered.
  • Full lint, typecheck, test, and package builds pass in CI before merge.

@coderabbitai

coderabbitai Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 3d25df2c-1b67-4297-b926-d1d6632b51a7

📥 Commits

Reviewing files that changed from the base of the PR and between 49c260a and eaca8ec.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (3)
  • config/patches/i18next-cli@1.74.2.patch
  • config/scripts/localization-extraction-call-syntax.test.mjs
  • pnpm-workspace.yaml

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


📝 Walkthrough

Walkthrough

The relay build generates JavaScript bundles for the first platform and copies them to later platform directories. It stages patches and addons per platform and validates and hashes artifacts for each platform. The artifact-manifest test seeds platform output directories with stale companion files. The unit-test workflow limits Vitest to four workers on ubuntu-24.04-arm. The i18next-cli development dependency is updated to 1.74.2, with a patch that changes extraction-site detection in its CommonJS and ESM extractors. A test covers extraction through both exports.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to eaca8

No concrete defect is established, but the author’s stated readiness condition remains: complete final CI and the extraction-regression check before merging.

Security Architecture Review

Security architecture risk: 🔵 Low · up to eaca8

The relay build retains per-platform validation and content hashing, and no new runtime access path was found. The main security tradeoff is a narrowly scoped exception that permits a newly released localization tool before the usual waiting period.

Retained concerns

  • Low · security · inferred: The exact-version release-age exception lets i18next-cli 1.74.2 be installed and run without the workspace's normal three-day waiting period. This narrows the time available for a newly published tool release to be assessed; it is a supply-chain exposure, not evidence that the package is malicious.
Security review details

Security Blast Radius

  • inferred — A defect in the shared JavaScript build could propagate to every platform's relay bundle, including bundles intended for remote hosts; per-platform patches, optional addons, and hashes remain distinct.

Security Findings and Attack Paths

  • inferred — The newly exempted dependency is executable tooling in the repository's extraction process. Its publisher-controlled package bytes therefore cross into build or verification execution sooner than the configured release-age policy normally permits; no compromise, credential access, or malicious behavior was established.

Trust Boundaries and Controls

  • observed — The exception applies to one named version; the lockfile records its integrity and patch hash. In the inspected unit workflow, repository contents permission is read-only and checkout credentials are not persisted.

Resilience and Maintainability Implications

  • observed — Fresh output directories, artifact-manifest checks, and per-platform content hashes constrain stale or mixed-generation relay outputs after a successful build. They do not establish an atomic, all-platform publish on interruption.

Hardening Proposals

  • proposed — Remove the i18next-cli release-age exception once the pinned release meets the normal waiting period, restoring the workspace control without changing the pinned dependency or extraction patch.
🚥 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%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 3 files. (2 skipped: 2 … 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 identifies the two primary changes: increasing ARM test workers and removing repeated compilation. It is concise and relevant to the changeset.
Description check ✅ Passed The description is complete and detailed. It covers the required change summary, rationale, testing, visual-proof exception, review notes, cross-platform impact, and checklist. The internal-work Linke…
Full details: Docstring Coverage

Explanation

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

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

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.

@pullfrog pullfrog 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.

Important

The head still contains the i18next-cli@1.74.2 bump that the description marks blocked by an unaddressed upstream extraction regression, and the extraction gate cannot fail on a changed default. The ARM-worker and relay-bundle changes are independent and look sound — splitting the localization upgrade into its own PR would let them land while the correction is tested.

Reviewed changes — initial review of all 8 commits (6 net files).

  • ARM test workers — --maxWorkers=4 is appended only when inputs.runner == 'ubuntu-24.04-arm'; the daily node-next-compat caller keeps its default.
  • Relay bundle reuse — build-relay.mjs builds the six platform-independent JS bundles once and copies them into each later platform's freshly-cleaned directory; per-platform node-pty patches and the Windows process-tree addon are still staged per platform.
  • Stale-companion guard — relay-artifact-manifest.test.mjs seeds stale-companion.js into every platform dir before the build.
  • i18next-cli 1.74.2 — devDependency bump, lockfile (i18next-resources-for-ts 2.1.0 → 2.1.1), and a minimumReleaseAgeExclude entry.
  • Failure-preserving SHA capture — ORCA_SHARD_SOURCE_SHA="$(...)" is split from export so set -e sees a failing git rev-parse.

⚠️ The blocked localization upgrade rides along with the CI perf changes

The relay-bundle reuse and ARM-worker changes are the parts this PR is titled for, and both hold up under review: the six bundles are built with no platform-varying esbuild option (the platform is only interpolated into outDir and the Windows staging branch), bundledFilenames is captured before the patches/addon/.version are written, and esbuild output is deterministic — so copied bytes match the previous per-platform build, which the hosted 56-file comparison also confirms. The ORCA_SHARD_SOURCE_SHA split is a correct fix (export VAR="$(...)" returns the builtin's status, masking a failing git rev-parse).

That leaves the localization upgrade as the only unresolved piece. However the correction is tested, landing it separately would let the measured CI savings merge without waiting on the upstream issue, and would keep a revert of the bump from dragging the perf work with it.

Technical details
# Scope/sequencing: separate the i18next-cli change from the CI perf work

## Affected sites
- `package.json:269` / `pnpm-lock.yaml` / `pnpm-workspace.yaml:20` — the 1.74.1 → 1.74.2 bump.
- `config/scripts/verify-localization-extraction.mjs:113` — the only extraction gate; fails solely on `missingFromEnglish` / `placeholderMismatches`.
- `config/scripts/verify-localization-extraction.mjs:39-55`, `:109-111` — `fallbackDrift` (a changed default) is computed and logged but never affects the exit code.
- `config/scripts/verify-localization-catalog.mjs:445-458` and `generate-runtime-required-english-catalog.mjs:56-86` — this adjacent gate uses Orca's own TS-AST scanner, not `i18next-cli`, so it cannot observe a CLI default change either.

## Required outcome
- Do not merge while the PR description still declares the bump blocked and no correction is present in the diff.
- Decide whether the default drift the hosted run observed (six duplicate keys) is acceptable or must be corrected, and make that decision land with the bump.

## Open questions for the human
- Is the "conservative correction" a local patch to `i18next-cli` or a revert to 1.74.1? The forward plan affects whether the `minimumReleaseAgeExclude` entry should also leave with it.

ℹ️ Nitpicks

  • .github/workflows/e2e.yml:197 carries the same export ORCA_SHARD_SOURCE_SHA="$(git rev-parse HEAD)" idiom this PR just fixed in unit-tests.yml:86; a failing git rev-parse is masked there too and the same split would apply.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Comment thread package.json Resolved
Comment thread config/scripts/build-relay.mjs Resolved

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes — incremental review of the 2 commits since the prior pullfrog review (21f6d871ef, eaca8ec57b).

  • i18next-cli@1.74.2 correction — a pnpm dist patch (both dist/esm and dist/cjs) adds an if (code.includes('\\u')) return true; guard and widens mayContainExtractionSite's regex from a call-shaped match to a bare-identifier match over the configured calls/names. It is strictly conservative: it can only cause more files to be parsed, so it cannot drop keys.
  • Regression test — config/scripts/localization-extraction-call-syntax.test.mjs covers eight call shapes (comments, line splits, member/optional/generic calls, $-prefixed and escaped identifiers) across ESM and CommonJS, asserting the exact key set. Seven of the eight fixtures are prefiltered out without the patch, so this is a real regression guard rather than a tautology.
  • pnpm wiring — patchedDependencies + patch_hash in the lockfile and workspace; the hash is exercised end-to-end by patched-dependencies-frozen-install.test.mjs, so a stale hash fails the frozen install loudly.
  • Harness cleanup — the corrected localization benchmark workflow/script added in the prior commit are removed, leaving no net pilot files.

This resolves the initial review's blocker: the extraction correction is present, tested, and the description no longer marks the PR unmergeable. The extraction gate's fallbackDrift is still report-only, but the author verified the differing defaults are attributable to upstream's intended sorted-file ordering rather than a broken extraction, so I'm not treating it as a defect here.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@greptile-apps

greptile-apps Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium risk] Optimizes CI test parallelization and patches a localization tool.

No actionable issue was established in the changed code; the PR appears safe to merge once its stated CI checks pass.

Summary

The PR caps Vitest at four workers on the ARM unit-test runner, upgrades and patches localization extraction, and builds platform-independent relay JavaScript once before copying it into separately prepared platform directories.

  • Other runner types retain their existing worker defaults.
  • Relay native artifacts and version hashes remain platform-specific.
  • Regression fixtures cover commented and escaped localization calls and stale relay artifacts.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Sources[Relay source entries] --> Build[Build six JavaScript bundles once]
  Build --> First[First platform directory]
  First --> Copy[Copy bundles to remaining platform directories]
  First --> Stage[Stage platform-specific patches and addons]
  Copy --> Stage
  Stage --> Verify[Validate manifests and write version hashes]
Loading

Reviews (1) · Last reviewed commit: "ci: remove corrected localization benchm..."

@nwparker
nwparker merged commit 0f52bb8 into main Sep 28, 2026
84 of 85 checks passed
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