feat(521): reconcile #390/#406 + #411 + append-only supersession; seed exemplars [decisions-edit]

Migrate #406 (ci.runner-placement) and #412 (ci.peak-anon-measurement) to the lifecycle
schema as exemplars; #390 and #411 confirmed prose-only (no standalone record). Dogfood the
append-only->lifecycle supersession: docs.append-only-guard moved to archive/, superseded by
new active docs.decision-lifecycle. Stand up docs/decisions/archive/ + migration-map.md.

Refs #521

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-21 03:00:15 +02:00
co-authored by Claude Opus 4.8
parent 458ab2111f
commit eada44deb1
6 changed files with 173 additions and 27 deletions
+58
View File
@@ -104,6 +104,7 @@ in-file entries.
- [2026-07-19 — CI `test` job reports a sampled true peak-anon, not cache-inflated `memory.peak` (#412)](#2026-07-19--ci-test-job-reports-a-sampled-true-peak-anon-not-cache-inflated-memorypeak-412)
- [2026-07-20 — External-URL channel logos pass through to the graphics engine; never `File.Exists`-gated, never ffmpeg-native (#502)](#2026-07-20--external-url-channel-logos-pass-through-to-the-graphics-engine-never-fileexists-gated-never-ffmpeg-native-502)
- [2026-07-20 — Remote graphics-engine images are fetched through a bounded, pooled `IRemoteImageFetcher`; re-fetched per element init, not cached (#511)](#2026-07-20--remote-graphics-engine-images-are-fetched-through-a-bounded-pooled-iremoteimagefetcher-re-fetched-per-element-init-not-cached-511)
- [2026-07-21 — Decision records carry a lifecycle schema, validated by a script; append-only-by-diff is retired (#521)](#2026-07-21--decision-records-carry-a-lifecycle-schema-validated-by-a-script-append-only-by-diff-is-retired-521)
---
@@ -1248,6 +1249,10 @@ weights) and SPA child #386 remain open under the #383 milestone.
---
## 2026-07-17 — No persistent compiler servers in CI; every `services:` container gets an explicit cap; #390's small-lane move reversed (#406)
`key: ci.runner-placement` · `status: active` · `since: 2026-07-17` · `supersedes: none` · `superseded-by: none`
**Rule:** No persistent Roslyn compiler server survives a CI build (`UseSharedCompilation=false` etc., runner env + Dockerfile `ENV`); every `services:` container gets its own explicit `--memory`/`--memory-swap`/`--cpus` cap (it does not inherit the job container's).
**Signals:** CI memory/swap thrash · paths: `.gitea/workflows/*.yml`, `docker/Dockerfile` · issues: #406, #390 (prose-reversed, no standalone record), server-management#604, server-management#570
**Mechanics:** `docs/ci-cd.md` → CI build memory; `scripts/ci-peak-anon.sh`
Three CI changes, all downstream of one incident: on 2026-07-17 bumblebee (the **prod media** Docker
host, 25 GiB / 12 cores) hit load **340** with **21 GiB swapped** and ~238 MiB free, taking prod
@@ -2059,6 +2064,10 @@ The blocking `format` CI job (and the matching Husky pre-commit hook) verify cha
server-management capacity call — deliberately out of scope here.
## 2026-07-19 — CI `test` job reports a sampled true peak-anon, not cache-inflated `memory.peak` (#412)
`key: ci.peak-anon-measurement` · `status: active` · `since: 2026-07-19` · `supersedes: none` · `superseded-by: none`
**Rule:** The `test` job's headline memory figure is a sampled high-water mark of cgroup `anon`, produced by `scripts/ci-peak-anon.sh`; `memory.peak` and the end-of-job `anon`/`file` split are kept only as a cache-inflated reference.
**Signals:** CI memory measurement · paths: `scripts/ci-peak-anon.sh`, `.gitea/workflows/*.yml` · issues: #412, #411 (prose-only predecessor, no standalone record — its `memory.peak`-headline approach is superseded by this record)
**Mechanics:** `scripts/ci-peak-anon.sh` header; `docs/ci-cd.md` → CI build memory
**Decision.** The `test` job's memory instrument (added in #411) now reports a **sampled high-water
mark of the cgroup's `anon` memory** as the headline figure, produced by `scripts/ci-peak-anon.sh`
@@ -2727,3 +2736,52 @@ inert**: the elements' pre-existing blanket `catch (Exception)` swallows both on
shutdown mid-tune logs a spurious per-element warning. The filter is kept because it makes the
fetcher correct on its own terms and the log message names the real cause; making the elements
re-throw cancellation is a separate, pre-existing concern.
## 2026-07-21 — Decision records carry a lifecycle schema, validated by a script; append-only-by-diff is retired (#521)
`key: docs.decision-lifecycle` · `status: active` · `since: 2026-07-21` · `supersedes: docs.append-only-guard@2026-07-12` · `superseded-by: none`
**Rule:** every decision `##` record (active or archived) carries a 5-field metadata block (`key`, `status`, `since`, `supersedes`, `superseded-by`) checked by `scripts/decisions_validate.py`; a record is never deleted or line-edited to reverse a call — it is moved to `docs/decisions/archive/` with `status: superseded`/`retired` and a reciprocal `superseded-by`/`supersedes` key pair to its replacement.
**Signals:** decision lifecycle, supersession, archive · paths: `scripts/decisions_lib.py`, `scripts/decisions_validate.py`, `scripts/build_decisions_catalog.py`, `docs/decisions/archive/` · issues: #520, #521
**Mechanics:** `scripts/decisions_validate.py` (`PYTHONPATH=. python3 scripts/decisions_validate.py`); catalog regen `scripts/build_decisions_catalog.py`; `docs/decisions/migration-map.md`
**This replaces `docs.append-only-guard` (ersatztv#303 H9), not just extends it.** The old guard treated
`docs/decisions.md` as a single append-only text file: any line-delete was blocked by a Husky
`commit-msg` hook + CI job, and a "supersession" was a hand-written `> **Superseded …**` banner
prepended to the old entry plus an `(superseded)` Index tag — prose conventions an agent had to
remember and apply correctly by hand, with no machine check that the banner, the tag, and the new
entry's back-reference actually agreed with each other. That is exactly the failure mode this arc
(#520/#521) set out to fix: state should be derived and checked, not asserted in prose (the same
throughline as #303 H6's `## Done-when`).
**The new model.** Every decision record — whether still in force or not — gets a `key` (dotted,
stable identity independent of its heading text or which file it lives in), a `status`
(`active`/`superseded`/`retired`/`legacy-unmigrated` for anything not yet carrying the schema), a
`since` date, and a reciprocal `supersedes`/`superseded-by` pair of keys. `scripts/decisions_lib.py`
parses the schema; `scripts/decisions_validate.py` enforces: at most one `active` record per key;
`superseded`/`retired` records MUST live under `docs/decisions/archive/`, never in an active file;
an `active` record MUST NOT live under `archive/`; every `supersedes`/`superseded-by` key must
resolve to a record that actually exists (active or archived); and — replacing the append-only
guard's line-delete detection — a record's rationale prose (the schema strips only the contiguous
metadata block before comparing) must not change between a PR's base and head unless the commit
carries `[decisions-edit]`, and a record that disappears from the active set without a matching
archive copy is flagged as an unlogged removal. `scripts/build_decisions_catalog.py` regenerates
`docs/decisions/README.md`, a compact router listing only `active` records by key, so an agent
doesn't have to read the full chronological log (or the archive) to find the current rule.
**Why this is a strictly better enforcement of the same spirit, not a loosening.** The old guard's
actual invariant was never "no line may change" — it was "history is never silently rewritten to
erase *why we changed our mind*." A hand-prepended banner satisfied that invariant by convention; a
validator that checks reciprocal keys, archive placement, and rationale-prose stability satisfies it
by construction, and additionally catches classes of mistake the old guard could not (a supersession
banner added without moving the entry out of the active read-path; a `superseded-by` reference to a
key that doesn't exist; two `active` records quietly claiming the same key after a copy-paste).
`[decisions-edit]` is kept, narrowed to its one remaining legitimate use — an actual rationale-prose
edit (fixing a factual error) — since routine lifecycle moves (a status flip, an archive relocation)
are now token-free and machine-checked instead.
**This PR is the first to exercise the new regime, on itself.** `docs.append-only-guard` (the H9 half
of #303's combined H9/H3 entry; H3's root-screenshot guard is untouched and stays active) is marked
`status: superseded` and relocated to `docs/decisions/archive/release-ci-governance.md`, with this
record as its `superseded-by` and this record's `supersedes` pointing back — the same-PR supersession
pattern the new rule itself mandates for every future reversal. `docs/decisions/migration-map.md`
tracks the legacy-heading → key → status → location mapping as the rest of the log migrates
(ersatztv#520/#521, ongoing — most existing headings remain `legacy-unmigrated` until touched).
+3
View File
@@ -8,3 +8,6 @@ the link for rationale. Superseded/retired history lives in `archive/`. Regenera
| Key | Current rule | Since | Record |
| --- | --- | --- | --- |
| `ci.peak-anon-measurement` | The `test` job's headline memory figure is a sampled high-water mark of cgroup `anon`, produced by `scripts/ci-peak-anon.sh`; `memory.peak` and the end-of-job `anon`/`file` split are kept only as a cache-inflated reference. | 2026-07-19 | [link](../decisions.md#2026-07-19-ci-test-job-reports-a-sampled-true-peak-anon-not-cache-inflated-memorypeak-412) |
| `ci.runner-placement` | No persistent Roslyn compiler server survives a CI build (`UseSharedCompilation=false` etc., runner env + Dockerfile `ENV`); every `services:` container gets its own explicit `--memory`/`--memory-swap`/`--cpus` cap (it does not inherit the job container's). | 2026-07-17 | [link](../decisions.md#2026-07-17-no-persistent-compiler-servers-in-ci-every-services-container-gets-an-explicit-cap-390s-small-lane-move-reversed-406) |
| `docs.decision-lifecycle` | every decision `##` record (active or archived) carries a 5-field metadata block (`key`, `status`, `since`, `supersedes`, `superseded-by`) checked by `scripts/decisions_validate.py`; a record is never deleted or line-edited to reverse a call — it is moved to `docs/decisions/archive/` with `status: superseded`/`retired` and a reciprocal `superseded-by`/`supersedes` key pair to its replacement. | 2026-07-21 | [link](../decisions.md#2026-07-21-decision-records-carry-a-lifecycle-schema-validated-by-a-script-append-only-by-diff-is-retired-521) |
+22
View File
@@ -0,0 +1,22 @@
# Archive — superseded / retired decision records
This directory holds decision records whose `status` is `superseded` or `retired`. They are kept
verbatim (rationale prose untouched — see `docs/decisions.md` header and `scripts/decisions_lib.py`)
for history: *why we changed our mind* is the point, never silently rewritten.
They are **out of the active startup path**: `scripts/decisions_lib.py active_files()` /
`all_active_records()` do not glob this directory, `docs/decisions/README.md` (the active catalog)
never lists a record from here, and an agent doing task-router discovery should not need to read
this directory to find the *current* rule — follow a record's `superseded-by` key to the active
successor instead.
The lifecycle validator (`scripts/decisions_validate.py`) still enforces invariants here:
- a `superseded`/`retired` record MUST live under this directory, never in an active file;
- an `active` record MUST NOT live under this directory;
- `supersedes`/`superseded-by` keys must resolve reciprocally to a record in the active set OR here;
- a record moved here must not have its rationale prose changed in the same commit (unless the
commit message carries the `[decisions-edit]` token, reserved for genuine rationale edits).
One file per topic cluster (e.g. `ci.md`, `release-ci-governance.md`), mirroring the active
`docs/decisions/*.md` topic-file split. See `docs/decisions/migration-map.md` for the legacy
heading → key → status → location mapping produced during the #521 lifecycle migration.
@@ -0,0 +1,43 @@
# Archived — release/CI/merge-governance records superseded by the #521 lifecycle schema
Records relocated verbatim (rationale prose unchanged) from `docs/decisions/release-ci-governance.md`
during the #521 decision-lifecycle migration. See `docs/decisions/archive/README.md` for what this
directory is and `docs/decisions/migration-map.md` for the full mapping.
- **`docs.append-only-guard`** (below) — the `docs/decisions.md`-is-append-only-by-construction half
of #303 H9/H3 (root-screenshot guard, H3, is a distinct still-active hook and is *not* covered by
this supersession; see note below). Superseded by `docs.decision-lifecycle` (active, in
`docs/decisions.md`) — the lifecycle validator (`scripts/decisions_validate.py`) that this very PR
introduces replaces line-level append-only enforcement with record-level lifecycle checks.
---
## 2026-07-12 — decisions.md is append-only, enforced; root-screenshot guard (#303 H9/H3)
`key: docs.append-only-guard` · `status: superseded` · `since: 2026-07-12` · `supersedes: none` · `superseded-by: docs.decision-lifecycle@2026-07-21`
**Rule:** (superseded) `docs/decisions.md` is append-only, enforced by hook + CI; the root-screenshot guard (H3, bundled in this same original entry) is unaffected by this supersession and remains in force.
**Signals:** decisions-guard hook · paths: `.claude/hooks/decisions-guard.sh`, `.husky/commit-msg` · issues: #303 (H9/H3)
**Mechanics:** superseded by `scripts/decisions_validate.py` (ersatztv#521); see `docs/decisions.md` → `docs.decision-lifecycle`
**This log is append-only by construction, not just by convention.** A commit or PR that deletes or
modifies an existing line of `docs/decisions.md` is blocked — by the Husky `commit-msg` hook
(`.claude/hooks/decisions-guard.sh staged`) locally and the blocking `decisions-guard` CI job (same
script, `range` mode) on PRs. Shared detection, deliberately different granularity: the Husky hook
gates **each commit** (its own message must carry the token); CI gates the **PR-wide** net diff
(token in any commit of the range suffices), so the local hook is the stricter primary gate and CI the
push/bypass backstop. Insertions anywhere are always allowed, so a normal new entry (TOC line
near the top + a block appended at the bottom, both pure insertions) passes untouched. Detection is
`git diff --numstat` deleted-count > 0, which is robust to markdown `-` list markers (a byte-level `-`
prefix would false-match). The block is lifted only by the literal **`[decisions-edit]`** token in the
commit message, reserved for two cases: fixing a factual error, and superseding a reversed decision
(add the new entry, prepend a `> **Superseded …**` banner to the old one, tag its Index line
`(superseded)` — keep the old rationale, never silently rewrite). **Consolidation** of superseded
entries is a release-checklist step (`docs/ci-cd.md` → Versioning & releases), backstopped by a
non-blocking 1800-line **size floor** in the `decisions-guard` job (the read-cost point past which the
log no longer fits one default agent Read), so append-only doesn't accrete contradictory *or
unreadably-large* history between releases (Timothy's call, 2026-07-12: mark-and-keep on reversal,
consolidate at each milestone, size-floor backstop).
Companion guard **H3**: the Husky `pre-commit` hook refuses a staged **root-level `*.png`** (a
review/debug screenshot dropped at the repo root) — belt-and-suspenders with the `.gitignore` rule, so
a forced `git add -f` still can't land one. Nested `*.png` (real assets) are unaffected. Rationale for
both: the methodology review (#303) — make the process rules derivations/hooks, not prose to remember.
+46
View File
@@ -0,0 +1,46 @@
# Decision migration map (legacy heading → active record / archive)
Auditable mapping produced during the #521 lifecycle migration. Every legacy H2 heading maps to
either an active record (key) or an archive location. Most headings in `docs/decisions.md` and the
`docs/decisions/*.md` topic files are still `status: legacy-unmigrated` (no metadata block yet) — this
table only covers records touched so far. `PYTHONPATH=. python3 scripts/decisions_validate.py` prints
the running legacy-unmigrated count; it must trend to 0 over the arc, not drop to 0 in one PR.
| Legacy heading | Key | Status | Location |
| --- | --- | --- | --- |
| 2026-07-17 — No persistent compiler servers in CI; every `services:` container gets an explicit cap; #390's small-lane move reversed (#406) | `ci.runner-placement` | active | `docs/decisions.md` |
| 2026-07-19 — CI `test` job reports a sampled true peak-anon, not cache-inflated `memory.peak` (#412) | `ci.peak-anon-measurement` | active | `docs/decisions.md` |
| 2026-07-12 — decisions.md is append-only, enforced; root-screenshot guard (#303 H9/H3) | `docs.append-only-guard` | superseded (`superseded-by: docs.decision-lifecycle@2026-07-21`) | `docs/decisions/archive/release-ci-governance.md` |
| 2026-07-21 — Decision records carry a lifecycle schema, validated by a script; append-only-by-diff is retired (#521) | `docs.decision-lifecycle` | active (`supersedes: docs.append-only-guard@2026-07-12`) | `docs/decisions.md` |
## Notes on records considered but NOT given a standalone entry
- **#390 (small-lane move for `api-docs`/`format`).** Investigated whether #390's reversal (described
in #406's prose, point 3: "#390's `small`-lane move ... reversed") ever existed as its own `##`
record. It did not — grep for `#390` across `docs/decisions.md` and `docs/decisions/*.md` finds it
only inside #406's own body text (and one other unrelated mention of #390's apt-ffmpeg estimate,
also inside #406). #390 was **prose-only**: no separate heading, so nothing to mark `superseded` or
move to archive. `ci.runner-placement` (#406) therefore carries `supersedes: none`; the reversal is
recorded only in its `**Signals:**` line (`#390 (prose-reversed, no standalone record)`) and in this
note.
- **#411 (the earlier `memory.peak`-headline measurement).** Investigated the "#411 obsolescence" the
brief references. #411 is mentioned twice in `docs/decisions.md`, both inside #412's own body
("the `test` job's memory instrument (added in #411) now reports ..." and "the older #411 probe
... is superseded"). Like #390, #411 never had its own `##` heading — its "decision" was
narrated retroactively inside #406 (the "Measurement is now continuous" paragraph, which describes
the instrument #411 actually shipped) and explicitly marked obsolete inside #412's own prose. Since
there is no standalone #411 record, there is nothing to move to `archive/`; `ci.peak-anon-measurement`
(#412) — the record that supersedes #411's approach — carries `supersedes: none` and documents the
prose reversal in its `**Signals:**` line. The governed surface (CI memory measurement) still exists
and is very much active, so this is a straightforward **supersession of an unnamed predecessor**, not
a retirement — there's no case to make for `retired` here since the surface it measures is live.
## Still open (tracked for later migration passes, not this PR)
- `## 2026-07-11 — Queue state lives in the pinned Gitea tracker (#237), not in the handoff file` is
reversed by #520, not #521 — per the task-5 brief its supersession lands in PR2/Task 8, not here.
- The remaining ~90 headings in `docs/decisions.md` and the other three `docs/decisions/*.md` topic
files (`optimistic-concurrency.md`, `api-auth-security.md`, `spa-modularization.md`, and the rest of
`release-ci-governance.md`) are unmigrated (`status: legacy-unmigrated`, no metadata block). They are
valid under the schema as-is (the validator treats an unmigrated H2 as a migration target, not an
error) and migrate incrementally as each is next touched, per the arc's design.
+1 -27
View File
@@ -16,7 +16,7 @@ rule a derivation/hook, not prose to remember (#303 methodology review).
- [2026-07-12 — Blocking CI gate for API-contract artifacts (#303 H4/H5)](#2026-07-12--blocking-ci-gate-for-api-contract-artifacts-303-h4h5)
- [2026-07-12 — Merge-consent derived from state via a `## Done-when` issue checklist (#303 H6)](#2026-07-12--merge-consent-derived-from-state-via-a--done-when-issue-checklist-303-h6)
- [2026-07-12 — decisions.md is append-only, enforced; root-screenshot guard (#303 H9/H3)](#2026-07-12--decisionsmd-is-append-only-enforced-root-screenshot-guard-303-h9h3)
- **(archived 2026-07-21)** 2026-07-12 — decisions.md is append-only, enforced; root-screenshot guard (#303 H9/H3) — the append-only half (`docs.append-only-guard`) is `status: superseded` by `docs.decision-lifecycle` (see `docs/decisions.md`); relocated to [`archive/release-ci-governance.md`](archive/release-ci-governance.md#2026-07-12--decisionsmd-is-append-only-enforced-root-screenshot-guard-303-h9h3). The companion root-screenshot guard (H3) is unaffected and stays in force.
- [2026-07-12 — Review-verdict merge-gate: latest commit must be reviewed (#303 H10)](#2026-07-12--review-verdict-merge-gate-latest-commit-must-be-reviewed-303-h10)
- [2026-07-12 — Formatting-as-you-touch, enforced; rebase-not-merge for PR branches (#311 H11 + format CI)](#2026-07-12--formatting-as-you-touch-enforced-rebase-not-merge-for-pr-branches-311-h11--format-ci)
- [2026-07-12 — Merge-consent gate auto-grants when satisfied (no redundant prompt); state IS the consent (#314)](#2026-07-12--merge-consent-gate-auto-grants-when-satisfied-no-redundant-prompt-state-is-the-consent-314)
@@ -62,32 +62,6 @@ issues adopt `## Done-when`, the merge hook simply *asks* rather than auto-allow
Completion Protocol. (H6 lives with H1/H2/H8 in `.claude/settings.json`; H7 worktree-owner guard is its
sibling Wave-2 hook.)
## 2026-07-12 — decisions.md is append-only, enforced; root-screenshot guard (#303 H9/H3)
**This log is append-only by construction, not just by convention.** A commit or PR that deletes or
modifies an existing line of `docs/decisions.md` is blocked — by the Husky `commit-msg` hook
(`.claude/hooks/decisions-guard.sh staged`) locally and the blocking `decisions-guard` CI job (same
script, `range` mode) on PRs. Shared detection, deliberately different granularity: the Husky hook
gates **each commit** (its own message must carry the token); CI gates the **PR-wide** net diff
(token in any commit of the range suffices), so the local hook is the stricter primary gate and CI the
push/bypass backstop. Insertions anywhere are always allowed, so a normal new entry (TOC line
near the top + a block appended at the bottom, both pure insertions) passes untouched. Detection is
`git diff --numstat` deleted-count > 0, which is robust to markdown `-` list markers (a byte-level `-`
prefix would false-match). The block is lifted only by the literal **`[decisions-edit]`** token in the
commit message, reserved for two cases: fixing a factual error, and superseding a reversed decision
(add the new entry, prepend a `> **Superseded …**` banner to the old one, tag its Index line
`(superseded)` — keep the old rationale, never silently rewrite). **Consolidation** of superseded
entries is a release-checklist step (`docs/ci-cd.md` → Versioning & releases), backstopped by a
non-blocking 1800-line **size floor** in the `decisions-guard` job (the read-cost point past which the
log no longer fits one default agent Read), so append-only doesn't accrete contradictory *or
unreadably-large* history between releases (Timothy's call, 2026-07-12: mark-and-keep on reversal,
consolidate at each milestone, size-floor backstop).
Companion guard **H3**: the Husky `pre-commit` hook refuses a staged **root-level `*.png`** (a
review/debug screenshot dropped at the repo root) — belt-and-suspenders with the `.gitignore` rule, so
a forced `git add -f` still can't land one. Nested `*.png` (real assets) are unaffected. Rationale for
both: the methodology review (#303) — make the process rules derivations/hooks, not prose to remember.
## 2026-07-12 — Review-verdict merge-gate: latest commit must be reviewed (#303 H10)
**A PR may not merge until a `Review-verdict:` comment on it references the PR's CURRENT head sha** —