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.
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.
Merge policy
Flag data-loss, auth, licence, delivery, or review diffs before merge.
Merge queue
Verify the record, take the queue lease, rebase onto staging, recheck if changed, and fast-forward.
Release gate
Run staging-wide checks, bisect failures, and require human sign-off for main.
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:
- Verify and acquire lease: Checks
Home.Verifyfor the request, then takes thehome:merge-queuelease and waits for it (LockWait); a dead holder's lease expires on its own. - Rebase in scratch worktree: Checks out the lane commit inside
<home>/merge-scratch/(disposable) and rebases ontostaging. - Recheck if tree changed: Compares rebased
res.Treeagainst the verified tree (checked). If different,RecheckrerunsInstallandqc.Runwithout mutation testing. - Compare-and-swap update: Advances
stagingviagit update-ref refs/heads/<staging> <new> <old>(orgit merge --ff-onlyif checked out) and recordsEvMerged.
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:
| Rule | Trigger or scope | Approver and autonomy behavior |
|---|---|---|
data-loss | migrations/** lines dropping/renaming tables or columns, or deleting rows | Acceptor (who confirmed the request) approves, even under turbo |
auth | Paths matching AuthGlobs or "auth" risk tag | Operator/approver under review, default, auto (unless policy is "auto"); waived in turbo |
licence | New package.json packages with licenses outside Allow (DefaultLicences) | Operator/approver when MatchesWait is active; waived in turbo |
delivery | Edits to delivery, watch, or credentials in .t12/config.json | Operator/approver when MatchesWait is active; waived in turbo |
review | Synthetic 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
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 PlayRelease 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:
| Stage | Functions | Behavior |
|---|---|---|
| Staging checks | releaseChecks | After 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 & fix | Bisect, fixRelease | Locates 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 gate | release.Gate, GateFor | Requires 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 request | ClosingIssues, RenderPRBody | The 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 promotion | t12 release merge | Checks 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.
| Record | Storage | Old path (import format only) |
|---|---|---|
| Sign-offs and holds | log_entries streams release:<project>:signoffs and release:<project>:holds, appended by Ledger.SignOff and Ledger.Hold | release/<project>/signoffs.jsonl, holds.jsonl |
| Release checks | documents kind release-checks, key <project>/<tree> | release/<project>/checks/<tree>.json |
| Kept artifact | documents kind artifact, key <project>/<tree>; the built dist/ is a host-local cache | artifacts/<project>/<tree>/ |
| Promotions | log_entries stream promotions:<project>; a real deploy's row carries the live url | artifacts/<project>/promotions.jsonl |
| SRE fingerprints | documents kind sre-fingerprints, key <project> | sre/<project>/fingerprints.json |
devops.Promote refuses a tree whose built files are not on this host (promote.no-build; promote.no-account when no hosting account is connected): run the staging dry-run for that tree here, then promote again. t12 release merge rebuilds the tree itself first when a real deploy is about to upload it.
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 withSHA-256[:16]so duplicate errors collapse to one ID. - Thresholds: Marks endpoints down after
DownAfter(3) failures, logs responses overSlowAfter(2s) asshould-fix, and flags gaps wider than2 * everyasUnwatched. - Triage & rollback (
t12 sre triage): With--rollback, first callsdevops.RollBackthrough the connected hosting account's deployer, inside the24hRollBackWindow. It then classifies the failing window asProjectDefect(files"Incident found by SRE: ..."viacmdAsk),PlatformOutage(printed for the Operators, no retry token spent), ornoise(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
Sandbox and harnesses
How Landlock, Docker cages, Request Review command approvals through a spool bridge, read-only guards, per-person run credentials, the container database broker, and Context7 socket forwarding isolate execution.
UI and access
How t12-ui serves an embedded React SPA and live SSE flow graphs, enforces CSP/CSRF, keeps accounts, teams, per-user connections and Observer state in Postgres, and delegates git and pipeline writes to t12.