Skip to content

fix(ci): remove rust-cache — re-keying buys one cold run, then PRs go red again - #424

Merged
athvin merged 2 commits into
mainfrom
bm/ci-drop-rust-cache
Nov 3, 2026
Merged

athvin merged 2 commits into
mainfrom
bm/ci-drop-rust-cache

Conversation

@athvin

@athvin athvin commented Nov 3, 2026 •

Copy link
Copy Markdown
Owner

The prediction this PR recorded has resolved, and it is structural

#422 fixed the red main by bumping prefix-key to v2-rust, and main went green — but on the cold run, which both readings of the bug predict. I held this PR back to docs-only rather than override a just-merged fix, and wrote down the single observation that would settle it: the first run to actually RESTORE the v2 entry.

That run has happened — PR #423, unchanged Cargo.toml:

Cache hit for: v2-rust-rust-Linux-x64-8556beb2-11e7c23f
Restored from cache key "v2-rust-..." full match: true.
error: failed to run custom build command for `libduckdb-sys v1.20000.1`
  unpacking bundled DuckDB sources: Os { code: 39, kind: DirectoryNotEmpty }

full match: true is the whole point. The rust-cache key matched exactly; what did not match is cargo's own fingerprint for the build script, which that key does not model. Two different notions of "this cache is valid", and only one of them is checked. A prefix bump therefore buys exactly one cold green run per bump — 8578f995 was that run — and the next restore breaks again, on PRs as well as main. PRs are red right now.

The fix

rust-cache out of all seven sccache-backed compile jobs. sccache is content-addressed per compilation unit and never touches target/, so it cannot fail this way, and it was already carrying the work: two runs with No cache found. finished in 8m03/8m45 at a 99% hit rate while this entry held ~1.3 GB. Not assumed — the no-cache run measured 8–13m per job, in line with the sharded baseline.

coverage keeps its entry (it opts out of sccache, so the 1.8 GiB-vs-timeout trade still applies there). Knock-on: nothing in the Rust gate writes the Actions cache now, so the single-writer rule retires with it.

build-cost.md carries the full incident, including the detail that makes this class so confusing: the commit that poisons the cache passes, and the next unrelated PR wears the failure.

🤖 Generated with Claude Code

#422 fixed the red main by bumping prefix-key to v2. This writes down the
trail — including that the poisoning commit PASSES and the next unrelated
PR wears it, which is what made it look like those PRs' fault — and states
the one open question as an observation rather than an argument.

The mechanism needs only a restored populated out/ plus a fingerprint
mismatch, and this repo's jobs legitimately differ in fingerprint (lint is
the sole writer; test, the lake shards and the e2e slices each select
different packages and features). So either the mismatch only arises at a
dependency bump (v2 holds) or lint's tree can never satisfy the others
(v2 breaks on first restore). The discriminating observable is the next
main run with an unchanged Cargo.toml; the remedy if it is red is recorded
with it.

Co-Authored-By: Claude Fable 5 <[email protected]>
@athvin
athvin force-pushed the bm/ci-drop-rust-cache branch from 11fb973 to 4e3e9f5 Compare November 3, 2026 02:15
@athvin athvin changed the title fix(ci): drop rust-cache — a restored partial target is breaking main docs(ci): record the rust-cache poisoning incident and what settles it Nov 3, 2026
…entically

The prediction recorded in the previous commit resolved to structural, and
PRs are red again. #423's run, unchanged Cargo.toml, restored the v2 entry
and panicked the same way:

  Cache hit for: v2-rust-rust-Linux-x64-8556beb2-11e7c23f
  Restored from cache key "v2-rust-..." full match: true.
    unpacking bundled DuckDB sources: Os { code: 39, DirectoryNotEmpty }

`full match: true` is the point. The rust-cache KEY matched exactly; what
did not match is cargo's own fingerprint for the build script, which that
key does not model — two different notions of "valid cache", only one of
them checked. So a prefix bump buys exactly one cold green run per bump
(8578f99 was that run) and the next restore breaks again.

rust-cache therefore comes out of all seven sccache-backed compile jobs.
sccache is content-addressed per compilation unit and never touches
`target/`, so it cannot fail this way, and it was already doing the work:
two runs with `No cache found.` at a 99% hit rate finished in 8m03/8m45
while this entry held ~1.3 GB. Measured on this branch before the rebase:
8-13m per job, in line with the sharded baseline.

`coverage` keeps its entry — it opts out of sccache (llvm-cov owns
RUSTFLAGS), so there the trade really is 1.8 GiB against a timeout. This
also retires the single-writer rule: nothing in the Rust gate writes the
Actions cache now.

Co-Authored-By: Claude Fable 5 <[email protected]>
@athvin athvin changed the title docs(ci): record the rust-cache poisoning incident and what settles it fix(ci): remove rust-cache — re-keying buys one cold run, then PRs go red again Nov 3, 2026
@athvin
athvin merged commit 79f18f3 into main Nov 3, 2026
34 checks passed
athvin pushed a commit that referenced this pull request Nov 3, 2026
#424 cured the seven compile jobs by deleting rust-cache. `coverage` is the
one job that keeps it — deliberately, since an instrumented cold build has no
cache to fall back on and `llvm-cov` already measures 22m10 warm against a
60-minute timeout — so it is the one place the poisoning survives.

