From 10ebfcddfa2fdf52dc027a3a4fec3e19324cc00a Mon Sep 17 00:00:00 2001 From: Albert Hui Date: Mon, 3 Aug 2026 02:34:51 +0800 Subject: [PATCH] fix(ci): pin the nightly that renders the public-api baselines The workflow pinned `cargo-public-api` to 0.52.0 with a comment saying that keeps its "textual output format stable across CI runs". It does not, on its own: cargo-public-api renders from rustdoc JSON, so the nightly producing that JSON decides the output text as much as the tool version does -- and the nightly was installed unpinned. A recent nightly moved `io` into `core`, so the renderer began emitting `core::io::error::Error` where the committed baseline says `std::io::error::Error`. The gate went red reporting a public API change on an API that had not changed at all. Pinning nightly-2026-05-12 restores reproducibility. Verified rather than assumed: `rustc +nightly-2026-05-12 --version` is `1.97.0-nightly (64a965e90 2026-05-11)`, and regenerating every baseline in this repo with it diffs against the committed files by zero lines. Note the off-by-one -- rustc reports the commit date, one day behind the toolchain name, so 2026-05-11 would have been the wrong pin. No baseline changes are needed, because the pin selects the toolchain the baselines were generated with. Bumping NIGHTLY from here is a deliberate act that regenerates the baselines in the same commit; moving one without the other is what produced this failure. Fleet-wide: all 10 repos with a public-api workflow floated nightly. Three had already fired; the other seven are green only because their public APIs contain no `io` types, so there was nothing to re-render. This applies the same pin to all of them. --- .github/workflows/public-api.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/public-api.yml b/.github/workflows/public-api.yml index e8aca2c..267d47f 100644 --- a/.github/workflows/public-api.yml +++ b/.github/workflows/public-api.yml @@ -20,15 +20,21 @@ jobs: public-api: runs-on: ubuntu-latest env: - # Pin the tool so its textual output format is stable across CI runs (matches - # the version used to generate the committed baselines). + # The committed baselines are only reproducible if BOTH inputs are pinned. + # cargo-public-api renders from rustdoc JSON, so the nightly that produces + # that JSON decides the output text just as much as the tool version does: + # a floating nightly rewrote `std::io::error::Error` to `core::io::error::Error` + # and reddened this gate on an API that had not changed at all. + # Bumping NIGHTLY is therefore a deliberate act that regenerates the + # baselines in the same commit -- never one without the other. CARGO_PUBLIC_API_VERSION: "0.52.0" + NIGHTLY: "nightly-2026-05-12" OMIT: "blanket-impls,auto-trait-impls,auto-derived-impls" steps: - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 - uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable - name: Install nightly (cargo-public-api needs rustdoc JSON) - run: rustup toolchain install nightly --profile minimal + run: rustup toolchain install "$NIGHTLY" --profile minimal - uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1 - name: Install cargo-public-api run: cargo install cargo-public-api --locked --version "$CARGO_PUBLIC_API_VERSION" @@ -37,7 +43,7 @@ jobs: fail=0 for crate in blob-decoder; do echo "::group::$crate" - cargo public-api -p "$crate" --all-features --omit "$OMIT" > "/tmp/$crate.txt" + cargo "+$NIGHTLY" public-api -p "$crate" --all-features --omit "$OMIT" > "/tmp/$crate.txt" if ! diff -u "public-api/$crate.txt" "/tmp/$crate.txt"; then echo "::error::Public API of $crate changed. If intentional, regenerate the baseline in this PR:" echo " cargo public-api -p $crate --all-features --omit $OMIT > public-api/$crate.txt"