Configure shared offline commit checks #5

Open
opened 2026-11-01 20:11:27 +00:00 by viacheslavshuka · 0 comments

Contributors need the same installed tools locally and in CI. Commit checks must work without network access after setup.

Scope

Configure pre-commit and pre-commit-hooks in the shared project .venv. Provide one documented setup procedure and explicit complete-check command. Pin native tools during setup. Preserve the existing Python 3.14, uv, Ruff, WPS, and strict mypy configuration.

Acceptance criteria

  • Commit hooks run Ruff formatting and safe fixes, WPS, project typing, and offline file checks. File checks cover YAML, JSON, TOML, merge markers, secrets, whitespace, final newlines, and file size.
  • Python hooks use the shared .venv. Native executables, including Gitleaks, come from documented setup. Hooks never resolve, download, or install packages.
  • A stale uv.lock stops the commit with an instruction to run explicit uv add or uv sync. Missing tools produce a setup instruction.
  • When a hook changes a file, the commit stops. The contributor reviews and stages the changes. No hook stages changes automatically.
  • Added or modified ordinary Git files can contain at most 5,242,880 bytes. A file at that size passes. A larger file requires a reviewed path-specific exception.
  • Narrow file exceptions preserve intentional Markdown hard breaks and reviewed fixtures. YAML custom tags or multiple documents receive explicit handling.
  • Checks exclude bundled skill code and gitignored files. CI can invoke the same project-owned static checks across all applicable files.
  • The complete local command includes slower checks and online dependency auditing. There is no mandatory pre-push hook or fixed hook-runtime target.

Validation

Exercise commits with networking disabled after setup. Cover a stale lockfile, missing executable, a detected test secret, an edited file, and both size boundaries. Check the index remains unchanged when hooks edit files. Document which complete checks require containers or network access.

Contributors need the same installed tools locally and in CI. Commit checks must work without network access after setup. ## Scope Configure pre-commit and pre-commit-hooks in the shared project `.venv`. Provide one documented setup procedure and explicit complete-check command. Pin native tools during setup. Preserve the existing Python 3.14, uv, Ruff, WPS, and strict mypy configuration. ## Acceptance criteria - Commit hooks run Ruff formatting and safe fixes, WPS, project typing, and offline file checks. File checks cover YAML, JSON, TOML, merge markers, secrets, whitespace, final newlines, and file size. - Python hooks use the shared `.venv`. Native executables, including Gitleaks, come from documented setup. Hooks never resolve, download, or install packages. - A stale `uv.lock` stops the commit with an instruction to run explicit `uv add` or `uv sync`. Missing tools produce a setup instruction. - When a hook changes a file, the commit stops. The contributor reviews and stages the changes. No hook stages changes automatically. - Added or modified ordinary Git files can contain at most 5,242,880 bytes. A file at that size passes. A larger file requires a reviewed path-specific exception. - Narrow file exceptions preserve intentional Markdown hard breaks and reviewed fixtures. YAML custom tags or multiple documents receive explicit handling. - Checks exclude bundled skill code and gitignored files. CI can invoke the same project-owned static checks across all applicable files. - The complete local command includes slower checks and online dependency auditing. There is no mandatory pre-push hook or fixed hook-runtime target. ## Validation Exercise commits with networking disabled after setup. Cover a stale lockfile, missing executable, a detected test secret, an edited file, and both size boundaries. Check the index remains unchanged when hooks edit files. Document which complete checks require containers or network access. ## Related work - [#9: Enforce frontend correctness and report runtime performance](https://code.viacheslavshuka.com/viacheslavshuka/quorum/issues/9) - [#13: Enforce complete validation in the shared Forgejo runner flow](https://code.viacheslavshuka.com/viacheslavshuka/quorum/issues/13)
Sign in to join this conversation.
No description provided.