Skip to content

perf(ci): overlap Bun typechecking and skip redundant alias scans - #27382

Merged
nwparker merged 3 commits into
mainfrom
nwparker/static-analysis-investigation
Oct 11, 2026
Merged

nwparker merged 3 commits into
mainfrom
nwparker/static-analysis-investigation

Conversation

@nwparker

@nwparker nwparker commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Pull request checks spend less time waiting for typechecking to start. CI uses the measured faster compiler and runs it alongside the remaining independent checks, while local checks keep their fast incremental compiler.

What Changed

Patch two anti-slop rules to skip alias scans when the relevant keyword is absent. Unicode escapes still take the full scan, and per-file state is reset. The dependency stays pinned to the same upstream commit.

Add typecheck:ci using Bun 1.4.3 and the same four explicit project configurations. Run projects sequentially, start after the type-aware and changed-code gates, and join before admitting downstream jobs. Keep native TypeScript for local checks and package declarations. Remove the unused native CI build-state cache and warmer. Run the process import guard under Bun and anti-slop under Bun’s smaller-heap mode in CI.

Keep an opt-in ARM comparison workflow with counterbalanced timings, peak memory, file-list checks, intentional compiler errors, upstream rule fixtures, and success/error checks for the real lint and import-guard CLIs. A compiler-version guard prevents silently checking a package against a different TypeScript version.

Why

The linked job started compilation 113 seconds into a 156-second job. Historical combined jobs had a 206-second median. On the same four-core ARM checkout, four paired measurements showed:

Check Before After
Anti-slop alias scan 33.656s 30.819s
Cold native versus Bun typecheck 73.797s 47.970s
Import guard, Node versus Bun 21.418s 14.306s

Native warm typechecking took 7.545s, so local commands retain it. Paired Bun projects offered no useful gain over sequential projects. Bun reduced the main compiler's peak memory from about 12 GiB to 1.5 GiB, allowing overlap with the remaining checks.

Four paired measurements of the concurrent early phase dropped from 39.331s to 26.548s using the alias patch, Bun’s smaller-heap mode for anti-slop, and Bun for the import guard. Anti-slop peaked at 1.9–2.1 GiB in those concurrent runs. Isolated runs can still reach 9 GiB; the flag is not a hard memory limit, and the compiler starts only after this phase ends. Oxlint's combined typecheck was investigated too; its different project scope produced 413 diagnostics on an otherwise passing checkout, so it cannot replace these checks directly.

Linked Issue

Investigation of the preflight job for #27330.

Visual Proof

N/A — CI tooling only.

Testing

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

Frozen installs succeed. The upstream modified-rule fixtures pass. Local native/Bun source lists and exact negative diagnostics match for all four real project configurations. Tests cover compiler failures continuing to later projects, memory admission, compiler-version mismatch, phase selection, and downstream failure gates; 215 focused workflow/cache/runner/import-parser tests passed locally, followed by 56 tests covering the final runtime wiring. Native pnpm tc and the Bun CI command both pass locally.

The corrected ARM comparison passed both jobs: project file lists agree after normalizing standard-library names, intentional errors agree, and lint/import-guard success/error fixtures pass. A second runner reproduced the compiler gain: native cold 85.633s versus Bun 57.304s; fresh native incremental state 7.626s. The final comparison adds return-type, strict-null and implicit-any probes under each config's actual settings and checks the smaller-heap CLI's invalid fixture too.

Complete preflight Total Setup After setup
Baseline: alias patch, original compiler/scheduling 210s 35s 175s
Bun compiler and overlap; Node anti-slop 166s 26s 140s
Final: Bun anti-slop too 147s 28s 119s

The observed final job is 30% shorter; after setup it is 32% shorter. These are individual complete-job runs, with some setup/runner variation; the isolated compiler and early-phase comparisons use four counterbalanced pairs. The final full CI run and expanded comparison passed on the same head. Native cold versus Bun medians were 77.283s versus 48.681s; fresh native incremental checking took 7.428s. The expanded probes produced matching diagnostic lists in all four projects, and the Node/Bun/smaller-heap invalid lint fixture passed. Artifacts retain raw timings and memory records for 30 days.

The initial compiler harness completed its timing samples, then failed because disk and embedded standard-library paths were compared literally. The corrected ARM run above verifies the fix; no compiler mismatch was found.

Review

Subprocesses use the existing cross-platform process host. The normal local compiler, package declaration compiler, unit-test Bun pin, and remote execution behavior are unchanged. CI-only Bun 1.4.3 matches the installed TypeScript 7.0.2; upgrades require another parity comparison. The background compiler retains selected-phase/prior-success guards and a required join, so a type error still fails preflight.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

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 changed the title perf(ci): reduce static analysis and measure Bun typechecking perf(ci): overlap Bun typechecking and skip redundant alias scans Oct 11, 2026
@nwparker
nwparker marked this pull request as ready for review October 11, 2026 05:27
@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

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: c8377255-e784-449a-bdca-8e37111f29c3




📥 Commits

Reviewing files that changed from the base of the PR and between 22bcda1 and ab87c23.





⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml




📒 Files selected for processing (14)
  • .github/workflows/ci-cache-warmup.yml
  • .github/workflows/pr.yml
  • .github/workflows/preflight-benchmark.yml
  • .gitignore
  • config/patches/[email protected]
  • config/scripts/benchmark-preflight-compilers.mjs
  • config/scripts/benchmark-preflight-static-analysis.mjs
  • config/scripts/pr-preflight-gates.test.mjs
  • config/scripts/pr-workflow-parallelism.test.mjs
  • config/scripts/preflight-benchmark-command.mjs
  • config/scripts/run-typecheck-projects-in-parallel.mjs
  • config/scripts/run-typecheck-projects-in-parallel.test.mjs
  • package.json
  • pnpm-workspace.yaml




💤 Files with no reviewable changes (1)
  • .github/workflows/ci-cache-warmup.yml




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






📝 Walkthrough
📝 Walkthrough
📝 Walkthrough
📝 Walkthrough

Walkthrough

PR preflight now runs Bun-based typechecking as a background step and removes TypeScript incremental-state caching. New benchmark scripts compare native and Bun typechecking and measure static-analysis variants. New workflow jobs run the benchmarks and upload their reports. The anti-slop rules now skip type-alias environment creation under specified source guards.








Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to ab87c

No actionable merge-blocking issue was established. The preflight failure gate’s runner behavior remains unverified.

Pre-merge checks | Passed 3 | Failed 2

❌ Failed checks (2 warnings)

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 11 functions across 7 files. (6 skipped: 6… Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check Warning The description is detailed and covers the change, rationale, testing, review considerations, and checklist. However, the Linked Issue section references an Actions run and PR number instead of linkin… Add a direct link to the actual GitHub issue under Linked Issue and use the required issue reference format, such as Fixes #<issue-number>. Keep the existing testing and implementation details.
✅ Passed checks (3 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 summarizes the two primary changes: overlapping Bun typechecking in CI and skipping redundant alias scans.

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 11 functions across 7 files. (6 skipped: 6 unsupported.)


Full details: Description check

Explanation

The description is detailed and covers the change, rationale, testing, review considerations, and checklist. However, the Linked Issue section references an Actions run and PR number instead of linking an actual issue as required by the template.


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







  • Autofix · 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.

@nwparker
nwparker merged commit ac156c0 into main Oct 11, 2026
45 of 67 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