Skip to content

feat(deploy): report the Worker's version and add the deploy smoke - #153

Merged
aRustyDev merged 2 commits into
mainfrom
feat/deploy-smoke-and-version
Nov 14, 2026
Merged

aRustyDev merged 2 commits into
mainfrom
feat/deploy-smoke-and-version

Conversation

@aRustyDev

@aRustyDev aRustyDev commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

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 /healthz body: health_ok pins the body ok and the native server shares the handler. version_label and set_version live in thrust-api, beside set_db_round_trips, so a hermetic suite can run them.
  • scripts/smoke-deploy.sh <base-url> <expected-version>. Three consecutive /healthz answers 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) unless SMOKE_AUTH=off says 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.sh skips the new bindings test (its config has no version binding); contract.sh expects 5 bindings tests instead of 4.

Evidence

What Result
cargo nextest run -p thrust-api 61 pass: a 36-case matrix over tag x id classes against a table the test owns, 22 header cases, 1 pinned case, 2 prop_ tests
Mutation cargo-mutants on the new functions: 5 of 5 caught. By hand, three more (swap tag and id, drop the trim, drop the visible-ASCII filter): caught by 18, 13 and 30 tests
test-smoke-deploy.sh (28 cases, in the ci-scripts job) passes on macOS and under real dash on ubuntu:24.04. Breaking the version compare fails 3 cases, putting the password in a header fails the argv case
scripts/contract.sh worker-cf bindings (local wrangler 4.123.0) 5 passed, the count guard held
Real local Worker (memory adapters), the actual scripts bootstrap made the account, workspace and project, and a second run changed nothing. Smoke passed. Four controls failed as they must: wrong version, wrong password, missing project, SMOKE_FORCE_FAIL=1. Run with CSRF at the Worker's default (off) and with it on
Control: a Worker with no [version_metadata] sends no header, and the real smoke exits 1 with "has no x-thrust-version header"
fmt, clippy (native, every target; wasm32 Worker), check-deps.sh, check-topology.sh, check-placement.sh clean

Measured, 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 --tag looks 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 equals THRUST_EXPECT_VERSION when that is set.

Not verified

  • Nothing here has run against a deployed Worker. That wrangler deploy --tag sets 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.
  • The cell ran locally on wrangler 4.123.0. CI pins 4.151.2, so the worker-cf cells there are the first run on that version.
  • In the CSRF-on run the Worker was configured differently (the logs show a --var override against the config's off), but I did not probe a tokenless mutation. The existing CSRF contract tests cover the refusal.
  • cargo-mutants only generates function-level mutants here, hence the three by hand.

Review pointers

  • The --skip version_metadata in scripts/stage2-contract.sh is deliberate (see above).
  • wrangler.memory.toml gets the binding too, so the smoke can be tried against a Docker-free local Worker.
  • A version.proptest-regressions produced by my mutants was deleted rather than committed: those seeds are counterexamples to broken code, not findings.

Refs: #49

🤖 Generated with Claude Code

aRustyDev and others added 2 commits November 13, 2026 18:35
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]>
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