Skip to content

fix(ci): bust the rust cache — #376's duckdb bump poisoned the v1 entry - #422

Merged
athvin merged 1 commit into
mainfrom
bm/ci-duckdb-cache-bust
Nov 3, 2026
Merged

athvin merged 1 commit into
mainfrom
bm/ci-duckdb-cache-bust

Conversation

@athvin

@athvin athvin commented Nov 3, 2026

Copy link
Copy Markdown
Owner

Every Rust PR opened after #376 fails to compile, on a commit that has nothing to do with it:

error: failed to run custom build command for `libduckdb-sys v1.20000.1`
panicked at build_bundled_cc.rs:65:
  unpacking bundled DuckDB sources: Os { code: 39, kind: DirectoryNotEmpty }

libduckdb-sys unpacks the bundled C++ sources into its OUT_DIR and panics if that directory isn't empty. The saved target/ carries a populated debug/build/libduckdb-sys-<hash>/out; on restore cargo re-runs the build script but doesn't clear the directory, so every job that compiles duckdb dies before a single test runs.

Why it looks like the PR's fault

Main's run for #376 went green — all twelve test and e2e jobs. Its jobs restored the pre-bump entry, and lint, the single writer, only saved the poisoned one at the end of the run.

So the breakage never lands on the commit that caused it. It lands on every PR afterwards.

That asymmetry cost real time on #418 — an infra-only PR with no Rust in it, so six Rust failures made no sense. The sequence that eventually separated "my change" from "the cache":

  1. another open PR passing the same gate → not time-dependent
  2. git diff HEAD~1 -- Cargo.lock showing no new crates → not a new dependency
  3. main's run for the bump having run the identical jobs green → not the code

The hypothesis that looked right and wasn't: "the PR lost a race with main's cache write, so just re-run." It fails identically on a re-run, because the poisoned entry is the one being restored, not one that's missing.

#417 appears unaffected only because it touches CI files, so detect skips its Rust tier entirely.

The fix is the lever this file already documents

"prefix-key makes the v0 entries unreachable (restore-keys are prefixed too) so they age out instead of being downloaded for nothing."

Same situation, same remedy: v1 → v2, so no partial restore can resurrect the poisoned entry. One cold cycle, then normal.

All eight occurrences move together — the lint writer and the seven restore-only jobs. Bumping only the writer would leave every other job restoring v1, which is the broken state with extra steps.

The three remaining v1-rust strings in the file are prose about historical cache sizes and are intentionally untouched.

Not fixed here, deliberately

.github/workflows/shared/rust-gate.md and the two *.lock.yml files generated from it still carry v1-rust, so the agentic workflows will hit the same panic. They aren't required checks, so that's noise rather than a block — and their lock files are generated artifacts, which I'm not going to hand-edit. Bumping the .md and recompiling with gh-aw belongs to whoever owns that workflow.

Verification

This PR's own Rust jobs are the test: they will be the first to build against v2-rust with nothing to restore. If they go green, the poisoning is gone.

🤖 Generated with Claude Code

Every Rust PR opened after #376 fails to compile, on a commit that has nothing
to do with it:

    error: failed to run custom build command for `libduckdb-sys v1.20000.1`
    panicked at build_bundled_cc.rs:65:
      unpacking bundled DuckDB sources: Os { code: 39, kind: DirectoryNotEmpty }

`libduckdb-sys` unpacks the bundled C++ sources into its `OUT_DIR` and panics
if that directory is not empty. The saved `target/` carries a populated
`debug/build/libduckdb-sys-<hash>/out`; on restore cargo re-runs the build
script but does not clear the directory, so every job that compiles duckdb
dies before a single test runs.

## Why it looked like the PR's fault

Main's run for #376 went GREEN — all twelve test and e2e jobs. Its jobs
restored the PRE-bump entry, and `lint`, the single writer, only saved the
poisoned one at the end of the run. So the breakage never lands on the commit
that caused it; it lands on every PR afterwards.

That asymmetry cost real time on #418 (an infra-only PR with no Rust in it, so
six Rust failures made no sense). The sequence that eventually distinguished
"my change" from "the cache" was: another open PR passing the same gate →
`git diff HEAD~1 -- Cargo.lock` showing no new crates → main's run for the bump
having run the identical jobs green. Each step eliminated a hypothesis that
otherwise looks plausible. The one that looked right and was not: "the PR lost
a race with main's cache write, so just re-run" — it fails identically on a
re-run, because the poisoned entry is the one being restored, not a missing one.

#417 appears unaffected only because it touches CI files, so `detect` skips its
Rust tier entirely.

## The fix is the lever the file already documents

"`prefix-key` makes the v0 entries unreachable (restore-keys are prefixed too)
so they age out instead of being downloaded for nothing." Same situation, same
remedy: v1 -> v2, so no partial restore can resurrect the poisoned entry. One
cold cycle, then normal.

All EIGHT occurrences move together — the `lint` writer and the seven
restore-only jobs. Bumping only the writer would leave every other job
restoring v1, which is the broken state with extra steps.

## Not fixed here, deliberately

`.github/workflows/shared/rust-gate.md` and the two `*.lock.yml` files
generated from it still carry `v1-rust`, so the agentic workflows will hit the
same panic. They are not required checks, so this is noise rather than a block
— and their lock files are generated artifacts, which I am not going to
hand-edit. Bumping the `.md` and recompiling with gh-aw belongs to whoever owns
that workflow.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@athvin
athvin merged commit 8578f99 into main Nov 3, 2026
34 checks passed
@athvin
athvin deleted the bm/ci-duckdb-cache-bust branch November 3, 2026 01:58
athvin pushed a commit that referenced this pull request Nov 3, 2026
#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 added a commit that referenced this pull request Nov 3, 2026
… red again (#424)

* docs(ci): record the rust-cache poisoning incident and what settles it

#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]>

* fix(ci): remove rust-cache — v2 was restored full-match and failed identically

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]>

---------

Co-authored-by: bmoore813 <[email protected]>
Co-authored-by: Claude Fable 5 <[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