Skip to content

chore(ci): generate the daily digest and weekly evidence report from the archive - #4141

Merged
schlessera merged 1 commit into
mainfrom
chore/2956-ci-evidence-reports
Nov 17, 2026
Merged

schlessera merged 1 commit into
mainfrom
chore/2956-ci-evidence-reports

Conversation

@schlessera

@schlessera schlessera commented Nov 17, 2026 •

Copy link
Copy Markdown
Owner

Refs #2956

What changed

Two scheduled reports now come from the durable data ref rather than from hand-run commands. scripts/ci-evidence-report.ts builds a daily digest (the UTC day before --until) and a weekly full report (the seven days before it) as Markdown and JSON. The new read-only workflow ci-evidence-report.yml runs at 03:37 UTC, an hour after the 02:17 compaction. It writes the digest every day and adds the weekly report on Mondays, or on dispatch with weekly. Both go to the job summary and to a 90-day ci-evidence-report artifact.

Each report contains throughput cohorts, first-main green per proof-policy epoch, red-main incidents and time to green, the top failing and suspected-flaky test families, runner-slot wait, local contention, activity per day, the #2934 Phase B gate, and a coverage section. The coverage section lists missing collection hours, expired sources, failed acquisitions, missing run attempts and named unknowns. Escape classes are reported as unknown until #4043 lands. A day with a missing collection hour reports null counts and gives the observed numbers separately, so a missing hour never reads as zero.

The digest's changed flag, with triggers naming the cause, is true when:

  • a red-main incident is first observed in the window;
  • the gate's status differs from the previous day's;
  • or the window has a missing collection hour.

Each Markdown report starts with a ## Summary section that ends at the next heading. File names are fixed: digest.{json,md} and weekly.{json,md}. The JSON is version: 1. This keeps the output stable for #2957, which posts it. Posting is out of scope here.

