Skip to main content

max / makenotwork

2.2 KB · 37 lines History Blame Raw
1 -- Release artifact identity: make build_runs.id the identity object and demote
2 -- `version` to a label. Design: wiki [[release-artifact-identity]] (decided
3 -- 2026-07-21). The defect it closes: `version` (a semver read from Cargo.toml)
4 -- was simultaneously the artifact identity, the gate-evidence key, the
5 -- deployed-state key, and the staging directory name. Versions bump at release,
6 -- not per commit, so dev rebuilds overwrote releases/<version>/ in place while
7 -- the gate rows and burn-in clock from an earlier build stayed green — promote
8 -- shipped a binary that never passed the gates it was credited with.
9 --
10 -- build_runs (migration 007) is already one row per /rebuild and carries `sha`.
11 -- It is the right identity object. Everything below is ADDITIVE and nullable:
12 -- legacy rows keep NULL and are treated as "pre-identity". One fresh
13 -- build-and-promote cycle re-anchors each tier. An honest NULL beats a
14 -- fabricated backfill for live prod state.
15
16 -- Identity lives on the build row.
17 -- bundle_digest: sha256 of the bundle MANIFEST, full 64 hex. Answers "what
18 -- bytes" — identity. Distinct from `sha` (provenance: "what source"), which
19 -- already exists on build_runs. Cargo builds are not bit-reproducible, so a
20 -- digest match across hosts is a strictly stronger claim than a sha match.
21 -- staged_path: releases/<digest16> — the content-addressed dir the bundle was
22 -- renamed into. Replaces versions.artifact_path as the source of truth.
23 ALTER TABLE build_runs ADD COLUMN bundle_digest TEXT;
24 ALTER TABLE build_runs ADD COLUMN staged_path TEXT;
25
26 -- The evidence binds to the build it vouched for, not to a version string.
27 ALTER TABLE gate_runs ADD COLUMN build_id INTEGER REFERENCES build_runs(id);
28 ALTER TABLE deploys ADD COLUMN build_id INTEGER REFERENCES build_runs(id);
29
30 -- Deployed state points at build rows. previous_build_id keeps exactly one step
31 -- of rollback history, mirroring the existing (current|previous)_version pair.
32 ALTER TABLE tier_state ADD COLUMN current_build_id INTEGER REFERENCES build_runs(id);
33 ALTER TABLE tier_state ADD COLUMN previous_build_id INTEGER REFERENCES build_runs(id);
34
35 CREATE INDEX gate_runs_by_build ON gate_runs(build_id, gate_kind);
36 CREATE INDEX deploys_by_build ON deploys(build_id);
37