Skip to content

feat(devex): pnpm check:changed as the single pre-handoff gate - #33432

Merged
nwparker merged 5 commits into
mainfrom
nwparker/check-changed
Oct 25, 2026
Merged

nwparker merged 5 commits into
mainfrom
nwparker/check-changed

Conversation

@nwparker

@nwparker nwparker commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​125 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​125
Prod 6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​672 $\color{#cf222e}{\Huge{\mathbf{−}}}$​5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​667

What Changed

Adds pnpm check:changed, one command an agent runs before handing work off. It replaces having to remember test:changed, check:code-quality:changed, tc, and the ratchets.

  • Scope: changes since the origin/main merge base, plus staged, unstaged, and untracked files. If nothing changed, it exits immediately.
  • Checks, run in parallel: oxfmt check and oxlint on the changed files (plus anti-slop), the existing changed-code-quality gate, typecheck through the existing tsrs runner, Vitest related tests, and any ratchets or verifiers whose inputs were touched. Only failures are printed, each with the tail of its output.
  • Reuse: CI's classifyPrJobs decides whether static analysis, typecheck, and tests run at all. CI's affectsLocalizationExtraction gates the extraction check, and listRatchetScripts supplies the ratchets, so local selection and CI selection can't drift.
  • Path mapping: config/scripts/check-changed-selection.mjs holds a small table from path prefixes to verifiers. For example, locale files trigger the localization catalog and coverage checks, and changes under src/main/runtime/rpc trigger the RPC params catalog check. Typecheck runs only the projects a changed tree can reach.
  • Pass cache: after a full pass, it writes a hash to the gitignored .cache/check-changed.json. The hash covers the merge base, each changed path's contents, untracked files, the lockfile, and the relevant config. If the hash still matches on the next run, it prints Nothing changed since last passing run and exits. Staging or committing a change that already passed keeps the pass. --force skips the cache.
  • Tests: two kinds of path would make Vitest pick the whole suite:
    • Paths matching forceRerunTriggers (config/**, package.json, the lockfile, src/packages/**). For these it runs only their colocated *.test.* files. The full run stays CI's job.
    • When the dependency-record cache covers less than 95% of the suite, a Vitest run would treat every test without a record as affected. In that case it uses the static import graph instead.
  • AGENTS.md now names pnpm check:changed --maxWorkers=2 as the single command to run before handoff.

Why

Agents skip or forget some of the four or five gates before saying they're done, and running them one after another is slow. One parallel command that knows which checks a diff needs, and returns instantly when nothing changed, makes the right thing the easy thing.

Testing

This branch (8 changed files, which touch package.json and so select every check: 4 typecheck projects plus 31 other checks), on a heavily loaded M-series Mac:

Run Time
--force (tsrs incremental cache warm) 35–56s
Cached rerun, also after committing 0.44s
  • Breaking one assertion on purpose produced ✗ unit tests with the Vitest diff, and the cache was not written. Reverting the change hit the cache again.
  • pnpm tc passes, and oxlint and oxfmt are clean on the changed files.
  • New tests: pass-cache invalidation (unstaged, untracked, and lockfile edits; a hit after staging or committing) and path selection (docs-only, verifier routing, typecheck projects, Vitest full-run triggers).

Tested on macOS only. Process launches go through @orca/process-host, oxc bins run under node, and pnpm is resolved through pnpm-cli-invocation.mjs.

Runs format, oxlint, the changed-code gate, affected typecheck projects,
affected unit tests, and the ratchets/verifiers whose inputs changed, in
parallel against the origin/main merge base plus local edits. Printing is
limited to failures, and a pass is cached by a hash of the diff, untracked
files, lockfile, and config so an unchanged rerun exits immediately.
@nwparker
nwparker marked this pull request as ready for review October 25, 2026 06:16
@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Walkthrough

The pull request adds a command that selects and runs checks based on changed files. It adds path-selection rules for verifiers, typecheck projects, and unit tests, plus a pass cache that records successful runs. The command supports merge-base options, concurrent task execution, and a force option. Tests cover cache behavior and check selection. The package script and repository guidance now include the command.

Priority: Normal

Merge Risk: Low · up to 2a5a9

Developers with commit signing enabled may be unable to run the new cache test reliably. The issue is localized and has a straightforward fix.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Description check Warning The description clearly explains the main changes, rationale, behavior, and testing. However, it omits required template information, including an ELI5 section, a linked issue, explicit visual-proof s… Add the missing template sections and required information. Include an ELI5 summary, a valid Fixes #<issue> link or the applicable maintainer exception, N/A with a reason under Visual Proof, completed Testing and Checklist items, and no…
Docstring Coverage Warning Docstring coverage is 22.22% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 27 functions across 5 files. (3 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly identifies the main change: adding pnpm check:changed as the single pre-handoff gate.
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.
Full details: Description check

Explanation

The description clearly explains the main changes, rationale, behavior, and testing. However, it omits required template information, including an ELI5 section, a linked issue, explicit visual-proof status (N/A for this non-UI change), checklist responses, and several required review and compatibility sections.

Resolution

Add the missing template sections and required information. Include an ELI5 summary, a valid Fixes #&lt;issue&gt; link or the applicable maintainer exception, N/A with a reason under Visual Proof, completed Testing and Checklist items, and notes covering security, cross-platform support, remote SSH, mobile, compatibility, and performance.

Full details: Docstring Coverage

Explanation

Docstring coverage is 22.22% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 27 functions across 5 files. (3 skipped: 3 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

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.

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

Actionable comments posted: 1


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 45f4bdd5-8cd9-4c2e-8384-ba863152a101
Commits

Reviewing files that changed from the base of the PR and between b1e18d8 and 2a5a98d.

Files selected for processing: 8
  • .gitignore
  • AGENTS.md
  • config/scripts/check-changed-pass-cache.mjs
  • config/scripts/check-changed-pass-cache.test.mjs
  • config/scripts/check-changed-selection.mjs
  • config/scripts/check-changed-selection.test.mjs
  • config/scripts/check-changed.mjs
  • package.json

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

git('init', '-q')
git('config', 'user.email', 'test@example.com')
git('config', 'user.name', 'Test')
git('config', 'core.autocrlf', 'false')

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 · Functional Correctness · Quick win

Disable commit signing in the temp repository.

The test runs git commit in a temp repository. A developer with global commit.gpgsign=true makes that commit fail, or wait for a pinentry prompt. The git() helper asserts exit code 0, so beforeEach fails. The test then fails for a reason unrelated to the code. Set commit.gpgsign to false locally in the temp repository.

Proposed fix
--- "a/config/scripts/check-changed-pass-cache.test.mjs"
+++ "b/config/scripts/check-changed-pass-cache.test.mjs"
@@ -24,7 +24,8 @@
   git('init', '-q')
   git('config', 'user.email', 'test@example.com')
   git('config', 'user.name', 'Test')
   git('config', 'core.autocrlf', 'false')
+  git('config', 'commit.gpgsign', 'false')
   writeFileSync(join(root, '.gitignore'), '.cache/\n')
   writeFileSync(join(root, 'tracked.ts'), 'export const a = 1\n')
   writeFileSync(join(root, 'pnpm-lock.yaml'), 'lockfileVersion: 9\n')
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
git('config', 'core.autocrlf', 'false')
git('config', 'core.autocrlf', 'false')
git('config', 'commit.gpgsign', 'false')

@nwparker
nwparker merged commit d08774d into main Oct 25, 2026
56 checks passed
@nwparker
nwparker deleted the nwparker/check-changed branch October 25, 2026 06:50
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