Repository navigation
feat(deploy): report the Worker's version and add the deploy smoke - #153
Merged
Merged
Conversation
The deploy pipeline (ADR-0110, round 29) has to know that the version it just deployed is the one answering before it calls the deploy good, and needs something real to check once it does. Neither existed: /healthz answers a constant `ok` that a contract test pins, and nothing in the repo carries a version. - The Worker declares [version_metadata] and sends the running version's tag (else its id) as x-thrust-version on every response it routes. It sends no header when it has neither, which is different from an empty one: the smoke has to read "absent" as a failure. A deploy will tag the version with the commit, so a Worker that still serves the old version cannot pass. version_label and set_version live in thrust-api, where a hermetic matrix and two properties can run them. - scripts/smoke-deploy.sh: three consecutive /healthz answers that carry the expected version, then a sign-in as a dedicated account and a read of its project from the database. It needs no test route and no admin token. It fails closed (no header, no account configured), and the password is in no argv and no output. - scripts/smoke-bootstrap.sh makes that account, workspace and project once per environment, by hand. - stage2-contract.sh skips the new bindings test: wrangler.stage2.toml has no version binding, and the deployed version is the smoke's to check. Local wrangler dev has no tag and a random UUID for the id (measured with wrangler 4.123.0), so the header there is that id; a deploy made without --tag looks the same and the smoke refuses it. Refs: #49 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This was referenced Nov 14, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First of four PRs for #49 (the deploy pipeline). Nothing deploys yet. This one adds what the pipeline needs to check that the version it just deployed is the one answering, and a smoke that reads real data. #49 stays open until the last of the four.
What
x-thrust-version. The Worker declares[version_metadata]and sends the running version's tag (else its id) on every response it routes, and no header when it has neither. A deploy will tag the version with the commit (wrangler deploy --tag <sha>), so a Worker that still serves the old version cannot pass the smoke. It is a header, not the/healthzbody:health_okpins the bodyokand the native server shares the handler.version_labelandset_versionlive inthrust-api, besideset_db_round_trips, so a hermetic suite can run them.scripts/smoke-deploy.sh <base-url> <expected-version>. Three consecutive/healthzanswers carrying the version, then a sign-in as a dedicated account and a read of its project from the database. No test route, no admin token. Fails closed: no header fails, and an unset account fails (exit 2) unlessSMOKE_AUTH=offsays to skip, loudly. The password is in no argv and no output.scripts/smoke-bootstrap.sh. Makes that account, workspace and project once per environment, by hand, through the routes any client uses. Safe to re-run.stage2-contract.shskips the newbindingstest (its config has no version binding);contract.shexpects 5bindingstests instead of 4.Evidence
cargo nextest run -p thrust-apiprop_teststest-smoke-deploy.sh(28 cases, in theci-scriptsjob)ubuntu:24.04. Breaking the version compare fails 3 cases, putting the password in a header fails the argv casescripts/contract.sh worker-cf bindings(local wrangler 4.123.0)SMOKE_FORCE_FAIL=1. Run with CSRF at the Worker's default (off) and with it on[version_metadata]fmt, clippy (native, every target; wasm32 Worker),check-deps.sh,check-topology.sh,check-placement.shMeasured, and different from what I assumed
Local
wrangler dev(4.123.0) has no tag and a random UUID for the id, so the header there is that UUID, not nothing. A deploy made without--taglooks the same, and the smoke refuses it because it is not the commit. The contract test therefore asserts the header is present, stable across answers and on a 404, and equalsTHRUST_EXPECT_VERSIONwhen that is set.Not verified
wrangler deploy --tagsets the tag the binding reports, and that the header then equals the sha, is from the Cloudflare docs only. PR 3's staging run is where it is first shown.worker-cfcells there are the first run on that version.--varoverride against the config'soff), but I did not probe a tokenless mutation. The existing CSRF contract tests cover the refusal.Review pointers
--skip version_metadatainscripts/stage2-contract.shis deliberate (see above).wrangler.memory.tomlgets the binding too, so the smoke can be tried against a Docker-free local Worker.version.proptest-regressionsproduced by my mutants was deleted rather than committed: those seeds are counterexamples to broken code, not findings.Refs: #49
🤖 Generated with Claude Code