mind_commit_guard v1.2: honour a leading cd away from Mind#138
Merged
Conversation
… positive) v1.1 keyed is-this-a-Mind-commit off the ambient cwd the hook is handed. A command that cd s into a PyAutoBuild worktree before committing (with the session cwd still PyAutoMind from a prior command) was wrongly denied — it bit its own author committing PyAutoBuild#165 step 3. check_command now walks clauses tracking the effective cwd, resolves each commit target repo (git -C wins, else effective cwd), and guards ONLY when that repo is a PyAutoMind checkout. Dead _mind_root/re removed. Four regression tests pin the cd-away and git -C-away allows plus the cd-into / -C-into denies. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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
Fixes a false positive in the Mind-commit guard (shipped in #132/#133; campaign #155 Phase 5). v1.1 decided is this a Mind commit? from the ambient cwd the hook is handed. A command that
cds into a PyAutoBuild worktree before committing — with the session cwd stillPyAutoMindfrom a prior command — was wrongly denied. It bit its own author committing PyAutoBuild#165's step-3 change (twice), which is exactly the noisy-refusal-trains-bypass failure the doc's §4 warns about.check_commandnow walks clauses tracking the effective cwd (honouringcd), resolves each commit's target repo (git -C <path>wins, else the effective cwd), and guards only when that repo is a PyAutoMind checkout. Acd/-Caway from Mind → allow; acd/-Cinto Mind, or a bare commit with Mind cwd → still deny. Dead_mind_roothelper and the now-unusedreimport removed.API Changes
None — guard internals.
Test Plan
git -Caway allowed, cd-into-Mind denied,git -Cinto-Mind denied.Generated by the PyAutoLabs agent workflow.