Skip to content

ci: per-job cache ledger and baseline rollup - #3831

Merged
zackees merged 9 commits into
masterfrom
ci/cache-ledger
Nov 7, 2026
Merged

zackees merged 9 commits into
masterfrom
ci/cache-ledger

Conversation

@zackees

@zackees zackees commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

Makes cache hit rates measurable per lane: one JSON ledger per job, plus a rollup across runs. No caching behaviour changes: no wrapper enablement, no S3 edits, and SOLDR_RUSTC_WRAPPER: none stays.

Builds on #3806 (merged). The only edit to ci/soldr_cache_report.py extracts read_report() so the ledger can reuse it.

What it adds

  • ci/cache_ledger.py: writes one record per job with job, lane, OS, arch, sha, event, versions, wrapper state, counters, deduplicated miss reasons, eligible_hit_rate and layers. Bypassed with no compilations is n/a (bypassed), never 0%. Bypassed with compilations is scoped to non-Rust.
  • ci/cache_baseline.py: rolls ledgers up per lane and event and prints the true n. Runs from before the ledger fall back to their job logs.
  • .github/actions/job-cache-ledger: artifact upload and summary line. Its steps are continue-on-error, because the gate rejects that key in gated jobs themselves. It is named so test_ci_toml's actions/cache match does not fire.
  • Wired into Fast Gate, Rust Tests (macOS, Windows) and the Tier 2 Linux build. The Tier 2 build also gets a step recording its start time, because its restored zccache directory may carry earlier runs' journals.

Baseline

40 successful runs from 2026-11-07 and just before: 20 merge_group and 20 master push, 695 job records. All of it is log backfill, since no run has a ledger artifact yet.

lane event n eligible hit rate hits / misses median wall
Tier 2 Linux (build) merge_group 12 99.2% non-Rust (≥) 19977 / 163 4.8 min
Tier 2 Linux (build) push 20 93.2% non-Rust (≥) 30642 / 2228 5.5 min
Fast Gate merge_group 20 n/a (bypassed) - 4.8 min
Fast Gate push 20 n/a (bypassed) - 8.8 min
Rust Tests macOS push 12 n/a (bypassed) - 7.9 min
Rust Tests Windows push 13 n/a (bypassed) - 7.5 min
Rust Tier 2 macOS push 12 C/C++ not measured - 12.7 min
Rust Tier 2 Windows push 13 C/C++ not measured - 9.3 min

(≥): changed paths are unknown in logs, so no miss was excluded and the rate is a lower bound.

  • The push 93.2% is dominated by one cold run, 42299017560 (0 hits / 1823 misses). Without it the pool is 30642 / 405, or 98.7%. I did not establish why that run was cold.
  • The tool prints n/a (bypassed) for Rust Tier 2 macOS and Windows; the table above corrects that by hand. Those lanes compile C/C++ but print no counters, so they are unmeasured rather than bypassed.
  • The sample is successful runs only, so failed and cancelled runs are excluded.

Restore layers across the same logs (Linux lanes that print the table, 122 setup tables; cook-cache-base 65):

layer HIT MISS mean restore
solo-toolchain-cache 82 0 9.3 s
soldr-mini-cache 104 18 1.4 s
cargo-registry-legacy-v1 98 24 16.1 s
cook-cache-base 37 28 24.4 s
setup-cache 0 122 0.2 s

Not measured yet

  • Miss reasons and the changed-inputs exclusion: both need journal rows, which logs do not contain. The first ledger artifacts are the first data.
  • Whether .tier2-zccache/history/*/compile_journal.jsonl exists in CI is unproven. If not, the Tier 2 ledger reports counter_source: soldr-report or none rather than zccache's counters.
  • setup-phase-summary's layout is unverified, so the record keeps it verbatim and live layers may be empty until it is mapped. The layer table above comes from logs.
  • Transitive header changes are not attributed to changed inputs, so the eligible rate stays a lower bound.
  • Rust Tier 2 macOS and Windows have no uv step and no ledger; other lanes (Ubuntu, cross, Qt) are timing only.

Tests

RED (937729b): ModuleNotFoundError: No module named 'cache_baseline'.
GREEN: python -m unittest discover -s ci -p test_cache_ledger.py runs 43 tests, OK; test_soldr_cache_report.py runs 13, OK; ./lint passes. No Rust tests changed. No network in tests.

Refs #3806

🤖 Generated with Claude Code

niteris and others added 9 commits November 6, 2026 20:41
Nothing in CI reported whether the S3 remote cache was helping, so 'are we
getting hits' had no answer. soldr already writes per-session stats; this
step rolls them up into the job summary (hit rate, hits/misses, time saved,
compilations). A second step on master/linux summarises the Spaces bucket
with the same credentials so the 50G watermark is visible, not inferred.

Both steps are fail-open: missing stats or credentials print a line and exit 0
rather than failing a build.
The step's top-level parser, moved verbatim into ci/soldr_cache_report.py,
prints 0.0% (0 hits / 0 misses) for a real session with one hit, because soldr
nests every counter under last_session.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
soldr nests its counters under last_session, so the report printed 0.0% (0/0)
on every build. ci/soldr_cache_report.py now reads last_session, reports status,
errors, zccache version and session source, and says n/a instead of 0% when
SOLDR_RUSTC_WRAPPER=none bypasses the Rust cache or nothing compiled.

The steps also could not run where the PR put them: macos-build runs only on
full builds and has no matrix.os, so the S3 step's condition was never true.
Add the report to rust-tests-linux and move the S3 step there, guarded by
command -v aws. macos-build now installs uv when native reuse did not.

test_ci_proptest_regressions.py treated every summary-writing step in those
jobs as a seed step; narrow it to the proptest steps it is about.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Dedupe, eligible-rate math with the changed-inputs exclusion, bypassed labelling
and fail-open on malformed input. Fails here: the modules do not exist yet.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
ci/cache_ledger.py writes one JSON record per job: identity, soldr and zccache
versions, wrapper state, deduplicated journal counters and miss reasons, the
eligible hit rate and setup-soldr's layers. A bypassed job with no compilations
is n/a, never 0%. ci/cache_baseline.py rolls those up per lane and event, using
job logs for runs that predate the ledger, and prints the true sample size.

Fast Gate, Rust Tests on macOS and Windows, and the Tier 2 Linux build upload a
ledger. The composite action's steps are fail-open and change no cache setting.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
ci/test_no_sys_path_edits.py rejects the path edit; discover -s ci provides it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Split the journal line parser out of read_journals (C901) and drop an unused noqa.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	.github/workflows/build-project.yaml
#	ci/soldr_cache_report.py
@zackees
zackees added this pull request to the merge queue Nov 7, 2026
Merged via the queue into master with commit 19da800 Nov 7, 2026
39 checks passed
@zackees
zackees deleted the ci/cache-ledger branch November 7, 2026 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants