change record: refuse a moved checkout and an unnamed sweep #231
No reviewers
Labels
No labels
blocked
bug
decision
duplicate
enhancement
help wanted
invalid
landed?
question
ready-to-merge
stale
wontfix
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
allod/tools!231
Loading…
Reference in a new issue
No description provided.
Delete branch "agent/record-guards"
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?
allod change recordnow refuses two things it used to do silently. If the checkout was switched to another branch afterbeginset it up,recordnames the branch it expected and the one actually checked out, and stops. In a shared checkout with no--filesnamed, it lists the modified tracked files it would have swept in and stops; inside abegin -dworktree, which belongs to one agent, the barerecordstill stages every tracked change as before. Both refusals happen before anything is staged, so a refusedrecordleaves the tree as it found it. The in-place default-branch flow with nobeginis unchanged. The shell suite proves each case and the flake'sgo-checkspasses. If it is wrong, revert the one commit.Closes allod/tools#118
What changes
cmd/allod/change.go:changeRecordreads<git-dir>/allod-change-branch, the filebegin -dandbegin --resumewrite, and refuses on a mismatch with the current branch (exit 3). A missing file meansbeginwas never called there, so nothing changes for the in-place flow. With no--filesand in a main checkout (not a linked worktree, decided by the existingmainRepoDirhelper), it refuses whengit diff --name-onlyis non-empty, listing the paths (exit 7). This is the first reader of the handoff file; until now it was write-only.cmd/allod/main.go,README.md: the usage text and the "Making a change" section state both refusals in plain words.tests/allod-change.sh: new assertions for the moved checkout (refusal, both branch names, tree unchanged, no commit) and the sweep (refusal, paths named, nothing staged, no commit; allowed when named; unchanged in a worktree). Eight existing tests that modified a tracked file in a plain checkout with no--filesnow pass--files, since that is exactly what the guard refuses; two tests whose point is the baregit add -udefault now run inside abegin -dworktree, where that default survives. No assertion was weakened.Risk
R1. Two preflight refusals in one function; nothing new is staged, committed, or pushed. Rollback is a straight revert. One stated limit: the sweep check reads unstaged modifications, as the issue specified, so a change another agent had already staged with
git addwould still be included in a barerecord. Naming files covers that case too.Behavior change for existing habits: a bare
allod change record -m ...in a shared checkout with unnamed edits now fails where it used to commit.git-workflow.mdalready instructs naming files there, so this moves that rule from prose into the tool.Validation
nix build .#checks.x86_64-linux.go-checks: passed (Go tests for every package plus the shell suites against the built binary).tests/allod-change.shagainst a local build: 231 passed, 14 new assertions.gofmt -l,go vet ./cmd/allod/: clean.--resumeinteraction beyond the existing resume test, which records on a resumed branch and still passes.Owner request before merge: the added source comments are too verbose. Documentation moves to the README and usage text, not the source; remaining comments shrink to at most one line each, contract or trap only.