Repository navigation
ci: share PR planning setup and reuse the static native cache - #24329
Conversation
052e700 to
1e4ca78
Compare
|
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 configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (12)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe 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 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 ReviewSecurity architecture risk: 🔵 Low · up to 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 Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation 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.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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. Comment |
|
| - uses: actions/upload-artifact@v7 | ||
| with: | ||
| name: unit-selection-attempt-${{ github.run_attempt }} | ||
| path: ci-shards/unit-selection.json | ||
| retention-days: 14 |
There was a problem hiding this comment.
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.
| - 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 |
There was a problem hiding this comment.
ℹ️ No critical issues — minor suggestions inline.
Reviewed changes
- PR planning moves onto the
typecheckrunner: theunit_planjob is removed andci-unit-plan.mjsnow runs as a background step (id: unit-plan) alongsidepnpm run typecheck, joined bywait: unit-planbefore the artifact upload; shards leave the job viatypecheck.outputs.shards. Theunit-plan.ymlreusable workflow remains, now only used by the dailynode-next-compat.yml. - Native cache is seeded by
static_analysis: its two Node installs are pinned to24so they fill the same ARMnative-moduleskey the PR shards restore, and thetest_native_cachejob plus thecode_paths.native_cache_changedoutput are removed.testnow depends onstatic_analysis/typecheck. - Lazy dependency graph:
selectUnitFilesaccepts a graph object or provider function and only constructs the graph once every changed path is undersrc/, 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 inci-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:426still computesnative_cache_changed, andpr-code-change-scope.test.mjsstill covers it, but no workflow consumes it after this change dropped thecode_pathsoutput 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:18describes theshardsinput as "produced by unit-plan.yml". On the PR path it now comes from thetypecheckplan step; only the daily workflow callsunit-plan.yml. Worth widening the wording to "produced by the caller's planner".
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
|
|
||
| - wait: unit-plan | ||
|
|
||
| - uses: actions/upload-artifact@v7 |
There was a problem hiding this comment.
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?

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
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
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
docs/reference/agent-skill-sharing-upstream-boundary.mdand 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
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)