Skip to content

ci: share PR planning setup and reuse the static native cache - #24329

Merged
nwparker merged 6 commits into
mainfrom
nwparker/CI-Concurrency-2
Oct 1, 2026
Merged

nwparker merged 6 commits into
mainfrom
nwparker/CI-Concurrency-2

Conversation

@nwparker

@nwparker nwparker commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

PRs spend less runner time preparing the same checks. Test planning shares the typecheck runner, and static analysis prepares the native cache that the tests already need. Static analysis and typechecking keep separate CPUs.

What Changed

  • Run planning alongside typechecking after shared checkout/dependency setup, explicitly join it before publishing the plan, and pass its shard output to the existing unit workflow.
  • Pin static analysis's existing native install to Node 24, matching the five unit shards, and remove the separate conditional PR cache primer.
  • Skip building the dependency graph when changed paths already require the full suite. Keep the same conservative fallback and complete discovery list.
  • Preserve both failure gates, all five shards, package checks, routing/cancellation, and daily Node 24/26 reference coverage. Retire temporary pilots and document the measurements.

Why

Three hosted samples reduced the sum of separate type/planning job medians from 60 to 37 seconds. Against the 139-second median static job, that models roughly 12% less preflight runner occupancy, not a total-CI speedup. Three fresh native-cache producers were successfully reused by three consumers.

A six-pair comparison on current main confirmed identical plans and successful checks. Direct compiler/planner commands took 11.0–11.6 seconds before versus 6.3–6.8 after with restored state; deleting state gave 61.7–67.4 before versus 55.5–60.1 after. Those timings exclude setup and queues. These samples used global CI changes; source-only changes still construct the import graph.

Combining static analysis too saved occupancy but delayed cold preflight by about 40 seconds. Starting the compiler earlier did not resolve that contention. Line-count reporting remains separate because it uses trusted scripts with PR write permissions and has little runner demand. Coverage reductions and fewer shards were not justified by these measurements.

Linked Issue

N/A — internal CI improvement requested by a maintainer.

Visual Proof

N/A — CI scheduling only; no UI changes.

Testing

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

macOS arm64: pnpm tc, changed-code quality gate, and 171 targeted tests passed. Contracts cover plan publication, failure gates, routing, native-cache compatibility, background joins, and lazy graph evaluation.

Hosted Linux ARM: repeated warm/cold comparisons passed with matching planning outputs; three fresh native-cache producer/consumer pairs passed. Final ready-PR validation passed all five unit shards, Linux/Windows packaging, relay integration, compatibility, and repository checks. Its complete reference report accounts for all 10,310 discovered files exactly once, with no unhandled errors or omitted coverage.

Review

Benchmarks and rejected alternatives are recorded in docs/reference/ci-runner-efficiency.md. Temporary experiment code remains available through the historical run commits.

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

No app runtime or SSH behavior changes. The line-count job's permission boundary remains separate. Cold-cache misses still use the existing native rebuild fallback.

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)

@nwparker
nwparker force-pushed the nwparker/CI-Concurrency-2 branch from 052e700 to 1e4ca78 Compare October 1, 2026 09:02
@nwparker nwparker changed the title ci: reduce PR runner demand with measured scheduling changes ci: share PR planning setup and reuse the static native cache Oct 1, 2026
@nwparker
nwparker marked this pull request as ready for review October 1, 2026 09:17
@coderabbitai

coderabbitai Bot commented Oct 1, 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: f1cf0bd7-2ab9-4265-ab67-0e3842891262

📥 Commits

Reviewing files that changed from the base of the PR and between 3a6148e and 17e3c33.

📒 Files selected for processing (12)
  • .github/workflows/pr.yml
  • config/scripts/ci-background-step-barriers.test.mjs
  • config/scripts/ci-cache-warmup-workflow.test.mjs
  • config/scripts/ci-unit-plan.mjs
  • config/scripts/ci-unit-selection.mjs
  • config/scripts/ci-unit-selection.test.mjs
  • config/scripts/pr-code-change-scope.test.mjs
  • config/scripts/pr-preflight-gates.test.mjs
  • config/scripts/pr-ready-check-reuse.test.mjs
  • config/scripts/pr-workflow-parallelism.test.mjs
  • docs/reference/ci-demand-rollout.md
  • docs/reference/ci-runner-efficiency.md

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


📝 Walkthrough

Walkthrough

The PR workflow now runs unit planning in the background of typecheck and waits for it before uploading the selection artifact. The test job uses the shard count from typecheck and requires successful code-path detection, static analysis, and typecheck. Static analysis installs dependencies with Node 24. Unit selection can defer dependency-graph construction when changes already require full selection. Workflow tests and CI documentation reflect these changes.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 17e3c

The shared planning setup preserves full-suite fallback and requires successful planning and quality checks before unit tests start. No merge-blocking issue is established; merge after normal checks pass.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 17e3c

The change preserves mandatory check gates and read-only PR permissions. No new credential exposure was demonstrated, but native-cache reuse between PR and trusted branch runs remains unverified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The demonstrated affected scope is PR CI runners, selection handoffs, and native-module cache consumers. No newly privileged deployment or tenant-data path was established. Cache-key text alone does not establish the maximum cross-ref exposure; hosted cache visibility remains unresolved.

Trust Boundaries and Controls

  • inferred — PR-controlled code can influence planning and native build contents, as it could in the base workflow. Read-only permissions, non-persisted checkout credentials, and the absence of added secrets constrain authority. Native-cache compatibility checks do not authenticate cached content, so they are not proof against poisoning across trust boundaries.

