On Thursday night I deployed a change to the hub and the terminal told me it was finished. It wasn't. The build had refused to publish, the pipe in front of it swallowed the refusal, and the deploy command after the pipe shipped the folder from the build before.
I found it by reading the release file afterwards. That's the whole story, and it cost me an hour and a deploy that never happened.
Two files that describe the same four products
The hub is a private page where a client signs in and switches products on. The menu of products exists twice: once in products.json, which the page reads, and once in functions/lib/products.js, which the Worker reads. One is content, one is code, and content and code drift.
So the build checks them against each other before it publishes. Every check in build.mjs stops the build:
- the same product keys in both files
- the same mail address for each product in both files
- the noindex meta tag still on the page
- no repeated block where the page should have one
- the file ends with a closing html tag rather than being cut in half
On Thursday the second check fired. One product carried a different mail address in each file, which is the defect that sends a client's enquiry to the wrong inbox. The build printed that it was refusing to publish, and it was right.
The pipe decides, not the build
I ran the build and the deploy as one line, with the output trimmed so the terminal stayed readable. The shape was node build.mjs | tail -3 && wrangler deploy.
A shell pipeline reports the exit status of its last command. The last command was tail, and tail read three lines and exited zero. The build's refusal, exit code 2, never reached the &&. So wrangler ran, found a dist folder, and deployed it.
| What I wanted | What the shell saw | What happened |
|---|---|---|
| a failed build stops the deploy | tail exits 0 | the deploy ran anyway |
| readable output | three lines, one of them the refusal | the refusal was on screen and I read past it |
| the change live | the previous dist folder | Deployment complete, for the old bundle |
What production actually served
Nothing I changed was live. The deploy was real: it uploaded a complete, working site, built from the commit before the one I meant to ship. Every symptom of success was present. The URL answered, the page rendered, the log said complete.
The release file gave it away. Each build writes dist/release.json with the release name, the commit it was built from and the time. I compared that commit with the head of the repository and they weren't the same commit. Rebuilt properly, both moved together.
What I changed
Two things, both small. The build now runs as its own command. When I want short output it goes into a file and I read the end of the file, so the build's exit status stays where the shell can see it. And every deploy ends with reading the release file and comparing its commit with the commit I meant to ship. Two commands, about five seconds.
The habit matters more than the fix. A green terminal is not evidence. The release file is evidence, because the build that made the folder wrote it and it names the commit.
Where it stops
This catches a build that refused, and a bundle built from the wrong commit. It doesn't catch a change that builds cleanly and is wrong. A form that submits to the wrong inbox passes every check above. It also doesn't prove the page works once live; that takes a browser, a client's password and a real submission.
I would tell you not to buy a version of this where the person deploying can't show you which build is live. If the answer to "what is running" is a screenshot of a terminal, that's a report, not a check. On a brochure site that's a nuisance. On a page that takes bookings or touches an inbox, it's the difference between a fixed page and a page you believe is fixed.
The last broken page I wrote about failed the other way: a status row that stopped half a page, found by reading the file because no test would have caught it. Same lesson from opposite ends. The thing that tells you it worked isn't the thing that proves it.
If you want to know which build is live on your own site, or what an agent should check before it tells you a job is done, start with Begin.
Questions answered
What went wrong exactly?
The build checks two product files against each other and refuses to publish when they disagree. It did refuse. The output went through tail, the shell read tail's exit status instead of the build's, and wrangler deployed the previous dist folder.
How did you catch it?
dist/release.json names the release and the commit it was built from. Comparing that commit with the head of the repository showed they were different, so the live site was the old bundle.
Does this check prove the page works?
No. It proves the build that made the folder succeeded and which commit it came from. It says nothing about a wrong change that builds cleanly or about the page in a browser.