From ea456e7027fe36b81e0023ce68820b5e5c72033f Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Tue, 4 Aug 2026 21:44:08 +0000 Subject: [PATCH] fix(ci): treat .docker/ as a shared build input #11346 changed how ROCm llama.cpp compiles and built nothing. It touched .docker/llama-cpp-build-target.sh and scripts/build/llama-cpp-build-target_test.sh, no SHARED_BUILD_INPUTS rule matched either (the second is carved out on purpose), so the filter selected zero entries and all six backend job groups reported "skipping". The fix shipped to master unvalidated. .docker/ holds the per-backend compile and build-target scripts for llama-cpp, turboquant, bonsai and ik-llama-cpp, plus inputs every Dockerfile consumes (apt-mirror.sh, install-base-deps.sh). Those files decide how a backend is compiled, so a change to one can only be validated by rebuilding it. Take the same posture the scripts/build/ catch-all already takes, and for the reason its comment already gives: a shared build input silently shipping to nothing is the failure this list exists to prevent. A rule sees only the matrix entry, not which file matched it, so narrowing .docker/-compile.sh to the backend named by its prefix would mean threading the filename through matchedSharedRules. Not worth it for files edited a handful of times a release. Two regression tests, both verified red against the unfixed filter: one asserting a .docker/ compile script selects the backend it compiles, one asserting a shared .docker/ input takes the full matrix. Signed-off-by: Ettore Di Giacinto Assisted-by: Claude Code:claude-opus-5 [Read] [Edit] [Bash] --- scripts/lib/backend-filter.mjs | 21 +++++++++++++++++++++ scripts/lib/backend-filter_test.mjs | 23 +++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/scripts/lib/backend-filter.mjs b/scripts/lib/backend-filter.mjs index 21c2800e4..90b4b987c 100644 --- a/scripts/lib/backend-filter.mjs +++ b/scripts/lib/backend-filter.mjs @@ -436,6 +436,27 @@ export const SHARED_BUILD_INPUTS = [ linux: always, darwin: always, }, + { + // Same posture as the scripts/build/ catch-all above, and for the same + // reason. .docker/ holds the per-backend compile and build-target scripts + // (llama-cpp, turboquant, bonsai, ik-llama-cpp) plus inputs every + // Dockerfile consumes (apt-mirror.sh, install-base-deps.sh). Nothing + // matched any of them before, which is how #11346 shipped without a single + // backend job: it changed how ROCm llama.cpp compiles, touching only + // .docker/llama-cpp-build-target.sh and a `*_test.sh` that the rule above + // deliberately carves out, so the filter selected zero entries and every + // backend job reported "skipping". + // + // A rule cannot see which file matched it, only the matrix entry, so + // narrowing `.docker/-compile.sh` to the backend named by its prefix + // would mean threading the filename through matchedSharedRules. Until + // someone wants that, take the full matrix: these files are edited a + // handful of times a release, and a shared build input silently shipping + // to nothing is the failure this list exists to prevent. + matches: file => file.startsWith(".docker/"), + linux: always, + darwin: always, + }, ]; // The matrix stores dockerfiles as "./backend/Dockerfile.python"; changed-file diff --git a/scripts/lib/backend-filter_test.mjs b/scripts/lib/backend-filter_test.mjs index f419afd3a..897665bfe 100644 --- a/scripts/lib/backend-filter_test.mjs +++ b/scripts/lib/backend-filter_test.mjs @@ -204,6 +204,29 @@ test("an unclassified scripts/build/ file conservatively rebuilds everything", ( assert.equal(filteredDarwin.length, includesDarwin.length); }); +// #11346 changed how ROCm llama.cpp compiles and built nothing: it touched only +// .docker/llama-cpp-build-target.sh and a *_test.sh, no rule matched either, so +// every backend job reported "skipping". +test("a .docker/ compile script rebuilds the backends it compiles", () => { + const { filtered } = run([ + ".docker/llama-cpp-build-target.sh", + "scripts/build/llama-cpp-build-target_test.sh", + ]); + + assert.ok(filtered.length > 0, ".docker/ change selected no entries"); + assert.ok( + filtered.some(e => e.backend === "llama-cpp"), + "llama-cpp was not selected by a change to its own compile script", + ); +}); + +test("a shared .docker/ input rebuilds everything", () => { + const { filtered, filteredDarwin } = run([".docker/apt-mirror.sh"]); + + assert.equal(filtered.length, includes.length); + assert.equal(filteredDarwin.length, includesDarwin.length); +}); + test("tests for the packaging scripts do not rebuild anything", () => { const { filtered, filteredDarwin } = run([ "scripts/build/package-gpu-libs_test.sh",