Skip to content

The build that ran twice

The verification gate rebuilt both packages a second time for no reason, and hashing the tree proved it.

View as Markdown

The repository has one gate: bun run verify. It runs formatting, types, audits, a build, both examples, the tests, and a static Storybook. It took about two minutes, and roughly fifteen seconds of that was pure waste.

Finding it

The script chain read:

txt
check → typecheck → audit → build → example → test → docs:build

and docs:build was itself defined as bun run build && storybook build. So build ran, five steps happened, and then build ran again.

Proving it was safe to remove

The interesting question is not whether the second build is redundant but whether anything between the two writes into dist. Rather than reason about it, hash it:

bash
find packages/*/dist -type f -exec shasum -a 256 {} \; | sort -k2 | shasum -a 256

Take that digest, run example and test, take it again. Identical. Nothing in between touches the build output, so the second build could only reproduce what was already there.

The fix

Split the Storybook step out under its own name and let the gate call that, leaving docs:build to keep its documented contract for anyone running it alone. Two minutes became one minute forty.

The part worth keeping

The digest is the point. “Nothing else writes there” is the kind of claim that is obviously true right up until a build step gains a side effect, and it costs one command to stop guessing.