mirror of
https://github.com/kuhyx/todo-app.git
synced 2026-11-10 20:07:02 +01:00
Moving bump_patch_version.sh into .pre-commit-config.yaml introduced three bugs, all reproduced in clean clones of HEAD before fixing and re-verified after: 1. DATA LOSS. pre-commit stashes unstaged changes and restores them with `git apply`. The bump rewrites pubspec.yaml inside that window, so an uncommitted edit near the `version:` line made the restore conflict: the commit aborted AND the developer's edit vanished from the working tree, recoverable only from $PRE_COMMIT_HOME. Only non-mutating checks belong in that file. 2. A commit rejected by the file-length gate still had its version bumped and staged, riding into the next successful commit. `always_run: true` with no `fail_fast` meant "ordered last" did not mean "runs last only on success" -- which is exactly what the comment above it claimed. 3. `files: ^pubspec\.yaml$` narrowed the crdt_sync override check from unconditional to staged-only, so a poisoned pubspec arriving by pull or merge was invisible to every later commit that did not touch pubspec. The hand-written hook this replaced checked it every time; that narrowing quietly widened the hole the check exists to close. The fix keeps the framework for the read-only gates and puts the mutation back outside it: install_hooks.sh now writes a wrapper that runs pre-commit's generated hook first and bump_patch_version.sh only if it passed. Plus fail_fast, and always_run on the crdt check. Also fixes three stale references this refactor created: a load-bearing layout comment citing the renamed _buildRaw, bin/todo_desktop.dart naming two split-away test files, and CLAUDE.md giving two different suite runtimes. Verified: unstaged pubspec edit preserved through a commit; a rejected commit leaves nothing staged; a merged-in override is caught on an unrelated commit. 313 tests, 100% coverage, gate exits 0. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| bump_patch_version.sh | ||
| check_file_length.sh | ||
| check_no_crdt_sync_override.sh | ||
| install_hooks.sh | ||