Skip to content

ci: add a ci.toml cache policy sized against the measured live footprint - #218

Merged
zackees merged 1 commit into
mainfrom
ci/cache-policy
Oct 5, 2026
Merged

zackees merged 1 commit into
mainfrom
ci/cache-policy

Conversation

@zackees

@zackees zackees commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator

Adds ci.toml (schema 3) declaring reld's Actions cache policy. reld had no ci.toml, so nothing bounded its cache growth and ci-lint cache audit could not classify a single entry.

Every [cache.family] max is sized against the family's live sum, not just its largest entry. ci-lint cache janitor LRU-trims an evict = "lru" family at max × cardinality, so under-stating max would delete live caches. Verified: cache janitor --dry-run proposes zero LRU deletions across every declared family.

Before / after

entries bytes
live (measured) 34 5,276,149,159 B (4.91 GiB)
declared steady worst case — 6,354,370,560 B (5.92 GiB)
[cache].budget — 10,200,547,328 B (9.5 GB)

Headroom 3.58 GiB under GitHub's 10 GB cap. [cache.pr] mode = "none" — these workflows write no PR-scoped cache, so the PR term is 0.

The check_cache_004 line

steady total            = 6354370560 B
+ lockfile-change peak  = 817889280 B
+ [cache.pr].budget     = 0 B
formula applied: worst = steady + [cache.pr].budget (every writer flow pre-prunes: lockfile peak waived)
= worst case            = 6354370560 B
budget ([cache].budget) = 10200547328 B

Per family:

family via n live bytes model
cross-prepare setup-soldr:cross-targets 5 2,571,870,824 5 shapes, 650/650/650/650/140 MB
compile setup-soldr:build-cache 3 598,919,713 3 shapes, 310/150/135 MB
solo-toolchain setup-soldr:solo-toolchain 8 1,585,193,832 260 MB × 9 platforms
deps setup-soldr:cook 1 146,673,625 145 MB × 1
registry setup-soldr:cargo-registry 1 38,242,989 40 MB × 1
soldr-mini setup-soldr:soldr-mini 4 46,091,518 15 MB × 8
uv setup-uv 5 38,091,895 10 MB × 8
undeclared — 7 251,064,763 see below

