Skip to content

build: name the dying command when the cache wrapper fails - #201

Merged
hyperb1iss merged 2 commits into
mainfrom
nova/loud-cache-wrapper
Aug 17, 2026
Merged

build: name the dying command when the cache wrapper fails#201
hyperb1iss merged 2 commits into
mainfrom
nova/loud-cache-wrapper

Conversation

@hyperb1iss

@hyperb1iss hyperb1iss commented Aug 17, 2026

Copy link
Copy Markdown
Owner

💜 What

One ERR trap in scripts/cargo-cache-build.sh: when anything in the wrapper's setup phase dies under set -e, stderr now carries the exit code, the line number, and the exact command. Successful runs produce no new output.

🔮 Why

The Rust Check / Shared CI job has failed six times in one day with the same signature — roughly 90 seconds in, exit 1, and literally zero output between the env group and the error line. Every rerun passes. The wrapper's setup phase (cache probes, sccache config locking) is silent by design, so whatever dies leaves no name behind. The next occurrence will identify itself, which converts the flake sidequest from guesswork into a one-line fix.

The trap covers exactly the silent region: the script hands off to the wrapped command with exec, so wrapped-command failures were never the silent ones — cargo reports those itself.

🧪 Verification

bash -n clean. A passing invocation (cargo --version) produces byte-identical output to before. Injecting a false into the setup phase of a copy produces cargo-cache-build.sh: exit 1 at line 31: false on stderr where the unpatched script says nothing.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved error reporting for build and test script failures.
    • Failure messages now include the script name, command, exit status, and line number, making troubleshooting faster and clearer.

The wrapper runs under set -euo pipefail with a silent setup phase,
so any probe or lock failure exits with a bare code and zero output.
CI's Rust Check / Shared job has died that way six times in one day
(~90 seconds in, exit 1, nothing between the env group and the error
line), and every rerun passes, so the cause is invisible.

An ERR trap now prints the exit code, line, and command to stderr.
Successful runs stay exactly as quiet as before.

Co-Authored-By: Nova (Claude Fable 5) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ab6c8543-bcb0-47a6-92e6-78e7ec65d052

📥 Commits

Reviewing files that changed from the base of the PR and between f8eeeb1 and 8b9c0d3.

📒 Files selected for processing (3)
  • scripts/cargo-cache-build.sh
  • scripts/tests/cargo-cache-build-tests.sh
  • scripts/tests/cargo-target-gc-tests.sh

Included review availability: Your plan includes up to 1 review per rolling hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Three shell scripts now report failure diagnostics when set -e terminates execution. The diagnostics include the script name, exit status, line number, and failed command.

Changes

Failure diagnostics

Layer / File(s) Summary
ERR trap reporting
scripts/cargo-cache-build.sh, scripts/tests/cargo-cache-build-tests.sh, scripts/tests/cargo-target-gc-tests.sh
Each script adds an ERR trap that writes failure details to standard error.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to 8b9c0

This localized change only improves failure diagnostics in the cache wrapper while preserving successful-run output, so no actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: reporting the failing command when the cache wrapper exits with an error.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

The CI failure timeline shows the silent exit-1s land in the
build-wrapper-test step, not the clippy step they were first blamed
on: the clippy step completes half an hour before the silent death in
the affected runs, and the wrapper test suites run under set -e with
no trap of their own. Both suites now carry the same ERR trap as the
wrapper. Intentional failure assertions run inside conditionals,
where bash suppresses ERR, so expected failures stay quiet and only
unguarded deaths get named.

Co-Authored-By: Nova (Claude Fable 5) <noreply@anthropic.com>
@hyperb1iss
hyperb1iss merged commit 277ee82 into main Aug 17, 2026
32 checks passed
@hyperb1iss
hyperb1iss deleted the nova/loud-cache-wrapper branch August 17, 2026 12:10
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.

1 participant