fix(pull-base): word-match the clear hook; defer no-identity refusal to diverged pulls #153
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Cloonar/coding-lab!153
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "afk/151"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #151
Two narrow gaps in the
/pull-baselab command (#149), each degrading to pre-#149 behaviour in cases the design intended to cover.1. Arg-bearing clear silently skipped the pull
isClearCommandmatched the provider's role=clear entry by exact string equality, so/clear my-session(claude's clear carriesArgHint "[name]", and the autocomplete gesture model #122 actively invites typing one) fell through to the ordinary reply path — forwarded with no pull and no notice.Fix: a
commandWordhelper (first whitespace-delimited token,unicode.IsSpaceso tabs count) now drives both dispatch paths, so they agree on what counts as a command with a trailing argument:/pull-basebare executes, any argument — space- or tab-separated (previously leaked to the provider) — is the 400 refusal.2. No-identity refusal blocked even a fast-forward
The
ErrNoAuthorIdentityrefusal ran before any git did (inherited from crmerge, where every merge authors a commit), so a repo with no configured author identity could never/pull-baseat all — even when the pull would trivially fast-forward, which authors no commit. Since ff-ness is unknowable before the fetch, the check had to move below it:gitx.PullBasenow refuses with a newErrAuthorIdentityRequiredsentinel only on the diverged path, after the fetch but before the merge touches the worktree (untouched on refusal); the pull service maps that toErrNoAuthorIdentity, so the HTTP classification (409) is unchanged.Tests
TestAPI_ClearHook_argBearingClearPulls—/clear my-sessionpulls first, forwards verbatim.TestAPI_ClearHook_prefixIsNotClear—/clearxis not a clear (word match, not prefix).TestAPI_PullBase_tabArgRejected— tab-separated argument 400s.gitx.TestPullBase_fastForwardEmptyIdentity/TestPullBase_divergedEmptyIdentityRefused— identity needed only when a merge commit is authored; refusal leaves HEAD unmoved, noMERGE_HEAD, clean tree.pull.TestPullBase_noIdentityFastForwardSucceeds/TestPullBase_noIdentityDivergedRefused— service-level acceptance, replacing the old up-front-refusal test.Full
go test ./...green (gofmt/vet clean).🤖 Generated with Claude Code
https://claude.ai/code/session_01SG5V7rCpXuWvkD6Uv4BjHB
codex debug models+ per-model efforts seam #156