fix(tests): canonicalize the temp repo path in the integration helper - #200
Conversation
cmd_clean --merged uses nested registered worktree path failed on macOS and passed in CI. setup_integration_repo took its path straight from mktemp -d, which on macOS returns /var/folders/... while /var is a symlink to /private/var. git canonicalizes when it registers a worktree, so the hook received /private/var/... and the assertion compared it against the /var/... spelling. Verified this is the test's expectation being wrong rather than a product bug: passing /var/... to `git worktree add` makes git itself register /private/var/..., so the canonical path a hook receives is git's own behavior. Resolving the path in the helper fixes it for every integration test rather than patching the one assertion. Linux is unaffected, since mktemp -d returns /tmp with no symlink to resolve. Full suite now passes locally: 561/561, previously 560/561.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 100 included reviews per hour; 98 remain after this review. WalkthroughThe integration helper now canonicalizes temporary repository paths before storing them. This aligns macOS paths with Git’s registered worktree paths. The changelog documents the fix. Product code remains unchanged. ChangesIntegration test path canonicalization
Priority: ⬇️ Low Estimated code review effort: 1 (Trivial) | ~5 minutes Change: Bug fix · Severity of issue fixed: Low Suggested reviewers: Merge Risk: ⚪ Minimal · up to This test-only change aligns macOS path spellings without changing product behavior. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
A rabbit hops where temp paths wind Comment |
Description
cmd_clean --merged uses nested registered worktree pathfails on macOS and passes in CI.setup_integration_repotook its path straight frommktemp -d, which on macOS returns/var/folders/...while/varis a symlink to/private/var. git canonicalizes when it registers a worktree, so thepreRemovehook received the/private/varspelling and the assertion compared it against the/varone:Resolving the path once in the helper fixes it for every integration test rather than patching the single assertion. Linux is unaffected, because
mktemp -dreturns/tmpwith no symlink to resolve, which is why CI was green throughout.Motivation
The suite was permanently red on macOS, which trains contributors to ignore failures and hides real regressions behind an expected one.
Type of Change
This is the test being wrong, not the product
Worth stating explicitly, since "make the failing assertion pass" can hide a defect. Passing a
/varpath togit worktree addmakes git itself register the resolved one:So the canonical path a hook receives is git's own behavior and the correct thing for
cmd_cleanto pass along. The test's expectation was the part that was wrong.Testing
Tested on:
Linux coverage comes from the CI Tests job on this PR.
Automated gates
bats tests/— 561 of 561 pass, up from 560 of 561. This is the first fully green local run.shellcheck bin/gtr bin/git-gtr lib/*.sh lib/commands/*.sh adapters/editor/*.sh adapters/ai/*.sh— clean../scripts/generate-completions.sh --check— up to date.Teardown still removes the temporary directories; no strays remain after a run.
Breaking Changes
None. Test-only; no shipped code paths change.
Checklist
cd -P … && pwdmatches the existing idiom inbin/gtrandbin/git-gtr)--checkpasses)git gtrand./bin/gtr🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Documentation