Resilience and Maintainability Implications

  • inferred — The join barrier, successful prerequisites, source-and-discovery validation, and full-suite recovery contain ordinary planning failures without silently removing required checks. Diagnostic download failure does not authorize reduced execution.
🚥 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 2 functions across 9 files. (3 skipped: 3 … 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 and concisely summarizes the main CI changes: sharing PR planning setup and reusing the static native cache.
Description check ✅ Passed The description follows the required template, explains the changes and rationale, documents testing and benchmarks, and completes the relevant checklist items. The N/A linked issue is justified as an…
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 2 functions across 9 files. (3 skipped: 3 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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.

@greptile-apps

greptile-apps Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 4/5

[High risk] Restructures CI workflow planning and native cache setup.

The PR is not ready to merge because an artifact-upload failure can prevent an otherwise valid unit-test run.

Findings

  1. P1 Artifact outage blocks unit tests ▶

Summary

The PR runs unit planning alongside typechecking, uses static analysis to prepare the Node 24 native cache, and avoids constructing the unit dependency graph when changed paths already require the full suite.

  • The shard output and failure gates remain connected, but the moved diagnostic artifact upload now makes artifact-service availability a prerequisite for unit tests.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Paths[PR path routing] --> Static[Static analysis<br/>Node 24 native cache]
  Paths --> Type[Typecheck job]
  Type --> Compiler[Compiler]
  Type --> Plan[Background unit plan]
  Plan --> Join[Join and publish shards]
  Join --> Upload[Plan artifact upload]
  Static --> Gate[Unit-test gate]
  Upload --> Gate
  Compiler --> Gate
  Gate --> Shards[Unit shards]
Loading

Reviews (1) · Last reviewed commit: "docs: record CI measurements and retire ..."

Comment thread .github/workflows/pr.yml
Comment on lines +391 to +395
- uses: actions/upload-artifact@v7
with:
name: unit-selection-attempt-${{ github.run_attempt }}
path: ci-shards/unit-selection.json
retention-days: 14

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Artifact outage blocks unit tests

If the artifact upload fails, it now fails the typecheck job even when compilation and planning succeeded. The unit-test job requires typecheck to succeed, so all unit shards are skipped. The previous planning workflow allowed this diagnostic upload to fail, and the shards still tolerate a missing artifact.

Suggested change
- uses: actions/upload-artifact@v7
with:
name: unit-selection-attempt-${{ github.run_attempt }}
path: ci-shards/unit-selection.json
retention-days: 14
- uses: actions/upload-artifact@v7
continue-on-error: true
with:
name: unit-selection-attempt-${{ github.run_attempt }}
path: ci-shards/unit-selection.json
retention-days: 14

@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 critical issues — minor suggestions inline.

Reviewed changes

  • PR planning moves onto the typecheck runner: the unit_plan job is removed and ci-unit-plan.mjs now runs as a background step (id: unit-plan) alongside pnpm run typecheck, joined by wait: unit-plan before the artifact upload; shards leave the job via typecheck.outputs.shards. The unit-plan.yml reusable workflow remains, now only used by the daily node-next-compat.yml.
  • Native cache is seeded by static_analysis: its two Node installs are pinned to 24 so they fill the same ARM native-modules key the PR shards restore, and the test_native_cache job plus the code_paths.native_cache_changed output are removed. test now depends on static_analysis/typecheck.
  • Lazy dependency graph: selectUnitFiles accepts a graph object or provider function and only constructs the graph once every changed path is under src/, so global or missing evidence still returns the full plan without building the import graph.
  • Tests and docs: new pr-preflight-gates.test.mjs, updated workflow-topology tests, and measurement notes in ci-runner-efficiency.md / ci-demand-rollout.md.

I verified the load-bearing contracts rather than just the topology: wait both surfaces background-step outputs and fails the job when the step failed, so the plan gate is real; test implies static_analysis/typecheck through ALWAYS_ON_CODE_JOBS, so the stricter test.if cannot skip a job that should run; and the native cache key (ubuntu-24.04 + ARM64 + node + resolved node 24 + root lockfile hash) is identical between static_analysis and the shards, including the mobile install variant. All 113 affected vitest cases pass locally.

ℹ️ Nitpicks

  • config/scripts/pr-code-change-scope.mjs:426 still computes native_cache_changed, and pr-code-change-scope.test.mjs still covers it, but no workflow consumes it after this change dropped the code_paths output and its primer. Either remove the field, isNativeCacheInputPath, and that test, or leave a comment recording the intended future consumer.
  • .github/workflows/unit-tests.yml:18 describes the shards input as "produced by unit-plan.yml". On the PR path it now comes from the typecheck plan step; only the daily workflow calls unit-plan.yml. Worth widening the wording to "produced by the caller's planner".

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

Comment thread .github/workflows/pr.yml

- wait: unit-plan

- uses: actions/upload-artifact@v7

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 upload is now on the required typecheck path without continue-on-error, yet the shard matrix is driven by needs.typecheck.outputs.shards, not by this file (the consumers download it best-effort: unit-tests.yml uses continue-on-error: true, and the evidence job is advisory). So a transient artifact-service failure now reds a required check and skips the whole unit matrix, even though every shard could still be scheduled correctly. unit-plan.yml still uploads the same file with continue-on-error: true; can you confirm the stricter behavior here is intended rather than incidental?

@nwparker
nwparker merged commit bd90da7 into main Oct 1, 2026
36 checks passed
@nwparker
nwparker deleted the nwparker/CI-Concurrency-2 branch October 1, 2026 09:46
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