fix(doctor): install GUARD-001 memory-sink hooks on Windows + fix agy abs-path check - #741
Conversation
… abs-path check setup-windows.ps1 never deployed the git-hooks dispatcher or wired core.hooksPath, so the machine-wide memory-sink guard AGENTS.md advertises did not exist on Windows -- an agent could commit MEMORY.md/memory/ into any repo. Separately, doctor's AGY_APP_DATA check used HasPrefix(_, "/"), false-FAILing an absolute Windows path (C:\Users\...\antigravity-cli) whenever agy was on PATH. - add scripts/install-git-hooks.ps1 (Windows twin of install-git-hooks.sh): clean-mirror the dispatcher + wire core.hooksPath (unset-only, preserve existing) - setup-windows.ps1 deploys + wires via Install-GitHooks -DotfilesDir $DotfilesDest; the wired path equals the Go filepath.Join(cfg.DotfilesDir,"git-hooks") doctor verifies (backslash round-trip verified empirically) - doctor: HasPrefix(agyData,"/") -> filepath.IsAbs - Pester (8) + a Go OS-aware test; e2e on Windows: dotf doctor GUARD all ok Closes #691
|
Warning Review limit reached
Next review available in: 26 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (8)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Why
Two Windows-side gaps (audit C20 + the GUARD-001 Windows gap):
setup-windows.ps1had zero git-hooks deploy /core.hooksPathwiring. AGENTS.md advertises a machine-wide pre-commit guard that rejectsMEMORY.md/memory/outside the vault — on Windows it simply did not exist, so an agent could commit memory artifacts into any repo.install-git-hooks.shitself noted "a Windows setup twin is a tracked follow-up." On a real boxdotf doctorreported[FAIL] dispatcher not found at C:\Users\<u>\.dotfiles\git-hookswithcore.hooksPathunset.checks_deploy.gogatedAGY_APP_DATAwithstrings.HasPrefix(agyData, "/"); an absolute Windows path is not/-rooted, sodotf doctorreported "AGY_APP_DATA is relative or unset" whenever agy was on PATH.What
scripts/install-git-hooks.ps1— the PowerShell twin ofinstall-git-hooks.sh:Deploy-GitHooks: clean-mirror the dispatcher tree (remove-then-copy, so a hook removed upstream never lingers) with the same safety guards (refuse a non-*\git-hooksdest, refuse$HOME\git-hooks/ a drive root, no-op on self-mirror).Set-GlobalHooksPath: wire globalcore.hooksPathonly when unset; preserve+warn an unrelated value; no-op when already correct.Install-GitHooks: deploy + wire.setup-windows.ps1sources it and callsInstall-GitHooks -DotfilesDir $DotfilesDest(non-fatal). The wired path equals the Gofilepath.Join(cfg.DotfilesDir, "git-hooks")the doctor compares — the backslash path round-trips byte-for-byte throughgit config(verified), sodotf doctorthen PASSES on Windows.strings.HasPrefix(agyData, "/")->filepath.IsAbs(agyData).Verification
tests/install-git-hooks.Tests.ps1: 8/8 (mirror/prune/refuse-unsafe; wire/no-op/preserve, isolated via a throwawayGIT_CONFIG_GLOBAL).TestCheckAntigravity_AbsolutePathAccepted(OS-aware): green underfilepath.IsAbs, proven red under the revertedHasPrefix.Install-GitHooksdeployed + wired a temp~/.dotfiles\git-hooks, anddotf doctorthen reported[GUARD memory-sink hooks] (1 checks, all ok).go build/vet/test ./...clean; PSScriptAnalyzer clean on changed.ps1; ASCII-only.Notes
install-git-hooks.ps1is not in CI's hardcoded PSScriptAnalyzer file list (CI: hardening — PSScriptAnalyzer coverage, SHA-pinned actions, Go config-input coverage #692); linted locally.PSUseSingularNounsis suppressed with justification (GitHooks is inherently plural, mirrors the.sh).specs/BUG-032-windows-guard-001/.Closes #691.