* fix(github): content-based dedup on push to stop re-PATCHing every issue
GitHub sync never wired engine.PushHooks, so `doPush` fell back to
timestamp-only dedup. Because linking and any local write bump a beads
issue's updated_at past GitHub's second-granularity updated_at, every
`github sync --push-only` / `github push` reconciled and PATCHed the
entire backlog on every run — O(N) REST calls that drain the shared
installation's primary rate limit even when nothing changed.
Add github.PushFieldsEqual, comparing only the fields a push mutates
(title, body, state, and the label set BeadsIssueToGitHubFields sends,
order-insensitive). Wire a ContentEqual push hook (buildGitHubPushHooks)
into both runGitHubSync and runGitHubPush so the engine skips issues
already in sync — mirroring the existing Linear/Jira push hooks.
Dry-run still makes 0 REST calls (unchanged); this targets the live
re-PATCH storm. A push-side incremental cursor to also avoid the
per-issue fetch is a noted follow-up.
Fixes#4214
Co-authored-by: Cursor <cursoragent@cursor.com>
* perf(sync): skip per-issue fetch on no-op push via persisted content hash
The ContentEqual hook added for #4214 stops the redundant PATCH but still
fetches every linked issue (one GET each), so a no-op `github sync --push-only`
still drains the REST rate limit. Add a ContentHash push hook: the engine
persists each issue's pushed content hash in the dolt-ignored local_metadata
table and consults it before FetchIssue. When the local content is unchanged
since the last push, the fetch and update are skipped entirely.
Also record the hash when ContentEqual reports a match (so the first
post-restart pass repopulates hashes) and consult it in dry-run, so an
unchanged issue previews as a skip instead of always reporting "Would update".
Refs gastownhall/beads#4214
Co-authored-by: Cursor <cursoragent@cursor.com>
* shrink(github): simplify PushContentHash framing and labelSetsEqual
Replace length-prefix binary framing in PushContentHash with NUL-separated
fields — the hash is only self-compared, so the simpler scheme is sufficient.
Replace hand-rolled counting map in labelSetsEqual with slices.Sort +
slices.Equal. Drop unused encoding/binary, strconv, sort imports in favor
of slices.
Agent-Signature: cursor-opus-4.6-unknown-reasoning on behalf of kevglynn
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix(sync): bind push cache to remote target
Agent-Signature: codex-gpt-5.6-sol-medium on behalf of matt wilkie
---------
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: matt wilkie <maphew@gmail.com>
* fix(github): read github.token from config.yaml in tracker.Init
The github tracker's getConfig() only checked store.GetConfig (Dolt DB)
and the env var, but github.token is a yaml-only secret key and is
never stored in the DB. As a result, `bd github sync` errored with
"GitHub token not configured" even when the token was correctly set
in .beads/config.yaml via `bd config set github.token <token>`.
Mirror the pattern already used by internal/linear/tracker.go and
cmd/bd/github.go:getGitHubConfigValue(): check config.IsYamlOnlyKey
first and read from config.yaml for those keys.
Also adds TestGetConfig_YamlOnlyKeyBypassesStore: constructs a Tracker
with a nil store and verifies getConfig still resolves github.token via
env-var fallback — proof that yaml-only keys no longer deref the store.
Without the fix this test would panic on the nil store.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* test(github): cover yaml-read path for github.token getConfig
The original regression test (TestGetConfig_YamlOnlyKeyBypassesStore)
only proves the env-var fallback path through the yaml-only branch. It
does not assert the primary behavior the PR fixes: that github.token is
actually read from config.yaml when set there.
Add TestGetConfig_YamlOnlyKeyReadsFromYaml: writes a temp .beads/config.yaml
containing github.token, runs config.Initialize (with HOME/XDG isolated
and BEADS_TEST_IGNORE_REPO_CONFIG=1 so only the temp file loads), and
verifies tr.getConfig returns the yaml value with GITHUB_TOKEN unset.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
* fix: recognize ado:NNNNN shorthand in IsExternalRef and ExtractIdentifier
IsExternalRef and ExtractIdentifier only matched full ADO URLs
(/_workitems/edit/\d+), but BuildExternalRef produces ado:NNNNN
shorthand when org/project config is unavailable. This caused the
sync engine to treat existing beads as new, creating duplicate ADO
work items instead of updating existing ones.
Fixes harry-miller-trimble/beads#28
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: add shorthand ref support to GitHub/GitLab trackers, tighten ado:0
Address PR #2966 review feedback:
- GitHub tracker: add ghShorthandPattern (github:{id}) to IsExternalRef
and ExtractIdentifier, fixing the same duplicate-creation bug as ADO
- GitLab tracker: add glShorthandPattern (gitlab:{id}) to IsExternalRef
and ExtractIdentifier, fixing the same duplicate-creation bug as ADO
- ADO tracker: tighten regex from ^ado:(\d+)$ to ^ado:([1-9]\d*)$ to
reject ado:0 which is invalid in practice
- Add test cases for shorthand format in all three trackers
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>