cross-prepare and compile use the per-shape form (forge-ci/ci.yml#334) because their entries really do differ (cross-prepare: 135 MB for win-gnu vs 635 MB for the four large targets). Note the shapes feed CACHE-004's sum, but the janitor still uses max × cardinality, so max is set to the largest shape and per over-counts platforms in both cases.

Validation (ci-lint @ 92106df3)

  • load_ci_toml — 0 schema findings
  • check_cache_004 — 0 findings
  • check_cache_029 — 0 findings
  • check_cache_030 — 0 findings
  • ci-lint cache audit (live, GITHUB_REPOSITORY=zackees/reld) — 27/34 entries classified into declared families, budget at 51.7%. No CACHE-004, no GEN-009.

Notes for the reviewer

[cache.promote] mode = "off" is deliberate. setup-soldr's nearest-ancestor promotion (#566) is an unreleased opt-in pilot — auto-key defaults to "false" and no fleet repository has a live setup-soldr-ancestor-build-v1-* entry. Declaring "ancestor" would be a promise nothing implements, which is exactly what CACHE-030 flags.

No [local.gate] is declared. reld has no local-gate.toml and no local-gate surface today, so ci_lint.local_gate.load_gate_config returns no config with this file present (verified). Adding gate keys would have switched ci-lint local-gate to reading gate config from here and demanding a complete gate definition.

7 entries (251 MB) stay undeclared and surface as CACHE-001: msys2-pkgs-*, llvm-ld-coff-* ×3, linkers-Linux-* ×2, setup-soldr-targetcache-thin-v2-*. These come from third-party actions (msys2/setup-msys2) and reld's own ci/ scripts, and ci_lint.cache.families.ALLOWED_VIA_VALUES has no shape for any of them — declaring them would need a new FamilyShape entry cited against the producing action's source, which is a zackees/ci.yml change, not a reld one. Until then ci-lint cache janitor would delete them as undeclared; I have not run it.

One poisoned entry. setup-soldr-targetcache-thin-v2-... is 222 B, at or below the 1024 B poison-guard floor (CACHE-005). It needs ci-lint cache heal --key <key> so the next writer run repopulates it — not done here.

Platform list grew to 9. solo-toolchain had 8 live entries, which tripped CACHE-004 against per = "platform" at 7 declared platforms. Rather than delete entries or overstate a max, the platform list now includes the musl targets reld's release.yml genuinely builds (x86_64/aarch64-unknown-linux-musl) — 9 platforms, per = "platform" → 9 ≥ 8. macos-x64 is recorded as cross-building from windows-2022, which is what release.yml actually does.

🤖 Generated with Claude Code

reld had no ci.toml, so nothing bounded its Actions cache growth and
'ci-lint cache audit' could not classify a single entry.

Measured 2026-10-05 against the live repository: 34 entries, 5276149159B
(4.91 GiB). Every [cache.family] max is sized at or above the family's live
sum, not just its largest entry, because 'ci-lint cache janitor' LRU-trims
an evict = "lru" family at max x cardinality and under-stating max would
delete live caches.

- cross-prepare and compile declare per-shape ceilings (their entries differ
  135MB..635MB and 126MB..302MB), so CACHE-004's footprint is the honest sum.
- evictions verified safe: 'cache janitor --dry-run' proposes zero LRU
  deletions across every declared family.
- [cache.promote] mode = "off": setup-soldr's ancestor promotion is an
  unreleased opt-in pilot, so declaring it would promise nothing (CACHE-030).
- [cache.pr] mode = "none": PRs write no cache in these workflows.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@zackees
zackees merged commit ac71f0b into main Oct 5, 2026
22 checks passed
zackees added a commit to forge-ci/ci.yml that referenced this pull request Oct 5, 2026
…t blocks it (#344)

**Merged:** forge-ci/reld#218 (ac71f0b), worst case 5.92 GiB against a 9.5 GB
budget. 7 entries stay undeclared -- no via exists for msys2-pkgs,
llvm-ld-coff, linkers-Linux or setup-soldr-targetcache-thin-v2.

**Open drafts:**
- forge-ci/bosn#513 -- draft because adding a ci.toml surfaces **461
  pre-existing findings** (LAYOUT-001 x208, SEC-004 x148) that were
  invisible while there was no ci.toml. The agent also corrected my
  premise: bosn is NOT 221 distinct builds. It is 13 live build-cache
  entries under 4 toolchain digests -- setup-soldr#237 deliberately
  dropped the per-commit SHA so caches survive across commits -- plus 196
  tiny ci-lint attestation caches. A janitor dry-run plans 9.86 -> 2.07 GB.
- zackees/mimalloc-pprof#603 -- draft because a local gate exists.
  Declared families fit at 8.02 GiB vs 9.5 GB, but 3.58 GiB (42%) is
  UNDECLARABLE, see below.
- FastLED/fbuild#1652 -- fits at 9.75 GB against 9.5 GB, 448 MB headroom.

**Structural:** FastLED/FastLED#4703 applies `save: 'false'` on PR board
jobs so they restore without writing. It does NOT apply
`cache-mode: 'split'` -- verified available (it is on fbuild main and
FastLED pins @main, a floating ref) but genuinely broken: setup runs
before the compile step synthesises platformio.ini, and fbuild install
hard-fails on apollo3_red, clone and kitchensink. Shipping it would turn
board jobs red. Stops the leak at ~120 GiB; does not reach 10 GiB.

**A bug in my own #334**, found independently by the reld, fbuild and
mimalloc-pprof agents: `shapes` made CACHE-004 sum the shape maxima
while `_lru_evictions` still used `max x cardinality(per)`. Where they
diverge the janitor is stricter, so it evicted live entries precheck had
approved. Fixed in #343; both paths now call `family_footprint`.

**Next blocker, now the top ci.yml item:** `ALLOWED_VIA_VALUES` has no
entry for shapes setup-soldr actually emits, so they can never be
declared and are reported undeclared forever --
setup-soldr-targetcache-thin-v2-, setup-soldr-prepare-* without its v3
segment, setup-soldr-tarball-*, setup-soldr-cargo-registry-v2-*,
cook-base-v1-*. That is 42% of mimalloc-pprof's cache and blocks reld
and fbuild too.

Refs #153, #334, #343

Local-Gate: v1 tree=d3697bb3c8052b2e0a9ad339e012e0772ca4c929 secs=73
@zackees
zackees deleted the ci/cache-policy branch November 5, 2026 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant