Skip to Content
turbo-12f
Architecture

Release and SRE

How lanes enter staging through the lease-serialized merge queue, clear merge policies and proof bisection, record sign-offs and promotions in Postgres, and stay monitored after promotion.

Explanation

Merging feature work into staging, validating the combined tree, promoting to main, and watching live traffic all run through deterministic leases, patch-bound approvals, and bounded triage loops. The release ledger, checks, artifacts, and promotions are database streams and documents, not files in the state home. Both flows share all of it: in the team flow DevOps owns each lane's merge-policy, merge and deploy-dry-run steps, and the release checks are identical in classic.

Step 1

Merge policy

Flag data-loss, auth, licence, delivery, or review diffs before merge.

Step 2

Merge queue

Verify the record, take the queue lease, rebase onto staging, recheck if changed, and fast-forward.

Step 3

Release gate

Run staging-wide checks, bisect failures, and require human sign-off for main.

Step 4

SRE watch & triage

Probe live URLs, group errors by fingerprint, file incidents, or roll back.

Serialized merge queue

mergequeue.go guarantees that lanes update staging strictly one at a time without overwriting concurrent work:

  1. Verify and acquire lease: Checks Home.Verify for the request, then takes the home:merge-queue lease and waits for it (LockWait); a dead holder's lease expires on its own.
  2. Rebase in scratch worktree: Checks out the lane commit inside <home>/merge-scratch/ (disposable) and rebases onto staging.
  3. Recheck if tree changed: Compares rebased res.Tree against the verified tree (checked). If different, Recheck reruns Install and qc.Run without mutation testing.
  4. Compare-and-swap update: Advances staging via git update-ref refs/heads/<staging> <new> <old> (or git merge --ff-only if checked out) and records EvMerged.

Merge policy and patch-bound approvals

Before entering the merge queue, merge-policy (mergepolicy.go), the lane step before merge in both flows, evaluates four diff rules plus the synthetic review check:

RuleTrigger or scopeApprover and autonomy behavior
data-lossmigrations/** lines dropping/renaming tables or columns, or deleting rowsAcceptor (who confirmed the request) approves, even under turbo
authPaths matching AuthGlobs or "auth" risk tagOperator/approver under review, default, auto (unless policy is "auto"); waived in turbo
licenceNew package.json packages with licenses outside Allow (DefaultLicences)Operator/approver when MatchesWait is active; waived in turbo
deliveryEdits to delivery, watch, or credentials in .t12/config.jsonOperator/approver when MatchesWait is active; waived in turbo
reviewSynthetic check on every lane when resolved autonomy is "review" (PartsWait)Acceptor approval via t12 approve (waits even when policy mode is "auto")

Approvals are bound to git patch-id

Every approval written by t12 approve binds to git patch-id --stable. If Engineer or Merge later alters the patch content, the prior approval lapses automatically and requires fresh review.

From staging to main and SRE watch

Flow
100%
maindefectconflictdrift1. Merge queuelease · overlap wait2. Dry-run deployartifact per tree3. Release gatechecks by tree hash4. Bug bashacceptor or Observer5. Release mergeno-ff into main6. Promotedeploy · 3x retry7. SRE watchprobes · 2s budget8. SRE triageread-only agentRollback once24h cooldownDefect askspends 1 tokenText conflict returnsback to Engineer fix attemptStaging moved guardrefused with zero auto-retry

Lanes serialize into staging, release checks bind to a tree hash before human sign-off, and post-merge SRE probes watch production.

Click any node or press Play

Release checks, bisection, and the release gate

Once all active lanes merge onto staging, the request-level release lane runs stepRelease in run_release.go and reads the gate in gatefor.go:

StageFunctionsBehavior
Staging checksreleaseChecksAfter a dependency install, runs qc (full E2E and the build), uicheck, redteam, deploy-dry-run (only when no kept artifact has built files on this host), and optional qc.explorer against staging^{tree}, saving a release-checks document keyed <project>/<tree> through Ledger.SaveChecks. A passing result is reused for the tree; a failed one is reused only by the same factory build (Checks.Factory), so a newer build re-runs it.
Bisect & fixBisect, fixReleaseLocates the culprit merge between main and staging on failure, adds <culprit>-rf<N> via release.AddFixLane, and re-runs the factory up to 3 extra passes (pass < 3 in factory.go).
Four-part gaterelease.Gate, GateForRequires passing staging^{tree} checks, surfacing CheckCoverage noop-true/skipped warnings, carried sign-offs from the ledger, no holds, zero lapsed sign-offs, and zero Sev-1/Sev-2 bugs.
Release pull requestClosingIssues, RenderPRBodyThe body carries the gate, the checks, the plain and detailed reports, and one Closes #n line for every plan, feature, lane, and need-decision issue named in the records of the release's conversations, so GitHub closes them when the pull request merges.
Main promotiont12 release mergeChecks staging^{tree} stability, merges --no-ff to main, pushes main to GitHub with networked git when the project is bound to a repository, then runs RecordOutcomesFor and devops.Promote with the deployer for the connected hosting account (devops.AccountFromEnv), appends a promotion row, and appends EvDelivered.

With no Cloudflare or Vercel account connected, the deployer is DryRunOnly{} and devops.Promote refuses production (promote.no-account, NoAccountAdvice): the merge to main still lands and each request is delivered, but nothing goes live. With an account, Promote deploys to the person's Cloudflare account (preferred) or, for a static project, Vercel, rebuilds the tree's files first when a worker job starts without them (ensureBuilt), checks that the new address answers, rolls back to the previous promoted tree if it does not (a failure when none exists), and records the live url on the promotion row. A project that needs its Worker and has only Vercel connected is refused before anything uploads (promote.unservable). After a release delivers, the cloud worker closes any of those issues GitHub did not and labels them status:done.

SRE watch, triage, and rollback

Post-release checks run through sre (sre.go, triage.go, cli/sre.go) via t12-adapter sre probe --url. The watch and triage commands (t12 sre) are the same in both flows; only the classic flow also ends each lane with an sre step.

  • Fingerprints (Fingerprint): Normalizes hex strings (<hex>), ports (:<port>), and integers (<n>) before hashing with SHA-256[:16] so duplicate errors collapse to one ID.
  • Thresholds: Marks endpoints down after DownAfter (3) failures, logs responses over SlowAfter (2s) as should-fix, and flags gaps wider than 2 * every as Unwatched.
  • Triage & rollback (t12 sre triage): With --rollback, first calls devops.RollBack through the connected hosting account's deployer, inside the 24h RollBackWindow. It then classifies the failing window as ProjectDefect (files "Incident found by SRE: ..." via cmdAsk), PlatformOutage (printed for the Operators, no retry token spent), or noise (closed).

Key takeaway

No change reaches main unverified: every lane rebases through a single merge lease, approvals bind to exact patch IDs, and failing staging trees bisect automatically before a human merges.

Next steps

On this page