Release and SRE
How lanes enter staging through the serialized merge queue, clear merge policies and proof bisection, 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 locks, patch-bound approvals, and bounded triage loops.
Merge policy
Flag data-loss, auth, licence, delivery, or review diffs before merge.
Merge queue
Acquire queue lock, 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:
- Acquire lock: Takes an exclusive
flockonmerge-queue.lock(LockWait). - Rebase in scratch worktree: Checks out the lane commit inside
merge-scratch/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) 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 approval required, 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 in factory.go and gatefor.go:
| Stage | Functions | Behavior |
|---|---|---|
| Staging checks | releaseChecks | Runs qc, uicheck, redteam, deploy-dry-run, and optional qc.explorer against staging^{tree}, writing release/<project>/checks/<tree>.json. |
| Bisect & fix | Bisect, fixRelease | Locates the culprit merge between main and staging on failure, adds <culprit>-rf<N> via release.AddFixLane, and retries pass < 3. |
| Four-part gate | release.Gate, GateFor | Requires passing staging^{tree} checks, surfacing CheckCoverage noop-true/skipped warnings, carried signoffs.jsonl, no holds.jsonl, zero lapsed sign-offs, and zero Sev-1/Sev-2 bugs. |
| Main promotion | t12 release merge | Checks staging^{tree} stability, merges --no-ff to main, runs RecordOutcomesFor and devops.Promote (DryRunOnly{}, H10), and appends EvDelivered. |
SRE watch, triage, and rollback
Post-release checks run through sre (sre.go, triage.go, cli/sre.go) via t12-adapter sre probe --url:
- 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): Classifies failing windows intoProjectDefect(files"Incident found by SRE: ..."viacmdAsk),PlatformOutage(alerts Operators at zero retry tokens), ornoise.--rollbackcallsdevops.RollBackinside the24hRollBackWindow.
Key takeaway
No change reaches main unverified: every lane rebases through a single merge lock, 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, read-only guards, prompt budgets, 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, manages mode/approvals/Observer, and delegates git and pipeline writes to t12.