Skip to content

[High] Git hooks & CI hygiene — rustfmt paths, openapi sha256, missing pre-push, unconsumed .secrets.baseline #5664

Description

@houko

Severity: High · Domain: CI / hooks

Merges 4 git-hook / CI hygiene findings under one tracking item.

Sub-findings rollup

# Description Location
1 pre-commit uses unquoted $STAGED_RS + grep; files with spaces or glob characters get word-split scripts/hooks/pre-commit:25-30
2 The openapi-sha check in pre-commit only calls shasum; no fallback on sha256sum-only environments (typical Linux dev boxes) scripts/hooks/pre-commit (openapi-sha section)
3 CLAUDE.md and scripts/hooks/ describe a pre-push hook, but no such file exists in the repo — docs and reality disagree CLAUDE.md, scripts/hooks/
4 .secrets.baseline exists but CI never calls detect-secrets; only pre-commit soft-warns .github/workflows/, .secrets.baseline

Why merged

All four are git-hook / CI hygiene items concentrated in scripts/hooks/ + .github/workflows/; a single sweep is more efficient than 4 separate PRs.

Combined fix plan

  1. NUL-delimited xargs for the rustfmt staged-files loop:
    git diff --cached --name-only --diff-filter=ACM -z \
      | grep -z '\.rs$' \
      | xargs -0 -r rustfmt --check --edition 2021
  2. shasum / sha256sum interop:
    sha256() { command -v sha256sum >/dev/null && sha256sum "$@" || shasum -a 256 "$@"; }
  3. pre-push file: either actually implement pre-push and commit it to scripts/hooks/pre-push (preferred — runs cargo clippy --workspace --all-targets -- -D warnings + openapi/SDK drift), or delete its description from CLAUDE.md.
  4. Wire detect-secrets into CI: add .github/workflows/secrets.yml running detect-secrets scan --baseline .secrets.baseline; fail the PR on diff.

Tests

  • scripts/tests/pre-commit-spaces.sh: stage with space.rs containing bad formatting; the hook rejects.
  • scripts/tests/pre-commit-sha-fallback.sh: mock shasum out of PATH → openapi check still runs.
  • pre-push file exists + CI assertion.
  • A deliberate secret-bearing commit makes the secrets workflow fail.

Metadata

Metadata

Assignees

No one assigned

    Labels

    has-prA pull request has been linked to this issueneeds-triageAuto-applied when the issue title/body matched no area label — needs maintainer review

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions