Skip to content

Add pnpm check:contribution, the light check before a pull request, and a dev container - #1204

Merged
felipesauer merged 10 commits into
mainfrom
add-check-contribution-command
Nov 12, 2026
Merged

felipesauer merged 10 commits into
mainfrom
add-check-contribution-command

Conversation

@felipesauer

@felipesauer felipesauer commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

What changes and why

Contributors working in small sandboxes hit 5 s timeouts running the whole suite. pnpm check:contribution is a lighter check to run before a pull request. It runs, in order: lint, build, typecheck, the guards (vitest with the guards configuration), and only the tests tied to the files changed against the merge base with the project's main. Guards and changed tests run with one worker and a 30 s test timeout, set by this command only and by no workflow. It ends by saying what it ran and that CI runs the whole suite.

  • The base is upstream/main, then origin/main, or the ref in MNEMA_BASE. A missing main says which commands fetch it (including adding upstream in a fork); a shallow clone says git fetch --unshallow; a MNEMA_BASE that is no ref says so.
  • --changed does not follow @mnema/* across packages (they resolve to dist), so a change under packages/<name>/src also runs every test of the packages that import it. That step is never skipped, even when a changed package.json makes vitest run every test anyway, so some files then run twice: skipping it on a guess about which files vitest treats that way was wrong once.
  • A change to the Python reader under packages/chain/verifier/ also runs its self-test and vectors.
  • --plan prints the steps as JSON without running them; the test of the command uses it.

.devcontainer/devcontainer.json gives Node at the engines floor, pnpm through corepack, Python 3.12 and a frozen-lockfile install, with the image and features pinned. AGENTS.md and CONTRIBUTING.md name the command as the check before a pull request, and a changelog entry is added.

The guard that refuses a raised test ceiling lists run.mjs as the one exception (not its test, which spells the flag in parts).

Proof

the-contribution-check-is-the-light-one.test.ts asks the script for its plan and runs the guards step and the changed-tests step on a small filter, so a flag vitest refuses is red (putting back the duplicate --maxWorkers made it fail with vitest's own error). It also covers the dependents step, the Python step, the refusals and that no workflow names the command. It sets NO_COLOR and strips control characters, and fixes the changed-file list so an uncommitted edit does not change it. build, lint, typecheck, the whole suite, test:guards and pnpm check:contribution itself pass.

Written with an agent?

  • Model: Claude Sonnet 5.5
  • Host (the program it ran in): Claude Code
  • Host version: n/a

@felipesauer

Copy link
Copy Markdown
Member Author

Review: approved at 2606abc.

Three rounds of independent review, each with the defect put back to see the test fail:

  • the guards step passed --maxWorkers twice and never ran; the tests now execute the steps, not read them;
  • vitest --changed does not reach consumers in another package (packages import each other through dist), so a change under packages/<p>/src now also runs, whole, the tests of every package that depends on it, and that step is never skipped;
  • a change to the Python reader runs its self-test and vectors.

Known limits, stated in CONTRIBUTING.md: this is a subset; a change only to a vitest config file runs no test locally, and fixtures read from disk are not followed. CI runs the whole suite and is the check that counts.

@felipesauer
felipesauer merged commit 0ad8c3d into main Nov 12, 2026
27 checks passed
@felipesauer
felipesauer deleted the add-check-contribution-command branch November 12, 2026 04:44
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