Repository navigation
test: add real-git e2e coverage for failure paths and undo discovery - #201
Merged
Merged
Conversation
Plan 028. Close the gap between fakeGit failure injection and real subprocess behavior: - create --worktree with the canonical worktree path pre-obstructed: exits 1 naming the st worktree retry, keeps the branch tracked, and after a manual st worktree retry st undo removes the worktree via LinkedOwnerOf discovery (the journal never got createdWorktrees). - st submit with a corrupt-state invalid refname surfaces a clean exit-1 wrapped error (text and --json envelope), not a panic. - st worktree rm --all removes tracked-branch worktrees but leaves a manually-created worktree for an untracked branch on disk and in git's registry; the JSON skipped list only names tracked branches. - st undo with an unreadable undo.json exits non-zero with state.json byte-identical.
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.
Plan 028 — Real-git failure-path integration tests
Adds the e2e coverage the fake-Git suite can't express:
TestCreateWorktreeMaterializeFailure— pre-obstructs the canonical~/.stacked/worktrees/<repo-key>/feat-xpath with a non-empty dir sogit worktree addfails after the branch is tracked. Asserts exit 1 withthe
st worktreeretry hint, branch still tracked, no worktree registered;then removes the obstruction, retries
st worktree feat-x, and runsst undo— exercising theLinkedOwnerOfdiscovery arm because the journalnever recorded
createdWorktrees. Sibling worktree verified untouched.TestSubmitInvalidRefCleanError—--remote=-xdies cleanly at theremote-exists check; a corrupt-
state.jsonbranch named-badreachesvalidRefArginsidePushBranches, pinning the nil-result arm: exit 1,wrapped message, generic
errorJSON code — no panic/internal envelope.TestWorktreeRemoveAllLeavesUntracked— a manually-added worktree for anuntracked
scratchbranch survivesst worktree rm --allon disk and ingit worktree list; JSONremoved/skippedonly name tracked branches.TestUndoUnreadableJournal—undo.jsonreplaced by a directory →exit 1,
state.jsonbyte-identical.Verification
go test ./e2e -run 'TestCreateWorktreeMaterializeFailure|TestSubmitInvalidRefCleanError|TestWorktreeRemoveAllLeavesUntracked|TestUndoUnreadableJournal' -v— 4/4 passmake ci— clean (fmt + lint + vet + cross-vet + race + e2e), merged coverage 87.6%plans/content on this branch; test-only diff.