mirror of
https://github.com/kuhyx/utils.git
synced 2026-11-10 21:27:14 +01:00
The hook entry was an absolute /home/kuhy/utils path, copied from a config written for ~/.claude where it only ever ran locally. On an Actions runner that is exit code 127 — "No such file or directory" — so gatelock-precommit and crdt-sync-precommit failed on every commit of this refactor while the hook silently checked nothing. Now repo-relative, matching the sibling hooks (`entry: scripts/check_subproject_scope.sh`): pre-commit always runs from the git root, so it resolves the same in both places. Fixing that made the CI configs runnable locally, and `--all-files` then found what per-file runs had missed — ruff pruning imports that exist *for* their re-export. `import crdt_sync` was broken three separate ways (FileSyncStateStore, encode_key, FileCredentialStore). Each affected module now states an explicit __all__ so the autofixer cannot take them again, and the two files that pushed past the cap once __all__ was added are split further: _firebase.py 260 -> 247 + _fberrors 25 _sync.py 257 -> 188 + _syncargs 91 Test patch targets followed the code they patch: gatelock._outputs.shutil -> _xrandr.shutil, gatelock._arbiter.Path -> _claims.Path. gatelock and crdt-sync both pass `pre-commit run --all-files` in full; 389 and 259 tests at 100% branch coverage; the root gate exits 0. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CFSGeWxHPY5rHUGrPqhcmG
29 lines
1.4 KiB
YAML
29 lines
1.4 KiB
YAML
# Repo-wide gate for the shared 250-line file cap (refactor_claude_todo.md).
|
|
#
|
|
# A file that cannot be read in one piece forces re-reads and partial edits,
|
|
# which is the largest avoidable cost in an LLM-assisted workflow. A refactor
|
|
# without a gate silently regrows, so this is the part that makes it stick.
|
|
#
|
|
# Checks only the files in the commit, so an unrelated commit never breaks on
|
|
# a violation it did not introduce, and it FAILS (exit 1) rather than warning.
|
|
# No baseline and no allowlist -- those are suppressions.
|
|
#
|
|
# The subprojects (gatelock/, crdt-sync/, web_ui/, design_system/,
|
|
# sync_settings_ui/) each keep their own .pre-commit-config.yaml for their own
|
|
# linters, and carry this same hook so committing with one of those configs is
|
|
# gated too. This root config is what `pre-commit install` wires up, and it is
|
|
# the only one that covers the subprojects without a config of their own
|
|
# (aur-publish/, guard-lib/, crdt_sync_dart/, file_length/, ...).
|
|
#
|
|
# The path is repo-relative on purpose. pre-commit always runs hooks from the
|
|
# git root, so this resolves the same locally and on a CI runner -- an absolute
|
|
# /home/... path exits 127 in Actions, which is how this was first written.
|
|
repos:
|
|
- repo: local
|
|
hooks:
|
|
- id: file-length-cap
|
|
name: file length <= 250 lines
|
|
entry: bash scripts/check_file_length.sh
|
|
language: system
|
|
pass_filenames: true
|