Repository navigation
fix(sync): stop autosyncing after td comments listings - #219
Merged
Merged
Conversation
`td comments <id>` only reads, but it shared the `comments` entry that makes `td comments add` sync, so each listing pushed and pulled afterward. The mutating list now names `comments add`, and the post-run hook also matches a command's full path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
td comments <id>only lists an issue's comments, but it runs the post-mutation autosync: a push and pull after the command. The mutating-command list is keyed by command name, andresolveCommandNameresolvestd comments addto its parent,comments. So when 37c4b25 addedcommentsto maketd comments addsync, the listing came along with it.With sync configured, each listing made an extra pull after its startup sync. When earlier local changes were still unpushed and the server couldn't be reached, a listing also printed
Warning: sync: N local change(s) not yet pushed to remote (will retry on next td command). With autosync explicitly turned off and changes pending, it could print the "configured for sync but autosync is off" warning instead.Changes:
comments addinstead ofcomments.comments add, is listed. Every other command classifies as before.Startup sync is unchanged, so with
on_startenabled (the default) a listing still pulls once before it runs.Testing
make test,go vet ./..., andgofmtpass. golangci-lint v2.13.1 withGOOS=linuxand Go 1.27.0, as in CI, reports 0 issues.go test -race -count=1 -run 'Mutat|AutoSync|Autosync' ./cmd/passes.TestIsMutatingCommandnow expectscomments addto be mutating andcommentsnot to be. It fails withmain's list.TestIsMutatingInvocationresolves real invocations throughrootCmd:comments <id>is read-only, whilecomments add,comment, andboard liststay mutating. It fails if either the list change or the full-path check is reverted.TestMutationHookSkipsCommentsListingrunsrunGatedSyncMutationHookfor a sync-configured project. The post-mutation sync runs forcomments addand not for a listing. If the hook goes back to matching only the resolved name, it catchescomments addno longer syncing.on_startoff, a listing made one pull onmainand none on this branch.comments addpushed and pulled on both.Not in this PR
Other read-only commands still count as mutating:
blocked-byanddepends-ononly read, and both are in the mutating list.td dep <id>with one argument only reads, but it sharesdepwith the commands that add and remove dependencies.board,ws,epic, andtaskhave read-only subcommands, such asboard list,ws show, andepic list, that count as mutating through their parent.Removing
blocked-byanddepends-onwould be a two-line change. The subcommands could use the full-path lookup by listing only the mutating ones. That list would need updating whenever someone adds a subcommand, anddep <id>depends on its argument count rather than its path, so these seemed better as their own change.🤖 Generated with Claude Code