It has not fired yet, and the reason is a dated prediction rather than luck:
#376 bumped duckdb at 01:07 today, after that day's nightly. Tonight's
scheduled run therefore gets a NEW source-tree key, unpacks cleanly, passes,
and SAVES the stripped tree. The run after that restores it and dies before a
test. As ever the breakage does not land on the run that caused it.

Also corrects the mechanism in the seven `# No rust-cache` comments. They say
a restored target carries a populated `build/libduckdb-sys-*/out`, which is
where I sent two wrong fixes: `libduckdb-sys` does not unpack into `OUT_DIR`
at all. `src/build_paths.rs:40` walks UP from it to a tree shared across the
target dir, `target/duckdb-sources/<key>/`, guarded by a `.complete` dotfile.
Absent sentinel, the script unpacks to a staging dir and `fs::rename`s it over
`<key>/` — ENOTEMPTY, Linux errno 39. `fs::rename` in `publish()` is the only
syscall in that function that can return 39, so the panic's
"unpacking bundled DuckDB sources" names the wrong operation.

The deleting fix does not depend on that distinction, but the comments explain
why rust-cache is absent, and someone re-adding a target-dir cache will read
them. The repair's own condition is the build script's precondition, so an
intact tree keeps the fast path, and it echoes per tree because both earlier
attempts went green having done nothing.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
athvin added a commit that referenced this pull request Nov 3, 2026
#424 cured the seven compile jobs by deleting rust-cache. `coverage` is the
one job that keeps it — deliberately, since an instrumented cold build has no
cache to fall back on and `llvm-cov` already measures 22m10 warm against a
60-minute timeout — so it is the one place the poisoning survives.

It has not fired yet, and the reason is a dated prediction rather than luck:
#376 bumped duckdb at 01:07 today, after that day's nightly. Tonight's
scheduled run therefore gets a NEW source-tree key, unpacks cleanly, passes,
and SAVES the stripped tree. The run after that restores it and dies before a
test. As ever the breakage does not land on the run that caused it.

Also corrects the mechanism in the seven `# No rust-cache` comments. They say
a restored target carries a populated `build/libduckdb-sys-*/out`, which is
where I sent two wrong fixes: `libduckdb-sys` does not unpack into `OUT_DIR`
at all. `src/build_paths.rs:40` walks UP from it to a tree shared across the
target dir, `target/duckdb-sources/<key>/`, guarded by a `.complete` dotfile.
Absent sentinel, the script unpacks to a staging dir and `fs::rename`s it over
`<key>/` — ENOTEMPTY, Linux errno 39. `fs::rename` in `publish()` is the only
syscall in that function that can return 39, so the panic's
"unpacking bundled DuckDB sources" names the wrong operation.

The deleting fix does not depend on that distinction, but the comments explain
why rust-cache is absent, and someone re-adding a target-dir cache will read
them. The repair's own condition is the build script's precondition, so an
intact tree keeps the fast path, and it echoes per tree because both earlier
attempts went green having done nothing.

Co-authored-by: bmoore813 <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
@athvin
athvin deleted the bm/ci-drop-rust-cache branch November 3, 2026 03:11
athvin added a commit that referenced this pull request Nov 5, 2026
…g it (#499)

Re-ran the three CUR probes against the November partition. One probe is
unchanged and the spend underneath it is not.

Split cost allocation is still producing nothing: 0 non-null out of 19,770
November rows, three days after the first probe said the same. Three more
days of pod-level cost are permanently unrecoverable.

The thing the re-run was not looking for is that November is on pace for
roughly six times October. $160.47 in five days against $184.23 for all of
October. S3 was not in October's top five; in November it is $76.27, and all
of it is one line: 837 GB of `USE2-DataTransfer-Out-Bytes` from
`er-ci-sccache` at $0.090/GB. That is internet egress — GitHub-hosted runners
are not in the VPC, so a Gateway Endpoint cannot help and every sccache read
leaves the region at the public rate.

Nov 4 isolates the cause for free: that is the day the Actions billing block
stopped CI running, and it egressed $0.00 against a $21.55 total. A day with
no CI costs ~$20 and ships nothing; a day with CI costs $32-52 and the whole
difference is this line. Nov 1 reads as $0.03 only because the first 100 GB a
month is free, which was consumed during Nov 2.

This is the price of the CI speedup and it was never measured. #424 removed
rust-cache, which made sccache the only cache; the test job was then sharded,
which multiplied the runners each pulling from it; and the hit rate is ~99%,
so nearly every compilation unit downloads its object. PR wall time went
32-35 min to ~10 min. At ~$31 per CI day that is ~$600-900/month against a
$600 budget that breaches mid-month.

The baseline rose independently too — EC2 from ~$1.50/day to ~$7.60/day —
which is the observability stack, the second web-api Deployment from #461 and
the dispatcher. Real, new, and not sccache.

Recorded as a decision with four options rather than a fix, because trading
25 minutes of wall clock for this is a judgement call and the defect was not
knowing the number. The one thing the doc rules out is emptying the bucket: a
cold sccache costs a 42-minute PR, which is what it was built to fix.

Co-authored-by: bmoore813 <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
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.

2 participants