Repository navigation
fix: treat a behind-only .docket copy as healthy and fast-forward it in place (0523) - #394
Merged
danielhanold merged 17 commits intoOct 5, 2026
Conversation
Docket-Plan-Path: docs/superpowers/plans/2026-10-05-repository-check-reports-a-behind-only-docket-copy-as-diverg.md
…he in-place fast-forward
…putation for check and prepare
…diverged branches
The gitcli repo shard (prefix ^TestIntegrationRepo, budget 30s) measured 36s solo on this branch (29s on main) after the new in-place fast-forward, checked-advance, and replace-blind ancestry tests landed. Per tests/README.md the shard is split rather than its ceiling raised: the five branch-tip movement tests move to prefix ^TestIntegrationBranchTip in a new tests/test_go_integration_gitcli_branchtip.sh shard. Measured solo after the split (two runs each): gitcli_repo 29s / 28s, gitcli_branchtip 10s / 9s. The branchtip ceiling is 15s (10s rounded up to the next multiple of 5 plus the 5s margin, per the runtime-budgets.tsv seeding rule). Also names the unfinished-merge and primary ahead/behind scenarios in the reposynccheck shard header.
…t finish Review finding: after an in-place fast-forward is killed between update-ref and read-tree, check and prepare gave the generic metadata-worktree-dirty remedy beginning "Commit", which would record a revert of remote metadata (spec §3 property 5). worktreeCleanState now detects that state (the branch's newest reflog entry is the fast-forward's own and the index equals the previous tip's tree) via gitcli InterruptedFastForward, carries it on WorktreeFact, and both commands share one message and remedy naming git -C .docket reset --merge HEAD, never commit.
…s guard decides Review finding: AdvanceBranchChecked's holder check read only `git worktree list`, which reports a worktree rebasing or bisecting `docket` as detached and races a concurrent `worktree add`, so prepare's behind-attach path moved the branch before Git's own checked-out guard ran -- breaking spec section 5's "refuse and touch nothing". prepareAttachFresh now attaches the branch where it stands first (Git's checked-out/rebase/bisect guard refuses a held branch before anything moves), applies hooks-off, then advances it in place with FastForwardCheckedOutBranch (hooks-off compare-and-swap from the observed tip). AdvanceBranchChecked had no other caller and is removed with its tests; the branchtip shard header no longer names it. New regression test: a behind docket branch held by a worktree mid-rebase leaves the branch untouched and .docket unattached.
…in-place fast-forward - F2: the absent-.docket attach row checks the holder probe for a current branch too, not only a behind one, so a held branch refuses with docket-worktree-ambiguous-registration instead of applying and failing the attach. A holder that is .docket's own leftover registration (directory deleted) or one Git lists as prunable names `git worktree prune` in the remedy; WorktreeInfo now carries Git's prunable annotation. - F4: real-git test for prepareAugment's ListWorktrees holder probe (TestIntegrationRepoInPlaceFFAttachBehindHeldElsewhereRefuses), plus the deleted-.docket prune case. - F5: FastForwardCheckedOutBranch refuses an unfinished Git operation before the compare-and-swap; subtests pin that refusal and the roll-back over a modified tracked file on a changed path. - F7: prepare's attach runs `git worktree add` with docket's empty hooks dir (AddBranchWorktreeNoHooks / AttachBranchWorktreeNoHooks), so a failing post-checkout hook neither runs nor breaks the attach.
…epare, not any command
danielhanold
force-pushed
the
fix/repository-check-reports-a-behind-only-docket-copy-as-diverg
branch
from
October 5, 2026 13:32
570d7ba to
1649e4f
Compare
danielhanold
deleted the
fix/repository-check-reports-a-behind-only-docket-copy-as-diverg
branch
October 5, 2026 13:33
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.
↩ Change 0523 — Treat a behind-only .docket copy as healthy and make prepare fast-forward it in place
Summary
docket repository checknow classifies the local.docketcopy by ancestry. A clean copy that is only behindorigin/docketis healthy. Ahead, diverged, and unknown each get their own finding..docketin place with a compare-and-swap and hooks off, instead of removing and re-adding the worktree. It refuses over local edits, untracked files in the way, and unfinished Git operations, and rolls back on failure. An ignored file at a newly tracked path follows Git's checkout rule.git -C .docket reset --merge HEAD, never commit..docketregistration gets a remedy that namesgit worktree prune. The attach runs with hooks off.Results:
docs/results/2026-10-05-repository-check-reports-a-behind-only-docket-copy-as-diverg-results.mdReview
Whole-branch review, deep tier: 7 findings (0 blocker, 1 important, 6 minor).
git worktree prunecommand: go run ./cmd/docket development test
result: green
head_sha: 1649e4f
ran_at: 2026-10-05T13:32:23Z