Repository navigation
Description
Part of #2948.
Context
The archive currently stores YYYY-MM/<record-kind>.json on refs/heads/brain-ci-metrics. The issue's 2026-11-16 volume observation projects approximately 66 MB of run data per month. The delivered writer refuses publication if an output file exceeds 95 MiB. On inspected main 49b6e7c48ca9f7f6c4bfff90790c28a536ba66e0, the guard is MAX_FILE_BYTES (scripts/ci-archive.ts:26) and the serialization check is if (Buffer.byteLength(text) > MAX_FILE_BYTES) (scripts/ci-archive.ts:246). The current reader, parseMonthFile (scripts/ci-archive.ts:148-158), recognizes only monthly files. #2955's writer is delivered through merged #4133; the implementation prerequisite is satisfied.
Decision
Maintainer, 2026-11-17: option B, recorded ruling. New run writes use YYYY-MM/run/DD.json, based on the run's existing UTC partition timestamp (run: { at:, scripts/ci-archive.ts:52). Other kinds retain YYYY-MM/<kind>.json. The rule is fixed by kind; no runtime partition-selection interview is needed.
Daily placement keeps late-arriving records on a stable natural key and retains readable text history. Numbered size-based parts can reshuffle on late arrivals; compression hides text diffs and only postpones the same ceiling. Each daily output still has the existing 95 MiB guard; exceeding it refuses publication rather than inventing another partition scheme.
Out of scope
Baseline acquisition (#4129), directory-report tie handling (#4131), new telemetry, report delivery, changing retention or record payload meanings, compression, numbered parts, and raising the size cap. No live archive dispatch or data-ref rewrite is part of this decision-processing pass.
Scope
Append the selected layout amendment to docs/decisions/ci-evidence.md, update the existing writer and all archive readers, and update the archive/inventory documentation. Preserve immutable historical records, deterministic identity/merge semantics, the leakage screen, unknown-version refusal and exact-lease publication. Keep legacy monthly run files readable throughout the transition; new writes use daily run partitions without destructively rewriting historical blobs.
Acceptance criteria
- A dated amendment in
docs/decisions/ci-evidence.mdrecords this ruling, alternatives, the timestamp rule and compatibility with legacy monthly files. The archive guide and inventory describe the same rule. - The writer puts each new run/attempt in the ruled UTC-day file, including late arrivals and month/day boundaries; other kinds stay monthly.
- Every archive-reading/report path accepts legacy monthly runs and daily runs. If both layouts carry a run/attempt, reporting counts it once using the existing deterministic merge/conflict rules; no historical record is lost or silently changed.
- Every output file retains the existing size boundary: at the cap is allowed, above it refuses the complete publication before any push. Daily overflow does not silently fall back to compression or numbered parts.
- Replay, repeated compaction and reader/report ordering are deterministic. Existing schema versions, privacy checks, record conflicts and exact-lease concurrency protections remain covered.
Verification
Use focused offline tests in tests/ci-archive.test.ts for daily placement, UTC boundaries, late arrivals, the size boundary and mixed-layout transition. Assert equivalent report contents without missing or double-counted runs. Remove the partition/boundary behavior in a mutation, observe the named assertion fail, restore it and run bun run test tests/ci-archive.test.ts tests/ci-timings.test.ts, plus any affected evidence-report tests. Synthetic data is sufficient; no live near-limit archive is required.
Contract impact
No CLI/MCP or consumer payload change is selected. This changes the internal archive layout bound by docs/decisions/ci-evidence.md, whose dated amendment is required in this delivery.
2026-11-17 decision processing: selected B, replaced the open partition question with its implementation brief, and retained unscheduled priority p2. Earlier triage's writer prerequisite is satisfied by #4133.
Activity
schlessera commentedon Nov 17, 2026
Decision needed (triage, 2026-11-17). How is a record kind partitioned once one UTC month no longer fits in a single blob? The archive decision binds
YYYY-MM/<record-kind>.json, so every option amends that record, and #2956/#2957 read whatever it says.YYYY-MM/<kind>-<n>.json. Keeps the month as the unit. Cost: unless records are ordered by a stable key, a re-compaction that adds records shifts records between parts, so archive history diffs badly. Readers must list parts.YYYY-MM/<kind>/DD.json, at first onlyrun. A record's place is set by its own UTC date, so re-compaction is stable and append-only history stays readable. At the projected ~66 MB/month that is about 2–3 MB a day, a large margin. Cost: the layout differs by kind, so readers need a rule or a manifest to know which kinds are split by day.Recommendation (not approval): B. It bounds file size by a natural key, keeps compaction deterministic and append-only, and the switch can be recorded per kind in a dated amendment of the decision record.
Completion evidence: a
**Decision (maintainer, <date>):**comment choosing A, B or C (or another layout). It is recorded indocs/decisions/ci-evidence.mdunder the issue's first criterion. Implementation then follows once #2955's writer is on main.schlessera commentedon Nov 17, 2026
Decision (maintainer, 2026-11-17): Option B: partition new archived
runrecords by UTC day atYYYY-MM/run/DD.json. Other record kinds retainYYYY-MM/<kind>.json. A run's day follows its existing partition timestamp (run.createdAt), rather than collection or compaction time.Keep legacy monthly run files readable during transition, preserve historical records and deterministic identity/merge semantics, and count a run/attempt once when layouts coexist. Keep the 95 MiB size guard on each output file, the leakage screen, unknown-version refusal and exact-lease publication. An oversized daily file still refuses publication; this ruling does not add a second automatic partition scheme.
Record the dated layout amendment in
docs/decisions/ci-evidence.mdas part of this issue's delivery, update the writer and every archive reader, and prove the boundary and transition offline. Numbered monthly parts were rejected because late records can reshuffle them; compression was rejected because it hides text diffs and only postpones the size limit.Remove
needs: decisionand addagent-ready. The issue remains unscheduled. This decision does not dispatch archive jobs or rewrite the live data ref.[-]ci: decide how the evidence archive partitions a kind that outgrows one monthly blob[/-][+]ci: partition archived run records by UTC day[/+]schlessera commentedon Nov 17, 2026
Claimed for implementation. Claim token:
claim-2c4dfdb0. Branch:chore/4130-daily-run-archive.schlessera commentedon Nov 17, 2026
Merged in #4166 as
94f55806cthrough the integration lease (orchestrator merge queue for 0.45.0). Candidate confirmation passed on the exact head; the squash's own main run carries the post-merge heavy categories.