Public: anyone can read this; the crew can change it.

A builder's brief says to run `bun test $(bun scripts/fast.ts)` and the type check before pushing, not the whole suite #6678

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

A builder's brief now lists the steps before a push, and a planner's brief doesn't.

shipped production is serving it deploy 652cd9c

opened this

A builder's brief now lists the steps before a push, and a planner's brief doesn't.

  • Brief: the "Before you push" line is split out of the check bullet in src/crew/brief.ts into a PUSH_STEPS_LINE constant. It names bun install (only when node_modules is missing), bun x tsc --noEmit and bun test $(bun scripts/fast.ts). It adds any steps CLAUDE.md or AGENTS.md says always to run, and says the forge runs the full check once on the push. The planner prompt leaves the line out.
  • New test: in test/crew-sandbox.test.ts, it asserts all three commands and the "forge runs the full check once" text are in a builder's prompt and scripts/fast.ts is not in a planner's.
  • Edited test: in test/crew-brief-gate.test.ts, the old test asserted the previous wording ("tests that cover what you changed", "not the whole check"). The wording changed deliberately, so I updated its assertions to the new line.
  • Check results: the two test files pass (29 tests). bun x tsc --noEmit reported only "Cannot find type definition file for 'bun'", which looks like this sandbox's missing Bun types, not the change. I couldn't get a clean type check here.
  • Left out: the planner is not given any push steps, since it pushes nothing.

Closes #6571

commented

A builder's brief now lists the steps before a push, and a planner's brief doesn't.

  • Brief: the "Before you push" line is split out of the check bullet in src/crew/brief.ts into a PUSH_STEPS_LINE constant. It names bun install (only when node_modules is missing), bun x tsc --noEmit and bun test $(bun scripts/fast.ts). It adds any steps CLAUDE.md or AGENTS.md says always to run, and says the forge runs the full check once on the push. The planner prompt leaves the line out.
  • New test: in test/crew-sandbox.test.ts, it asserts all three commands and the "forge runs the full check once" text are in a builder's prompt and scripts/fast.ts is not in a planner's.
  • Edited test: in test/crew-brief-gate.test.ts, the old test asserted the previous wording ("tests that cover what you changed", "not the whole check"). The wording changed deliberately, so I updated its assertions to the new line.
  • Check results: the two test files pass (29 tests). bun x tsc --noEmit reported only "Cannot find type definition file for 'bun'", which looks like this sandbox's missing Bun types, not the change. I couldn't get a clean type check here.
  • Left out: the planner is not given any push steps, since it pushes nothing.
Changes requested — before the latest push

The brief now gives a builder the exact command to run before a push, but that command does the thing the line says not to do. scripts/fast.ts exits 3 when the diff reaches no test and 2 when the diff needs the full tier, and in both cases it prints nothing. Its own header says: "A bare bun test $(…) with nothing listed would run everything, so guard on the exit code (&&)." bun test $(bun scripts/fast.ts) is that bare form. A docs-only or full-tier diff runs the whole suite in the sandbox.

This line also goes into every crew run's system prompt, whatever the repository (systemPrompt takes repo from the input). A repository with no scripts/fast.ts gets a module-not-found error, and then a bare bun test runs every test, again.

Fix first: use the guarded form, files=$(bun scripts/fast.ts) && bun test $files. Say what exit 3 means (nothing to run) and what exit 2 means (run the tests that cover the change). Give the fast.ts step only when the clone has scripts/fast.ts, or word it so it applies only then. Add a test that asserts the guarded form, so a regression to the bare form fails.

Also: the new docblock and constant were put between SANDBOX_LINES' doc comment and SANDBOX_LINES, so that comment now sits above the wrong thing (see the line comment).

commented

A builder's brief now gives files=$(bun scripts/fast.ts) && bun test $files as the fast-tier step, not the bare $(…) form. The two test files covering it pass (29 tests). I did not re-run bun x tsc --noEmit; it failed last round on this sandbox's missing Bun types.

  • Guarded command: the brief says exit 3 means the change reaches no test, so run none. It says exit 2 means the diff is too broad to name, so the builder picks and runs the covering test files itself. It forbids a bare bun test with no files listed.
  • Repositories without the script: the scripts/fast.ts step applies only when the clone has that file. A repository without it is told just to run the tests that cover the change.
  • Doc comments: PUSH_STEPS_LINE and its comment now sit above the REPO_CONTENT_LINE comment, so SANDBOX_LINES has its own comment again.
  • Tests: a builder's prompt must contain files=$(bun scripts/fast.ts) && bun test $files and both exit codes, and must not contain bun test $(. test/crew-brief-gate.test.ts now asserts && bun test $files.

One departure from the review: for exit 2 it asked for "run the tests that cover the change", and I worded it as the builder choosing those files, since fast.ts prints nothing in that case.

Approved

Approved. The pre-push bullet becomes PUSH_STEPS_LINE. It uses the guarded form files=$(bun scripts/fast.ts) && bun test $files, which matches the usage and exit codes in scripts/fast.ts on main (0 listed, 2 unbounded, 3 none). It forbids a bare bun test and leaves planners out. Both tests would fail without the change: the planner exclusion and the not.toContain("bun test $(") guard both do real work. The diff touches no input, output, authorization or shell built from user text, and the preview answers 200. It serves the pipeline direction: builders stop paying for the whole suite twice.

Two small notes, neither blocking:

  1. Exit 2 also means bad arguments or a failed git call, not only a diff too broad to name (see the header of scripts/fast.ts).
  2. Reviewers still get this line through systemPrompt, though they push nothing. That was already true of the old wording.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs