Skip to content

Share PR preflight setup to reduce runner demand - #25150

Merged
nwparker merged 3 commits into
mainfrom
nwparker/ci-share-preflight-20261004
Oct 4, 2026
Merged

nwparker merged 3 commits into
mainfrom
nwparker/ci-share-preflight-20261004

Conversation

@nwparker

@nwparker nwparker commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 11 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​99 $\color{#cf222e}{\Huge{\mathbf{−}}}$​63 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​36
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​106 $\color{#cf222e}{\Huge{\mathbf{−}}}$​41 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​65

ELI5

PR static analysis and typecheck share one runner. Three hosted pairs saved 19 active runner seconds at the median and reduced two heavy runner admissions to one.

What Changed

Keep the existing path flags, checks, compiler command, cache keys and unit plan. Run static checks and their joins before compilation, with planning still in the background. Register no-op background bodies for unselected or blocked phases. Gate unit tests and packaging on the complete preflight job result, including action cleanup.

Why

Concurrency is the constraint. Sharing checkout and dependency setup saves capacity. In these quiet-queue samples the dependency barrier was about 16 seconds later, so this does not claim a whole-PR speedup. It avoids another runner admission while keeping each check's log and failure gate.

Linked Issue

N/A — internal CI optimization.

Visual Proof

N/A — workflow wiring only.

Testing

  • Local workflow contracts, lint and formatting passed.
  • Automated tests updated for phase selection, compiler/planner ordering, joins, physical failure and consumer gates.
  • 239 tests across 12 local workflow suites passed.
  • Three counterbalanced hosted ARM pairs on the same frozen checkout/toolchain/cache hits and 10,787-file unit plan: separate active jobs 152 / 153 / 151s; combined 138 / 133 / 129s. Excluding measurement-only evidence steps: median 151 → 132s (12.6%). Measurement run.
  • Actual compiler type error and controlled late action cleanup failure both blocked unit/package admission; all unselected and prior-failure background bodies joined. Failure controls.
  • Mixed-mobile install qualification passed with byte-identical compiler input graphs and unit-selection output on the same checkout. Qualification run. Final-head required CI must pass before merge.

Review

README/cloud/mobile phase routing remains explicit. The same Node 24 setup serves both phases. A static failure stops compilation, and a failed/cancelled physical job cannot admit downstream work even if it already published shard outputs.

Agent skill upstream boundary

  • Not applicable; no upstream skill source is copied.

Checklist

  • This PR is focused on shared preflight setup.
  • Explained before/after, mechanism and the capacity/latency tradeoff.
  • N/A visual proof has a reason.
  • Reviewed failure handling, path routing and cache preservation.
  • Platform/SSH application behavior is unchanged; hosted ARM CI verified.
  • Local workflow tests and lint passed; required CI covers the final head.

@nwparker
nwparker marked this pull request as ready for review October 4, 2026 08:06
@nwparker
nwparker requested a review from brennanb2025 as a code owner October 4, 2026 08:06
@coderabbitai

coderabbitai Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 25 seconds.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 791d0bfc-5842-4ae1-a6eb-371f4d7f0482
📥 Commits

Reviewing files that changed from the base of the PR and between 3cc5e1d and 5ffa6f8.

📒 Files selected for processing (13)
  • .github/workflows/pr.yml
  • config/scripts/check-node-runtime-pin.test.mjs
  • config/scripts/ci-background-step-barriers.test.mjs
  • config/scripts/ci-cache-warmup-workflow.test.mjs
  • config/scripts/localization-extraction-change-scope.test.mjs
  • config/scripts/orcad-terminal-smoke-change-scope.test.mjs
  • config/scripts/pr-code-change-scope.test.mjs
  • config/scripts/pr-e2e-gate-contract.test.mjs
  • config/scripts/pr-preflight-gates.test.mjs
  • config/scripts/pr-ready-check-gate.test.mjs
  • config/scripts/pr-ready-check-reuse.test.mjs
  • config/scripts/pr-workflow-parallelism.test.mjs
  • docs/reference/ci-runner-efficiency.md
  • Autopilot · 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.

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

ℹ️ Minor suggestions only — no blocking issues found. The combined gate wiring traces correctly; the notes below are a test-coverage gap and stale references.

Reviewed changes

  • Combined preflight job — the former static_analysis and typecheck jobs are one ubuntu-24.04-arm job sharing a single checkout and Node 24 install.
  • Serialized phases — static checks and every static background join run before pnpm run typecheck; unit planning still overlaps compilation, and preflight.outputs.shards now feeds test.
  • No-op phase guards — background steps use if: '!cancelled()' plus PREFLIGHT_PHASE_SELECTED/PREFLIGHT_PRIOR_SUCCESS so an unselected or already-failed phase still registers a successful wait join.
  • Rewired consumers — test/package/package_windows/verify gate on preflight; verify's PREFLIGHT_SHOULD_RUN mirrors preflight.if.
  • Tests and docs — job-name renames across the workflow contract tests, new pr-preflight-gates assertions, and a new ci-runner-efficiency.md section.

ℹ️ Nitpicks

  • config/scripts/pr-preflight-gates.test.mjs:88 asserts only that PREFLIGHT_PHASE_SELECTED contains needs.code_paths.outputs., not which classifier each guard uses; see the inline note.
  • config/scripts/pr-preflight-gates.test.mjs:30 relaxed plan.run from toBe to toContain. An appended || true on line 2 would let a failing planner report success into preflight.outputs.shards and still pass this suite.
  • .github/workflows/pr.yml:164 says the ARM choice is "same as the typecheck job" — that job no longer exists. config/scripts/check-readme-local-links.test.mjs:159 likewise still names static_analysis.
  • docs/reference/ci-runner-efficiency.md:604 still reads "Combining static analysis too was rejected," which the new section at :1898 now contradicts. A one-line cross-reference noting the serialized (non-contended) arrangement supersedes the earlier rejection would save the next reader the search.
  • The PREFLIGHT_PRIOR_SUCCESS guard is captured at step launch, so for the overlapping localization-extraction/localization-catalogs pair the second step can still run if the first fails before it launches. The shared wait still fails the job, so this is only a small amount of redundant work — not a correctness hole.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

it('registers successful no-op background work when a phase is unselected or already failed', () => {
for (const step of steps.filter((step) => step.background)) {
expect(step.if).toBe('!cancelled()')
expect(step.env.PREFLIGHT_PHASE_SELECTED).toContain('needs.code_paths.outputs.')

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.

This assertion pins only the needs.code_paths.outputs. prefix, so it cannot tell which classifier each background step consumes. Swapping static_analysis↔typecheck on any guard (e.g. Lint) would silently no-op that check on a mobile-only PR while this suite stays green, and the non-background gated steps (pr.yml:213,230,254,260,…) have no phase assertion at all.

Technical details
# Pin each guard's phase expression

## Affected sites
- config/scripts/pr-preflight-gates.test.mjs:88 — substring-only assertion over `PREFLIGHT_PHASE_SELECTED`
- .github/workflows/pr.yml:206,223,247,316,365 — these must evaluate `needs.code_paths.outputs.static_analysis == 'true'`
- .github/workflows/pr.yml:422 — `unit-plan` must evaluate `needs.code_paths.outputs.typecheck == 'true'`
- .github/workflows/pr.yml:213,230,254,260,264,268,272 — non-background gated steps, currently unasserted

## Required outcome
- Every phase-guarded step asserts its exact classifier expression (e.g. an `id`→phase map), so a swapped phase fails the suite.

## Open questions for the human
- Is the non-background phase coverage intentionally omitted, or worth pinning too?

@nwparker
nwparker merged commit c4e8735 into main Oct 4, 2026
60 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