chore(hooks): make SBOM check advisory, fix pre-commit exec bit#126
Merged
Conversation
The pre-push hook hard-failed when the regenerated SPDX SBOM differed from the committed one, but `cargo sbom` enumerates different per-target dependency sets across tool versions (e.g. 0.10.0 lists 217 packages vs the committed 95), so the check failed spuriously for anyone whose cargo-sbom differed from whoever last committed it. The SBOM is not checked in CI or at release, so this gated pushes for no benefit. - pre-push: SBOM drift is now a warning (and restores the working tree) rather than a hard failure; fmt/check/test remain hard gates - generate-sbom.sh: pin the recommended cargo-sbom version (0.10.0) and warn on mismatch, so a real SBOM refresh is reproducible - pre-commit: mark executable (0644 -> 0755) so it actually runs; it was being silently skipped by git Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The pre-push hook hard-failed whenever the regenerated SPDX SBOM differed from the committed one. But
cargo sbomenumerates a different per-target dependency set across tool versions (0.10.0 lists 217 packages vs the committed 95), so the check failed spuriously for anyone whosecargo-sbomdiffers from whoever last committed the SBOM. The SBOM is not checked in CI or at release (grep -r sbom .github/workflows→ nothing), so this gated pushes for no benefit — forcing--no-verify.Separately,
.githooks/pre-commitwas committed non-executable (0644), so git silently skipped it and its fmt/clippy/test checks never ran.Fix
fmt/check/testremain hard gates.cargo-sbomversion (0.10.0) and warn on mismatch, so a genuine SBOM refresh is reproducible.0644 → 0755) so it actually runs.The SBOM artifact content is intentionally left unchanged (95→217 would be a compliance-scope policy change for the maintainer to make deliberately).
Test plan
--no-verify: pre-commit ran (365 tests), pre-push ran fmt/check/test and printed the SBOM warning without blocking. ✅🤖 Generated with Claude Code
https://claude.ai/code/session_01Jf8uBU8AYxkrG8fa8yo6tC