From f9f25c9df603d54ced2f349fe4b0824d9cb4adca Mon Sep 17 00:00:00 2001 From: KeyCode17 Date: Sat, 8 Aug 2026 07:58:09 +0700 Subject: [PATCH] ci: stop the publish job's cache save from erroring on package scratch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The v1.10.0 publish job succeeded but posted red annotations: Error: ENOENT: no such file or directory, opendir '.../target/package/pxsolver-cache-1.10.0/tests/trybuild' Nothing is wrong with those crates. `cargo publish` leaves scratch in target/package/-/, and for any crate shipping a tests/ dir that scratch contains a directory named `tests`. rust-cache's save-time cleanup treats every such directory as a possible nested test workspace and recurses into tests/target and tests/trybuild — a carve-out for trybuild and macrotest. Neither path exists here; this workspace has no trybuild dependency at all. The recursion is not awaited inside its own try/catch (Swatinem/rust-cache src/cleanup.ts, cleanProfileTarget), so the ENOENT never reaches the catch and escapes as an unhandled rejection. That is why it renders as a failure annotation on a job that succeeded, and why it named a nondeterministic subset — cache, camoufox and native out of the six published crates that carry tests/. Publish scratch is single-use and worthless in the cache, and pre-flight already populates the same key, so the job now restores without saving. That removes the failing code path instead of racing it. --- .github/workflows/release.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4061999..f2d7769 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -182,7 +182,24 @@ jobs: - uses: dtolnay/rust-toolchain@master with: toolchain: "1.95" + # Restore only, never save. + # + # `cargo publish` leaves its scratch in `target/package/-/`, + # and for any crate shipping a `tests/` dir that scratch contains a + # directory literally named `tests`. rust-cache's save-time cleanup + # descends into every such directory and recurses into `tests/target` + # and `tests/trybuild` (a carve-out for trybuild/macrotest artifacts). + # Neither path exists here — this workspace has no trybuild dependency — + # and the recursion is *not* awaited inside its own try/catch, so the + # ENOENT escapes as an unhandled rejection: red annotations on a job + # that actually succeeded, on a nondeterministic subset of crates. + # + # Publish scratch is single-use and worth nothing in the cache, and + # `pre-flight` already populates it from the same key, so declining to + # save removes the failing code path outright rather than racing it. - uses: Swatinem/rust-cache@v2 + with: + save-if: false # Publish strategy (ported from rust-ai-surfer): # * `cargo search` is the skip-check (no User-Agent header drama like