Skip to content

M32 (TASK-81): Official GitHub Action (verity-scan-action@v1) & Pre-Commit Hooks

Purpose & Architectural Decisions

  • Zero-Friction Pre-Commit Hooks: Ship .pre-commit-hooks.yaml at repo root exposing verity-scan, verity-scan-configs, and verity-scan-uvx (all defaulting to --offline with pass_filenames: true multi-file routing).
  • CI Composite Action Alignment: Ensure README.md documents .pre-commit-config.yaml and JMartynov/verity-scan-action@v1 using pinned actions (actions/checkout@v5, astral-sh/setup-uv@v6, actions/cache@v4, github/codeql-action/upload-sarif@v3) with all CLI commands validated by test_documentation_parity.py.
  • Open-Core Isolation: Private verity-pro capabilities are never bundled into pre-commit or Action defaults.

Target Files

File Change
.pre-commit-hooks.yaml Define verity-scan, verity-scan-configs, and verity-scan-uvx hooks
action.yml Composite GitHub Action (setup-uv@v6, actions/cache@v4, single-pass JSON/SARIF/summary, diff-pr, RUNNER_TEMP isolation, branding:)
.github/workflows/test_action.yml Self-test workflow covering clean-scan, vulnerable-scan, sarif-validation, offline-scan, diff-pr-scan
README.md, docs/cli/reference.md, docs/getting-started/{installation,quickstart}.md, docs/index.md Document .pre-commit-config.yaml (rev: v0.2.3) and live JMartynov/verity-scan-action@v1
tests/unit/test_precommit_hooks.py Validate hook schema, --offline defaults, and build_parser() flag compatibility
tests/unit/test_documentation_parity.py Validate README YAML pre-commit & Action CLI snippets
tests/unit/test_workflow_hygiene.py Validate action.yml and .github/workflows/test_action.yml contracts

Delivered Artifacts

  • Release target: v0.2.3 (verity-redteam-core==0.2.3)
  • Live Action repo: JMartynov/verity-scan-action@v1 (v1.0.0 / v1)
  • Free hooks & workflow: .pre-commit-hooks.yaml, action.yml, .github/workflows/test_action.yml
  • Pro SARIF boundary: --format sarif remains Pro-gated (_load_sarif_exporter(), returning PRO_FEATURE_REQUIRED / exit code 2 in Free per M40) unless verity-pro is supplied via extra-packages.

ATDD Traceability Matrix

AC ID Acceptance Criterion Paired Benign / Negative Control Verification Tier Test Target
AC-32.1 .pre-commit-hooks.yaml defines verity-scan, verity-scan-configs, verity-scan-uvx with --offline. Missing required hook keys or invalid flags fail validation. unit tests/unit/test_precommit_hooks.py::test_hooks_schema_and_flags
AC-32.2 Multi-file staged runs (pass_filenames: true with .py + .json/.yaml) parse cleanly. Invalid CLI flags exit non-zero. unit tests/unit/test_precommit_hooks.py::test_staged_multi_file_invocation
AC-32.3 README pre-commit and Action YAML snippets pass build_parser() and relative-link parity. Invalid YAML verity command is rejected. unit tests/unit/test_documentation_parity.py
AC-32.4 Ruff linter and unit test suite pass with zero violations. Clean code conforms to ruff rules. ruff uv run ruff check src tests