Why this shape

  • Trigger rule. The issue's "red-main incident passes the configured threshold" wording is superseded by the decision record. The rule is any newly observed incident, with no duration threshold, and re-observing an unchanged incident does not count. "Newly observed" means the incident's earliest archived red-main record falls in the window. That is computed from the archive alone, so the report keeps no delivery state of its own.
  • Gate rule. The gate is evaluated over the trailing seven days ending at the window end. It is met only when all three conditions hold: the current epoch opened at a classified proof-system squash at least seven days earlier; at least 80% of known first-main outcomes in those days are green; and every red-main incident open in those days has a failure-classified event naming its opening run. Missing evidence makes a condition unknown, and unknown is not met (Epic: independent changes land on main concurrently, with only overlapping work serialized #2934: partial coverage is not qualification). An unbounded or unknown epoch boundary, no known outcome, a missing collection hour, or no red-main history collected in those days all count as missing evidence. A gate change is computed against the same rule one day earlier, from the same archive.
  • Missing hours. A missing collection hour is an hour that no collection manifest's creation window covered. An hour covered only by partial collections (often budget stops) is listed under partialOnly but is not a gap. Otherwise almost every digest would fire on routine partial manifests.
  • Separate workflow. The reports run as their own workflow because check-ci-workflows holds ci-evidence-archive.yml to its single write-scoped job. The new reportWorkflowProblems check holds the report job to contents: read only, no workflow-level permission, trusted default-branch code with full history (the epochs need it), no event interpolation or install, and an always-uploaded 90-day artifact.

Builds on the #2955 archive format, not on backfill completeness. The reports read YYYY-MM/<kind>.json on refs/heads/brain-ci-metrics through the existing archiveInputs/readArchive. archiveInputs gained an optional checkout root, so tests can read a fixture remote. #2955's remaining backfill dispatches (still pending when this was written) only change which hours are covered, and every report states that coverage. If #4130 changes the monthly partition, it needs to update readArchive only. This PR adds no new layout dependency. The reports read archive files listed by git ls-tree, which is sorted and whose rows are already merged per identity, so they do not depend on the directory-listing order behind #4131.

Proof

Focused suite tests/ci-evidence-report.test.ts (7 tests). The acceptance criteria map as follows:

  • Weekly numbers match a manual recomputation. The fixture world is published through the real publishBatch writer to a bare remote, then read back with archiveInputs. Merges, first-main green, per-day rates, latencies, size cohorts, runner-slot wait, time to green, families, contention and activity are each compared with values recomputed by hand from the fixture definitions.
  • A missing hour is listed and never reads as zero. The missing hour appears in coverage.collectionHours.missing and in the Markdown. The day reports null counts with observed lower bounds, and the Markdown never prints a zero row for it.
  • Gate met exactly when all three conditions hold. met at exactly 80%. Each condition fails on its own: a young epoch, 2/5 green, an unattributed incident. Missing red-main history and missing history are each not met with the condition named.
  • changed for each trigger and false otherwise. True for a new incident, a gate change and a collection gap, each isolated so it is the only trigger. False for a quiet day and for an incident re-observed unchanged.
  • CLI and workflow. The CLI reads a fixture remote and refuses a window that does not end on a whole hour. The workflow-shape checks are mutated in the test.

Mutation receipts (each mutation applied, the named assertion failed, then restored with cmp):

Mutation in scripts/ci-evidence-report.ts / check-ci-workflows.ts Failing assertion
M1 an uncovered hour is never marked missing MISSING_HOUR_LISTED, COLLECTION_GAP
M2 a day with a missing hour reports its count MISSING_HOUR_NOT_ZERO
M3 80% threshold made exclusive (>) GATE_MET, REOBSERVED_INCIDENT_UNCHANGED, weekly gate toBe("met")
M4 epoch age ignored EPOCH_TOO_YOUNG, GATE_CHANGE
M5 incident attribution ignored INCIDENT_UNATTRIBUTED
M6 no red-main history reads as met NO_RED_MAIN_HISTORY_IS_NOT_MET
M7 changed ignores a gate change GATE_CHANGE
M8 "new" means present, not first observed REOBSERVED_NOT_NEW
M9 changed ignores a collection gap COLLECTION_GAP (first survived because the gap also flipped the gate; the test now isolates the gap as the only trigger, and the mutation fails it)
M10 a missing hour leaves the gate's first-main condition known GAP_LEAVES_GATE_UNKNOWN
M11 report job permission unchecked REPORT_JOB_READ_ONLY

Also run: bun run test tests/ci-workflows.test.ts tests/ci-archive.test.ts tests/ci-timings.test.ts tests/ci-throughput.test.ts tests/ci-red-main.test.ts tests/ci-epochs.test.ts, 131 pass. Root tsc --noEmit is clean. No package exports changed.

bun run check:pr --base origin/main
{"version":1,"kind":"brain-check-pr-receipt","head":"78447eb1ecdd20bfbfa083733d48b9c7ef289fee","base":"origin/main","mode":"focused","startedAt":"2026-11-17T05:32:27.702Z","finishedAt":"2026-11-17T05:33:56.408Z","checks":[{"name":"all lint and leakage gates","categories":["changeset"],"outcome":"passed","elapsedMs":12901.038618},{"name":"environment documentation","categories":["changeset"],"outcome":"passed","elapsedMs":123.24315299999944},{"name":"pending changeset package names","categories":["changeset"],"outcome":"passed","elapsedMs":98.18703899999855},{"name":"contribution changeset","categories":["changeset"],"outcome":"passed","elapsedMs":20.375918999998248},{"name":"affected fast invariants","categories":["verify","unit"],"outcome":"passed","elapsedMs":75546.65655}]}

Collisions

bun scripts/collisions.ts --json --pr 4141 at head 78447eb1ecdd20bfbfa083733d48b9c7ef289fee (graph built at that commit) found closure-only overlaps and no path or textual collision. The PRs are #3054, #3056, #3059, #3069, #3581, #3622, #4002, #4036, #4102 and #4139. #3056, #3059 and #4102 share the ci-timings/red-main test closure, tests/ci-*.test.ts.

Checklist

  • Focused local preflight/behavioral receipts passed; selected hosted proof runs on confirmation.
  • Acceptance criteria from the issue are all met; the remaining verification is named below.
  • Touches none of packages/ui-react/, packages/ui-kit/, packages/ui-server/ or packages/core/ (fast-lane eligible).
  • Milestone 0.45.0 on this PR and ci: generate the daily digest and weekly evidence report from the archive #2956.
  • No changeset: scripts, workflow and docs only; nothing a package consumer sees.
  • No personal data; the fixture is the Odysseus world (odysseus/chronicle, pinned 2026-07-12 week).
  • Nothing in the machine surface moved (no CLI --json contract command, MCP tool or frontmatter).
  • Docs updated: docs/process/ci-timings.md (new "Scheduled evidence reports" section), the evidence inventory docs/process/ci-evidence.md, and docs/process/ci-throughput.md.
  • No fail-closed guard added or changed: the gate is a measurement, never a proof or merge input, and reportWorkflowProblems is a static workflow lint like its archive sibling.
  • Nothing on a turn's path changed.

Anything left open

…the archive (#2956)

Adds scripts/ci-evidence-report.ts and the read-only ci-evidence-report
workflow. Every day, an hour after the archive compaction, it reads the
measurement data ref and main's history and writes the daily digest. On
Mondays it also writes the weekly report. Both are written as Markdown and
JSON to the job summary and a 90-day artifact.

Each report covers throughput cohorts, first-main green per proof-policy
epoch, red-main incidents and time to green, the top failing and
suspected-flaky test families, runner-slot wait, local contention, activity
per day, the Phase B gate over the trailing seven days and a coverage section
(missing collection hours, expired sources, failed acquisitions, unknowns).
A missing hour never reads as zero activity. The digest's `changed` flag
follows the decision record: a newly observed red-main incident with no
duration threshold, a gate state change, or a collection gap.

check-ci-workflows holds the workflow to no write permission, trusted
default-branch code with full history and an always-uploaded artifact.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ci CI workflows, the gates they run, release scripts, packaging. type: chore Tooling, CI, release plumbing, dependencies.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant