Detect and warn on #456 git config corruption (user.name = literal us…#472
Detect and warn on #456 git config corruption (user.name = literal us…#472peyton-alt wants to merge 2 commits intomainfrom
Conversation
PR SummaryMedium Risk Overview Wires these checks into session lifecycle and hook flows (e.g., Adds unit tests for the guard logic plus new integration tests asserting a full session does not mutate local git config and regressing against the #456 pattern; includes small test/bench cleanups (e.g., Written by Cursor Bugbot for commit 6fefc1c. Configure here. |
There was a problem hiding this comment.
Pull request overview
Adds runtime detection and warnings for the #456 local git config corruption pattern (user.name == "user.email") and guards key lifecycle/hook operations to surface unexpected .git/config mutations.
Changes:
- Introduces a local git config snapshot/compare guard with targeted #456 detection and user-facing warnings.
- Wraps lifecycle step saving and selected git hooks with before/after integrity checks.
- Adds unit + integration regression coverage for config integrity, plus small test/bench cleanups.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| cmd/entire/cli/config_guard.go | New helper to snapshot local user.name/user.email, detect changes, and warn on #456 pattern. |
| cmd/entire/cli/config_guard_test.go | Unit tests for snapshotting and warning behavior. |
| cmd/entire/cli/lifecycle.go | Adds pre-flight corruption check at turn start and integrity checks around SaveStep/SaveTaskStep. |
| cmd/entire/cli/hooks_git_cmd.go | Adds integrity checks around post-commit / pre-push hook handling. |
| cmd/entire/cli/hooks_claudecode_posttodo.go | Adds integrity check around incremental SaveTaskStep in the post-todo hook. |
| cmd/entire/cli/integration_test/git_config_integrity_test.go | New integration regression tests ensuring sessions don’t mutate local config and user.name never becomes literal user.email. |
| cmd/entire/cli/integration_test/testenv.go | Removes loop-variable rebinds but leaves “capture for parallel” comments. |
| cmd/entire/cli/integration_test/rewind_test.go | Same subtest-loop comment cleanup mismatch. |
| cmd/entire/cli/integration_test/interactive.go | Uses errors.New for a fixed timeout error. |
| cmd/entire/cli/integration_test/hook_bench_test.go | Uses strconv.Itoa for benchmark names. |
| cmd/entire/cli/integration_test/agent_test.go | Whitespace cleanup only. |
Comments suppressed due to low confidence (3)
cmd/entire/cli/integration_test/testenv.go:245
- Same issue: the "capture for parallel" comment is now misleading because there's no loop-variable rebind. Either remove the comment or rebind
stratto make the intent explicit.
for _, strat := range AllStrategies() {
// capture for parallel
t.Run(strat, func(t *testing.T) {
t.Parallel()
env := NewRepoEnv(t, strat)
testFn(t, env, strat)
})
cmd/entire/cli/integration_test/testenv.go:214
- The comment says "capture for parallel" but the loop variable is no longer re-bound. With Go 1.22+ this is safe, but the comment is now misleading—either remove the comment or reintroduce the explicit rebind to match the intent.
for _, strat := range AllStrategies() {
// capture for parallel
t.Run(strat, func(t *testing.T) {
t.Parallel()
env := NewFeatureBranchEnv(t, strat)
testFn(t, env, strat)
cmd/entire/cli/integration_test/testenv.go:230
- Same issue here: the "capture for parallel" comment is now misleading because there's no loop-variable rebind. Either remove the comment or rebind
stratto make the intent explicit.
for _, strat := range AllStrategies() {
// capture for parallel
t.Run(strat, func(t *testing.T) {
t.Parallel()
env := NewRepoWithCommit(t, strat)
testFn(t, env, strat)
})
|
@cursor review |
…er.email)