Repository navigation
Description
Context
Nothing deploys today. docs/src/architecture/cicd.md:80 reads "Any deploy. There is no workflow for it.", and :96-97 says nothing implements ADR-0110. The repository's workflows are ci.yml, contract-cell.yml and flake-hunt.yml. ADR-0110 (accepted in round 24) prescribes this sequence:
- expand migration;
- upload at 0 %;
- smoke and an oracle subset through the version-override header;
- 10 % for 10 minutes;
- 100 %, with absolute-count gates and an automatic
wrangler rollback(adrs/cd/0110-deploy-pipeline.md:38,:79; Q-0110.1,QUESTIONS.md:234).
The only script that tests a deployed Worker is scripts/stage2-contract.sh, which needs the test routes and the admin token (:36-39). Migrations are the migrate binary (docs/src/architecture/infra.md:128-129). Today the only way into the CNPG clusters is kubectl exec on the primary (research/0010 §2, lines 107-112).
Problem
- FR-12: traffic is about 5 M requests a month (
research/0004§9, line 317), so 10 % for 10 minutes is roughly 100 requests, most of them the owner's. The ADR itself says percentage slices are meaningless at ≤50 users (0110-deploy-pipeline.md:79). The 10 % stage observes nothing the smoke suite does not, and the version-override plumbing costs build and maintenance. - Two constraints remain. A rollback does not revert connected resources, so migrations stay expand/contract (
:15-17,:25). A deploy cannot be rolled back across a Durable Object lifecycle change (:18-19). - A third comes from ADR-0011 (round 26). The SPA fallback answers a missing hashed asset with
200 text/html, so deploys must keep old hashes until clients age out (adrs/ui/0011-static-asset-hosting.md:76). A 100 % deploy drops the previous version's assets.
Proposal
Add .github/workflows/deploy.yml, triggered on push to main and by hand for each environment (dev, staging and prod, per Q-0092.2), with credentials per ADR-0101.
- Expand migration. Q-0110.2 says CI runs it, but nothing gives CI a route to
thrust-pgtoday, so this issue chooses one: a runner with cluster access, or a tunnel route with an Access service token. If spike(db): run spike 0002 with aworker-pgcell and an instance-levelworker-doSQLite cell #37 picks the Durable Object cell, this step becomes the object's own migration. - Deploy. Record the current version id, then
wrangler deployat 100 %. - Smoke. Run a new pass against the live hostname that needs no test routes:
/healthzfirst; then, once feat(compat): the 48-route minimum slice with the auth-client JSON change #44 exists, sign in with a dedicated smoke account and read a seeded project. Vacuity guard:/healthzreports the deployed version id (from the version metadata binding, or a var set at deploy), and the smoke checks it equals the new one. - Roll back. If the smoke fails, run
wrangler rollback <previous id>and fail the job. If the release adds a[[migrations]]tag, skip the automatic rollback and require manual approval (the DO-lifecycle rule). - Assets. Once feat(compat): the 48-route minimum slice with the auth-client JSON change #44 adds static assets, include the previous release's hashed files in each upload, or answer 404 for a missing
/assets/*file.
Acceptance criteria
-
deploy.ymlexists and runs the steps in order on push tomain. - Control: on staging, a release with a smoke check that fails on purpose ends with the previous version active again (
wrangler deployments list) and the job red. - Control: the smoke pass fails when pointed at a Worker that still serves the previous version id.
- A release that adds a DO migration stops for approval and does not roll back automatically.
- After a deploy, an asset URL from the previous release still returns its JavaScript, not HTML.
-
docs/src/architecture/cicd.mddescribes the pipeline, and ADR-0110 (round-29 note) and Q-0110.1 match it.
References
- Review: .agents/plans/contrail/reviews/2026-10-19-fable-architecture-review.md (FR-12)
- ADR-0110 (
:13-20,:25,:38,:79; round-29 note), ADR-0101, ADR-0011 (:76), ADR-0090, ADR-0093, ADR-0130 - Q-0110.1, Q-0110.2, Q-0092.2
docs/src/architecture/cicd.md:73-80,:94-97;docs/src/architecture/infra.md:128-129;scripts/stage2-contract.sh:36-39research/0004-rust-on-workers-binding-matrix.md§9 (traffic model);research/0010-thrust-postgres-infra-plan.md§2 (database access path)
Blocked by: #43
Finding: FR-12
Activity
entry.mjs, the DO rate limiter and theSELFbinding #43feat(deploy): report the Worker's version and add the deploy smoke (#153
feat(migrate): verified TLS for migrate, and the deploy's expand step…
feat(deploy): the deploy pipeline, with its own rollback, manual gate…
docs(deploy): drop the retired create-limit namespace from the runbook
feat(deploy): keep the previous release's web files, and write the de…
aRustyDev commentedon Nov 15, 2026
Infra side of the staging pipeline, after the live runs of
ApiraTech/infrastructure#1015 to #1017 (2026-11-14). #49 stays open: its criteria need a real staging deploy and the rollback drill, which have not happened.What exists now
stagingand schemastagingonthrust-pg-dev,pg_trgminpublic.migrate(built from77ec027) ran twice asstagingoververify-ca:migrated (tls: verify-ca)both timesthrust-pg-stage-ci.sow.foo, to the dev database only.scripts/migrate-ci.shran twice from a laptop:migrated (tls: verify-ca)both times. Refused, each checked: no token, an unlisted token, plaintext, a wrong CAthrust-staging, the R2 bucket and the queue with its dead-letter queue exist. A throwaway Worker bound to the config connected asstagingover TLS 1.3,search_pathheld, andCREATE TABLEinpublicwas refused (Worker deleted afterwards). The Worker, its hostname and/healthzwait for the first deployThe queue has no consumer yet;
wrangler deployattaches it.Not tried: the Postgres session through
cloudflared access tcpfrom a GitHub-hosted runner (only a laptop so far). Ifmigrate-ci.shfails there, send infra the log.What this repo's
stagingenvironment holds now (read through the API, names only). The environment exists (created 2026-11-14 06:32Z) with 0 variables, 0 secrets and no reviewers.staging-do-lifecycleexists with no required reviewers: theplanjob runsassert-gated-environments.shfor it and fails closed (NOT GATED), so no staging deploy will start until it has one.THRUST_DEPLOY_ENABLEDis not set, so a push to main stays quiet, as designed.Values for the variables. None is a secret.
deploy.ymlsaysstaging-do-lifecycleneeds the same variables and secrets asstaging.DB_ACCESS_HOSTNAMEthrust-pg-stage-ci.sow.fooTHRUST_WORKER_NAMEthrust-stagingTHRUST_BASE_URLhttps://thrust-staging.sow.fooTHRUST_HYPERDRIVE_ID1c873d803aed4b21bf8a887ead727d9dTHRUST_R2_BUCKETthrust-staging-blobsTHRUST_QUEUE/THRUST_QUEUE_DLQthrust-staging-events/thrust-staging-events-dlqTHRUST_RL_SIGNIN_ID/THRUST_RL_V1_ID92002/92003CLOUDFLARE_ACCOUNT_ID,THRUST_CSRF_ENFORCE,SMOKE_EMAIL,SMOKE_WORKSPACEInfra also reserved
92001for the create limiter, which #166 deleted. It is unused.Secrets
TUNNEL_SERVICE_TOKEN_IDandTUNNEL_SERVICE_TOKEN_SECRET: theclient_idandclient_secretof the Access service tokenthrust-ci-migrate, in AWS Secrets Manager at/thrust/ci-access-service-token. It expires 2027-11-14. Rotation iscreate-ci-service-token.sh --rotate(infra runbook, "CI route tothrust-pg-dev") and only this GitHub secret changes.DATABASE_URL: rolestaging, password in/thrust/pg-dev-staging-password, databasethrust, host and port the tunnel's local end (migrate-ci.shrefuses anything else).CLOUDFLARE_API_TOKENandSMOKE_PASSWORD: the owner's. Infra creates neither.Order, and what infra needs from the first deploy
stagingand onstaging-do-lifecycle.deploydefers it todeploy-dobehind the reviewers.first_deploy_skip_smokeexists because the hostname is not attached until step 4.crates/thrust-worker/wrangler.deploy.tomlhas noroutesorcustom_domainentry, and it must stay that way: infra'scloudflare_workers_custom_domainowns the hostname, and two owners of it would collide.attach_staging_domain=true, one resource to add) and checksGET https://thrust-staging.sow.foo/healthzreturnsokwithx-thrust-versionequal to the deployed commit. That closes #1017.feat(release): a git-cliff changelog and the rc/* release-candidate b…
refactor(release): run the release flow with release-plz, not a hand-…
feat(deploy): deploy staging from the rc/* release candidate, product…
feat(release): build, attest and publish the release at its tag, and …
aRustyDev commentedon Nov 15, 2026
The infra side is done (2026-11-15). This follows my earlier comment above. #49 stays open: two of its criteria were not exercised, and one needs rewording (see the table).
In place
ApiraTech/infrastructure#1015, #1016 and #1017 are all closed, each with its evidence.https://thrust-staging.sow.foo:/healthzanswers 200ok, andx-thrust-versionisa767aadfe83ec7441831c6171e50776bbdaa6211, the commit that was deployed.stagingandstaging-do-lifecycleeach hold 13 variables and 5 secrets. Onlystaging-do-lifecyclehas a required reviewer (stagingis unattended by design). Both take onlyrc/*.productionandproduction-do-lifecyclehave a reviewer and thev*rule but no variables or secrets yet (the production infra issue is held).scripts/smoke-bootstrap.sh) and the real smoke passes against the live Worker.THRUST_DEPLOY_ENABLEDis unset, so nothing deploys by itself. The open release candidate is chore(release): v0.1.0 #187.The runs
deploy-dofailed atassets-upload-session(the token held only Workers read permissions). Second attempt: created the Worker (9b0550ae), no smokerc/manual-*branch: deferred to the manual gate, approved, deployeda767aadf, smoke and its control passedTHRUST_HYPERDRIVE_ID: failed at the version upload (Cloudflare code 10157), the previous version untouched#49's checklist against those runs (not ticked: that is for you to decide)
deploy.ymlruns the steps in order on push tomainno expand migration), deploy at 100 %, smoke, control. The trigger is no longermain: since #185 and #186 staging deploys fromrc/*and production fromv*, so this wording is staleinject_smoke_failurefrom therc/*branch just deployed[[migrations]] v1):deploydeferred,deploy-dowaited for the reviewer,automatic rollback: false. A later[[migrations]]change has not been exercisedretained=0). It needs two real releasescicd.md, ADR-0110 and Q-0110.1 match the pipelinedeploy.mdis fixed in #189. I did not checkcicd.md, the ADR or the questionWorth knowing
mainalways goes through the manual gate, because the previous release's bundle is only accepted from a run onrc/*orv*. That is why run 43758233044 needed an approval.deployjob's token and thedeploy-dojob's token are different tokens (the latter is Workers Admin). Both are in the docs now.Open follow-ups
deploy.mdbrought in line with these runs (draft).ApiraTech/infrastructure#1024:attach_staging_domaindefaults totrue, so a plain plan keeps the attached domain (draft). #1023, the permission names, is merged.ApiraTech/infrastructure#1025: tracks renewing the CI service token before it expires on 2027-11-14, and the expiring-token alert.docs(deploy): the Cloudflare token is two tokens, and the first stagi…
fix(release): start release.yml on the release tag, since a draft rel…
perf(ci): run only the jobs and contract cells a change affects (#192)
ci: pass --locked to the cargo commands of hermetic and pg-adapter (#202
ci: pin the Rust toolchain in rust-toolchain.toml, with Dependabot to…
ci: lint every workflow and action, each with the credentials it is a…
docs(deploy): record the rollback drill and what the staging runs set…
ci: build the book in a `docs` job, failing on the errors mdbook buil…
ci(flake-hunt): offer every pass of the contract matrix (#216)
fix(deploy): compare the live commit by content, so a rewritten relea…