Files
ersatztv/docs/decisions/records/ci/monitor-armed-at-pr-open.md
T
timothy fba5233caf
PR Gates / CI image pin matches docker/ci (pull_request) Successful in 11s
PR Gates / Docs update reminder (pull_request) Successful in 16s
PR Gates / decisions lifecycle (pull_request) Failing after 23s
Build ErsatzTV Image / Formatting (changed .cs conform to .editorconfig) (pull_request) Successful in 1m17s
Build ErsatzTV Image / API docs in sync (OpenAPI + endpoint index) (pull_request) Successful in 1m29s
Build ErsatzTV Image / Build & test (.NET) (pull_request) Successful in 8m5s
Build ErsatzTV Image / EF migration integrity (SQLite + MySql) (pull_request) Successful in 16m5s
Build ErsatzTV Image / Functional E2E (curl + UI contracts) (pull_request) Successful in 17m6s
Build ErsatzTV Image / Build & push image (amd64) (pull_request) Has been skipped
feat(610): split the decision corpus into one YAML-frontmatter file per record
168 records -> docs/decisions/records/<area>/<topic>.md (163 active, 23 dirs) and
docs/decisions/archive/<area>/<topic>.md (5 archived). The filename IS the key,
so one-active-record-per-key becomes a filesystem property rather than a
validator check, and supersession becomes a `git mv`.

WHY: the monolith was a concurrency problem before an aesthetic one. A
3,900-line append target made parallel sessions collide -- PR #605 and PR #614
both hit append-vs-append conflicts during routine rebases, and hand-resolving
those inside the corpus is exactly the operation the rationale-rewrite guard
exists to police.

HOW IT IS VERIFIED: a ~170-file diff cannot be meaningfully read, so correctness
does not rest on reading it. The parser was taught BOTH formats first, so the
body-diff guard parses the old form at the merge-base and the new form at head --
the migration validates itself, no bypass. The proof is a field-level equivalence
harness: 168 records before and after, zero lost, zero gained, zero field
mismatches, zero rationale bodies differing. Reviewers should scrutinise the
harness; it is the actual evidence.

What measuring caught that reading would not have:

- ~500 lines sit OUTSIDE any record -- decisions.md's lifecycle schema and each
  topic file's preamble, mostly the only copy. Source files are kept and
  stripped, never deleted. They also cannot be filed per-area: topic files hold
  several areas and 4 of 23 areas span several files.
- Archive discovery was a non-recursive glob; after the split it found ZERO
  archived records, surfacing as four bogus "supersedes points to unknown key"
  errors rather than an obvious failure.
- ~32 live docs point into the corpus BY DATE, which the split dangles. Each
  stripped file now ends with a generated "Records formerly in this file" index,
  which also rescues the identical breadcrumbs in old issue comments.
- decisions.md's "In this file:" list was 97 same-file anchor bullets that the
  split makes WRONG, not merely stale. Dropped; the generated index replaces
  them with links that resolve.

The equivalence harness now runs against a checked-in FIXTURE, not the live
corpus. The earlier version migrated the real tree, which made it a one-shot:
the moment the migration landed there was nothing left to move and the tests
failed for reasons unrelated to the code. A fixture keeps them testing the
SCRIPT rather than the repo's current state.

Keys preserved verbatim, warts included: `sched` (12) and `scheduling` (1) remain
two directories for one concept. Renaming a key is not a move -- it changes
identity, breaks the equivalence proof, and invalidates MemPalace's per-key
drawers. Taxonomy normalisation is separate work.

refs #610
2026-07-25 19:45:09 +02:00

3.5 KiB

key, title, status, since, supersedes, superseded-by, rule, signals, mechanics
key title status since supersedes superseded-by rule signals mechanics
ci.monitor-armed-at-pr-open 2026-07-21 — Arm the CI monitor at PR-open, via the commit-status endpoint (#542) active 2026-07-21 none none Arm a CI monitor on the PR head sha the moment the PR opens, polling the commit-status endpoint — not at the end of the work. arm monitor at PR open · commit status endpoint · head sha · red run sat unnoticed · MySQL-apply flake · `skipped` misread as red · `Build & push image (amd64)` skipped · monitor classification · `!= "success"` filter · combined `.state` · paths: n/a · issues: #542, #216, #583 `GET /api/v1/repos/timothy/ersatztv/commits/{sha}/status` for the combined verdict (`.state`); `…/statuses?limit=50` only when you need per-context detail.

CI runs concurrently with the review and E2E work that follows a push, so the cost of a late-armed monitor is entirely wasted wall-clock. In the #216 session three PR runs sat red for roughly an hour on a CI-only flake while review and E2E ran to completion — the reds were only discovered afterwards.

Classify per-context states correctly, or prefer the combined .state. A monitor that enumerates contexts and treats anything != "success" as red is WRONG on this repo: Build & push image (amd64) is if:-gated at the JOB level on github.event_name != 'pull_request', so it reports skipped on every PR, by design and regardless of content (images are built only on push-to-main and tags — see ci.docs-only-skip-steps, which records the same fact from the branch-protection angle: "build is skipped on every PR"). Such a monitor cries "NOT all green" on a perfectly green PR. Note this is not the docs-only skip: the docs-only mechanism deliberately gates individual STEPS so required jobs still report success in seconds — misattributing the image job's skip to docs-only is a plausible-sounding wrong diagnosis (#583 session, 2026-07-25).

Three distinct non-success states, three meanings — do not collapse them:

  • skipped — deliberately not applicable. Settled, and not red. Gitea's combined .state already treats it as non-blocking (a PR with a skipped build reports overall=success), which is why the combined endpoint is the safer thing to gate on.
  • failure — a real red; diagnose it (but first check ci.killed-job-triage and ci.infra-shaped-red-under-load).
  • cancelled — no verdict at all; see ci.cancelled-is-not-a-verdict.

Working filter when you do enumerate — verified silent on a green PR carrying a skipped build, and verified to still report a genuinely unfinished run (i.e. proven able to go dirty, per process.bom-format-detection-recipe's "verify your detector" rule):

curl -s -u "$ETV_GITEA_BASICAUTH" ".../commits/$SHA/statuses?limit=50" \
  | jq -r '[.[]|{c:.context,st:.status}]|group_by(.c)|map(.[0])|.[]
           |select(.st!="success" and .st!="skipped")|"NOT-GREEN: \(.c) = \(.st)"'

Mind the renamed key. The first draft of this snippet said select(.status != …) after the pipeline had already renamed .status to .st, so the comparison ran against null, passed everything, and reported a fully green PR as nine failures. Report failure and cancelled in separate counts.

Related context for interpreting an early red: the old MySQL host-port 3306 collision is fixed on main (ef8915f1), so a lone MySQL-apply red now indicates the known infra flake and warrants a rerun rather than diagnosis.