feat(hooks): managed git hooks keep the index fresh on commit/checkout/merge - #113
Merged
Merged
Conversation
…t/merge The SessionStart hook already heals a stale index with a single-shot detached background analyze, but drift born mid-session (commits, branch switches, merges) waited for the next session start. Close that gap: - New `loomweave hook git-sync --path .`: loads the snapshot and, only for a present-but-stale index (refresh, not bootstrap), spawns the existing detached lock-deduped analyze. Silent, always exits 0 — safe under `|| true`; a hook must never block git. - `spawn_detached_analyze` now strips GIT_* env from the child: git hooks export GIT_DIR/GIT_INDEX_FILE/GIT_WORK_TREE, which would repoint or poison the analyze's own git invocations (clarion-9202f4acec family). - New git_hooks module installs a managed block (fail-soft: `timeout 30` + `|| true`) into post-commit/post-checkout/post-merge under `git rev-parse --git-path hooks` (honours core.hooksPath and linked worktrees; `--path .` keeps per-worktree stores correct). Merge follows the cede discipline: foreign content byte-for-byte preserved, block inserted before a trailing `exit` line (warpline's post-commit ends `exit 0`), stale blocks replaced in place, unbalanced markers refused. - Wired into `install --hooks` and both doctor surfaces as `hook.git_sync` with Present/Stale/Missing/NoGitDir classification; missing/stale is a WARNING (freshness enrichment, not a correctness gate) and --fix repairs. Closes clarion-1d688cdddd. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes the mid-session index-drift gap (design ratified in-session): the SessionStart hook already spawns a single-shot detached analyze when the index is stale, but commits/branch switches/merges mid-session drifted until the next session start. This adds warpline-pattern managed git hooks that trigger the same machinery at the moment drift is born.
What's in it
loomweave hook git-sync --path .— snapshot →should_trigger_background_analyze(refresh-not-bootstrap: present-but-stale only) → existing detached, advisory-lock-deduped analyze spawn. Silent, exit 0 always.GIT_*env stripping inspawn_detached_analyze— git hooks exportGIT_DIR/GIT_INDEX_FILE/GIT_WORK_TREE; inheriting them would repoint the analyze's own git invocations (clarion-9202f4acec family). Also applied to thehooks_dirresolution probe.git_hooksmodule — managed block (timeout 30,|| true, never blocks git) merged intopost-commit/post-checkout/post-mergeatgit rev-parse --git-path hooks(honourscore.hooksPath; linked worktrees share hooks while--path .keeps per-worktree stores correct). Cede discipline throughout: foreign bytes preserved verbatim, block inserted before a trailingexitline (warpline's post-commit endsexit 0— appending would be dead code), stale block replaced in place, unbalanced markers refused, byte-for-byte no-op when current.install --hooksinstalls them (graceful note when not a git repo); both doctor surfaces reporthook.git_syncwith Present/Stale/Missing/NoGitDir. Missing/stale is a warning, not a gate-failing problem — it's a freshness enrichment, and projects installed beforegit initmust not start failing doctor.Testing
--fix→ fixed → ok lifecycle.-D warnings, build, nextest 2323, doc-D warnings, deny.Closes clarion-1d688cdddd.
🤖 Generated with Claude Code