Skip to content

perf(ci): reduce queue pressure without paid runners - #23053

Merged
OrcaWin merged 10 commits into
mainfrom
OrcaWin/np-CI-09-25
Sep 26, 2026
Merged

OrcaWin merged 10 commits into
mainfrom
OrcaWin/np-CI-09-25

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Sep 26, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 13 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​458 $\color{#cf222e}{\Huge{\mathbf{−}}}$​108 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​350
Prod 19 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​450 $\color{#cf222e}{\Huge{\mathbf{−}}}$​107 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​343

ELI5

PRs spend too long waiting for runners. Stop superseded tests from occupying the queue, remove repeated setup and mobile-test builds, and reuse caches across PRs. All runner choices remain free for this public repository.

What Changed

  • Combine repository guards and change detection in one sparse checkout. Keep guards active on docs-only PRs and preserve failure handling in the required verify check.
  • Replace cancellation-resistant always() on unit tests and the final check with !cancelled(). Cancel superseded PR attempts in three additional runtime workflows.
  • Use slim runners for short bookkeeping jobs and standard ARM for typechecking. Fetch only the complete commit ancestry that cloud secret scanning actually scans.
  • Reuse private real mobile bundle fixtures and cache parsed grant references by source content. Keep independent determinism/mutation checks; add fixture-isolation and file-edit regressions.
  • Warm shared native/Git/TypeScript caches on main with one bounded hourly job. Remove the unrelated cloud lockfile from unit cache keys. Record complete per-file timings for future shard balancing; retain the default worker count.
  • Refresh the hook-order snapshot for three layout-persistence hooks already added on main, after comparing the exact old and merged sequences. Application behavior is unchanged.

Why

A successful full PR used 74.6 runner-minutes, with unit jobs waiting up to 18 minutes and the final three-second check waiting another four minutes. Two superseded runs later held 11 runners and consumed 71.3 extra runner-minutes after replacement pushes. Both obsolete runs were confirmed against current PR heads and cleared.

Removing repeated work reduces shared runner demand. More shards would add setup and allocations; different runner labels do not increase the account's concurrency limit. Shard count, isolation, retries, coverage, platform contracts, and release behavior are preserved.

Linked Issue

Fixes #23050

Visual Proof

N/A — CI configuration, test efficiency, and a verified test snapshot update; no app UI changes.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

Full local typechecking, focused workflow/timing contracts, 103 mobile checks, hook parity, changed-code quality, formatting, and actionlint pass. A real sparse checkout retained the complete index while materializing 12 files (192 KB). Real Git fixtures prove security scanning retains both merge parents and deleted historical content. Independent review checked aggregate failure handling across 110 result combinations and retained mobile assertions.

Hosted observations from 36217238462:

Measurement Earlier sample Trial
Mobile test step 400.26s 205.17s
Complete mobile job 498s 298s

Mobile passed all 450 tests across the same 43 files (448 original tests plus two regressions). Unit artifacts cover all 9,564 discovered files exactly once with zero unhandled errors. Seven shards passed; the only failure was the stale main-branch hook snapshot corrected here. A four-worker experiment reduced aggregate test time from 3,110s to 2,814s, but the repeat run exceeded the palette matcher's existing 180ms performance budget at 235ms. The override was removed. No assertion, time budget, or shard weight was relaxed; no failed timing baseline was imported.

Cloud, Pi matrices, Git termination, warmup, static analysis, Linux/Windows packaging, shell, wire, and browser-provider checks passed. The Git check restored the warmup's binary cache. Default-worker hosted run 36219967348 passed every other changed and platform check and all eight unit shards. Its unchanged mobile terminal-render test failed twice on the existing timing assertion (449/450 mobile tests passed); the failure is documented in the CI report and no assertion or timeout was weakened. General E2E, IME, and WSL retain their existing draft/path gates.

AI Disclosure

Review

Preserves scan history, test assertions, required-check failure handling, and platform boundaries. No paid services or release-policy changes.

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

These are observational samples, not controlled benchmarks. Active duration is separate from account-wide queue time. Sharing caches across new PRs requires this producer to land on main; hosted trials verify cache commands and compatible keys, not a completed rollout. See docs/reference/ci-runner-efficiency.md for evidence and no-cost capacity options.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@OrcaWin
OrcaWin marked this pull request as ready for review September 26, 2026 05:48
@OrcaWin
OrcaWin requested a review from Jinwoo-H as a code owner September 26, 2026 05:48
@OrcaWin
OrcaWin merged commit 38bcdf7 into main Sep 26, 2026
20 of 36 checks passed

@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 — first review of this CI-efficiency pass at 5a26cfa83d.

  • Superseded-run cancellation: pr.yml's reusable unit-test call and the final verify aggregate moved from always() to !cancelled(), and the Git-termination, Pi-owner, and Pi-provider runtime workflows gained PR-scoped concurrency (manual runs preserved).
  • Guards folded into detection: code_paths now runs the root-directory and README-link guards on one sparse blob:none checkout; the standalone root_directory_guard job and its verify dependency are removed, with verify still the required aggregate.
  • Free runner labels: small guard/aggregate/API jobs moved to ubuntu-slim and typechecking to ubuntu-24.04-arm. Verified against the ubuntu-slim image README — Node 24.21.0, Git 2.55.0, and gh 2.101.0 are present, no moved job needs the unsupported Docker-in-Docker, and every job sets a timeout under the 15-minute container cap.
  • Cloud secret-scan fetch: fetch-depth: 0 replaced by fetch-depth: 1 plus git fetch --no-tags --unshallow origin "$GITHUB_SHA", keeping the HEAD-rooted gitleaks scope; a real-git fixture proves both merge parents and deleted blobs are still scanned and unrelated refs are not fetched.
  • Shared main-branch caches: new hourly ci-cache-warmup.yml seeds Node 24 native modules, the pinned Git 2.25.5 binary, and TypeScript incremental state on the default branch; prepare-git-compatibility is extracted into a composite action shared with pr.yml.
  • Unit shard timing evidence: a Vitest reporter plus importer record per-file environment/import/test durations and reject incomplete, duplicate, mixed, or failed runs; cloud/pnpm-lock.yaml is dropped from the unit shards' cache key (cloud is a separate pnpm project).
  • Mobile test dedup: the real bundle and route closures are memoized behind per-assertion copies, and parsed grant references are cached per file + source version, with regressions for both.

I re-ran the changed contract tests (10 files, 149 tests) and pnpm run check:code-quality:changed (0 findings) locally; both pass. The mobile bundling tests skip without mobile/node_modules and are covered by the hosted runs cited in the PR body.

ℹ️ The Cloud secret-scan fetch and its --log-opts are now a coupled pair

cloud-verify.yml now fetches exactly HEAD's ancestry, which is precisely what the gitleaks step scans (--log-opts="HEAD -- cloud ..."), so the scan scope is unchanged today. The two are now load-bearing on each other: if the scanned range is ever widened to a ref or range outside HEAD's ancestry (a base..head range, --all, or tags), the reduced fetch would silently scan an incomplete history and still report success. The new fixture test pins the current --log-opts string, so this is a note for future edits rather than a defect in this change.

Technical details
# Cloud secret-scan fetch/scan coupling

## Affected sites
- `.github/workflows/cloud-verify.yml:38-42` — `git fetch --no-tags --unshallow origin "$GITHUB_SHA"` fetches only HEAD ancestry.
- `.github/workflows/cloud-verify.yml:44-50` — gitleaks `--log-opts="HEAD -- cloud ..."` defines the scanned range.
- `config/scripts/cloud-security-history-workflow.test.mjs` — pins the current log-opts and proves merge-parent and deleted-blob coverage for HEAD.

## Required outcome
- Any future widening of the scanned range must be paired with a fetch that includes those refs, or the secret scan silently under-reports.

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

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.

Reduce CI queue pressure and PR runner time without paid capacity

1 participant