From b9411b1dbefef55b13e8bbf75b30d0b74e2f52a2 Mon Sep 17 00:00:00 2001 From: Carlos Medeiros Date: Mon, 22 Jun 2026 14:02:50 +0100 Subject: [PATCH] fix(ledger): re-checkout app/rust/.cargo/config.toml after Rust cache restore The Rust dependency cache stores ${cargo_home} = app/rust/.cargo, which includes the tracked config.toml. actions/cache restores it *after* checkout, so a cache from before the nightly migration overwrites the checked-out config.toml with a pre-migration copy that still sets build-std-features = ["panic_immediate_abort"]. nightly-2025-12-05 rejects that (it is now the immediate-abort panic strategy, not a build-std feature), so build_ledger/build_package fail to compile core. Re-checkout the committed config.toml from HEAD right after each Rust cache restore so the in-repo config always wins. Survives existing poisoned caches without needing them deleted. --- .github/workflows/_ledger_main.yml | 48 ++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/.github/workflows/_ledger_main.yml b/.github/workflows/_ledger_main.yml index bb76417..b7e6001 100644 --- a/.github/workflows/_ledger_main.yml +++ b/.github/workflows/_ledger_main.yml @@ -121,6 +121,14 @@ jobs: restore-keys: | ${{ runner.os }}-rust-${{ runner.arch }}- ${{ runner.os }}-rust- + - name: Restore tracked cargo config (cache may carry a pre-migration copy) + if: ${{ inputs.has-rust }} + run: | + git config --global --add safe.directory "$GITHUB_WORKSPACE" + if git -C "$GITHUB_WORKSPACE" ls-files --error-unmatch app/rust/.cargo/config.toml >/dev/null 2>&1; then + git -C "$GITHUB_WORKSPACE" checkout -- app/rust/.cargo/config.toml + echo "Restored app/rust/.cargo/config.toml from checkout (a stale Rust cache can overwrite it with a pre-migration copy)." + fi - name: Install rust-src component if: ${{ inputs.has-rust }} run: rustup component add rust-src --toolchain ${{ inputs.rust-version }}-x86_64-unknown-linux-gnu @@ -268,6 +276,14 @@ jobs: restore-keys: | ${{ runner.os }}-rust-${{ runner.arch }}- ${{ runner.os }}-rust- + - name: Restore tracked cargo config (cache may carry a pre-migration copy) + if: ${{ inputs.has-rust }} + run: | + git config --global --add safe.directory "$GITHUB_WORKSPACE" + if git -C "$GITHUB_WORKSPACE" ls-files --error-unmatch app/rust/.cargo/config.toml >/dev/null 2>&1; then + git -C "$GITHUB_WORKSPACE" checkout -- app/rust/.cargo/config.toml + echo "Restored app/rust/.cargo/config.toml from checkout (a stale Rust cache can overwrite it with a pre-migration copy)." + fi - name: Install rust-src component if: ${{ inputs.has-rust }} run: rustup component add rust-src --toolchain ${{ inputs.rust-version }}-x86_64-unknown-linux-gnu @@ -342,6 +358,14 @@ jobs: restore-keys: | ${{ runner.os }}-rust-${{ runner.arch }}- ${{ runner.os }}-rust- + - name: Restore tracked cargo config (cache may carry a pre-migration copy) + if: ${{ inputs.has-rust }} + run: | + git config --global --add safe.directory "$GITHUB_WORKSPACE" + if git -C "$GITHUB_WORKSPACE" ls-files --error-unmatch app/rust/.cargo/config.toml >/dev/null 2>&1; then + git -C "$GITHUB_WORKSPACE" checkout -- app/rust/.cargo/config.toml + echo "Restored app/rust/.cargo/config.toml from checkout (a stale Rust cache can overwrite it with a pre-migration copy)." + fi - name: Install rust-src component if: ${{ inputs.has-rust }} run: rustup component add rust-src --toolchain ${{ inputs.rust-version }}-x86_64-unknown-linux-gnu @@ -416,6 +440,14 @@ jobs: restore-keys: | ${{ runner.os }}-rust-${{ runner.arch }}- ${{ runner.os }}-rust- + - name: Restore tracked cargo config (cache may carry a pre-migration copy) + if: ${{ inputs.has-rust }} + run: | + git config --global --add safe.directory "$GITHUB_WORKSPACE" + if git -C "$GITHUB_WORKSPACE" ls-files --error-unmatch app/rust/.cargo/config.toml >/dev/null 2>&1; then + git -C "$GITHUB_WORKSPACE" checkout -- app/rust/.cargo/config.toml + echo "Restored app/rust/.cargo/config.toml from checkout (a stale Rust cache can overwrite it with a pre-migration copy)." + fi - name: Install rust-src component if: ${{ inputs.has-rust }} run: rustup component add rust-src --toolchain ${{ inputs.rust-version }}-x86_64-unknown-linux-gnu @@ -489,6 +521,14 @@ jobs: restore-keys: | ${{ runner.os }}-rust-${{ runner.arch }}- ${{ runner.os }}-rust- + - name: Restore tracked cargo config (cache may carry a pre-migration copy) + if: ${{ inputs.has-rust }} + run: | + git config --global --add safe.directory "$GITHUB_WORKSPACE" + if git -C "$GITHUB_WORKSPACE" ls-files --error-unmatch app/rust/.cargo/config.toml >/dev/null 2>&1; then + git -C "$GITHUB_WORKSPACE" checkout -- app/rust/.cargo/config.toml + echo "Restored app/rust/.cargo/config.toml from checkout (a stale Rust cache can overwrite it with a pre-migration copy)." + fi - name: Install rust-src component if: ${{ inputs.has-rust }} run: rustup component add rust-src --toolchain ${{ inputs.rust-version }}-x86_64-unknown-linux-gnu @@ -562,6 +602,14 @@ jobs: restore-keys: | ${{ runner.os }}-rust-${{ runner.arch }}- ${{ runner.os }}-rust- + - name: Restore tracked cargo config (cache may carry a pre-migration copy) + if: ${{ inputs.has-rust }} + run: | + git config --global --add safe.directory "$GITHUB_WORKSPACE" + if git -C "$GITHUB_WORKSPACE" ls-files --error-unmatch app/rust/.cargo/config.toml >/dev/null 2>&1; then + git -C "$GITHUB_WORKSPACE" checkout -- app/rust/.cargo/config.toml + echo "Restored app/rust/.cargo/config.toml from checkout (a stale Rust cache can overwrite it with a pre-migration copy)." + fi - name: Install rust-src component if: ${{ inputs.has-rust }} run: rustup component add rust-src --toolchain ${{ inputs.rust-version }}-x86_64-unknown-linux-gnu