* feat(github): sync epic/child and blocks relationships to GitHub bd github sync only ever pushed issue content (title/body/labels/state); Epic-child links and beads "blocks" dependencies never reached GitHub's relationships panel. Adds a GitHub relationship-sync pass, mirroring the existing GitLab dependency-link push, using GitHub's sub-issues and issue dependencies REST APIs: - internal/github/client.go: AddSubIssue/ListSubIssues and AddBlockedBy/ListBlockedBy against GitHub's sub_issues and dependencies/blocked_by endpoints. - internal/github/links.go: DependencyLink + LinkResolver, converting beads epic/child parent-child dependencies into GitHub sub-issues and beads "blocks" dependencies into GitHub blocked_by relationships. Idempotent (lists current relationships before creating) and additive (stale remote relationships are left untouched). - cmd/bd/github.go, cmd/bd/sync_push_pull.go: wires the push pass into both `bd github sync` and `bd github push`. Verified against a live GitHub repo (create, list, and idempotent re-push all confirmed via the real API), in addition to httptest-mocked unit tests. Fixes gastownhall/beads#5970 * fix(github): update last_sync after relationship push to prevent sync churn When AddSubIssue or AddBlockedBy is called, GitHub updates the issue's updated_at timestamp as a side effect. Without updating last_sync after the relationship push completes, the next sync would see those issues as 'changed' and pull/push them again, causing unnecessary churn. This fix updates last_sync to the current time after a successful relationship push (only if links were created), accounting for any timestamp changes GitHub made during relationship creation. Fixes continuous sync churn observed when running bd github sync multiple times with no local changes. * fix(github): use relationship reader for link sync * fix(bazel): enumerate links.go and its tests in internal/github BUILD.bazel The base advance added internal/github/BUILD.bazel with explicitly enumerated srcs (gazelle-generated). This PR adds links.go, links_test.go and review_fixes_test.go, which the base-generated enumeration cannot know about, so //internal/github:github failed to build: internal/github/tracker.go:41:35: undefined: LinkResolver internal/github/tracker.go:244:30: undefined: RefScope Regenerated with `bazel run //:gazelle` (not hand-edited). Purely additive; no deps change is needed because links.go only imports //internal/types, already declared. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * fix(github): scope the relationship pass to --parent and report skipped links Maintainer review fixup for PR #5971, adopt-pr review iterations 1 and 3. filterGitHubLinkScopedIssues reimplemented four of the SyncOptions selectors and dropped ParentID, so `bd github sync --push --parent X` narrowed the content push to the subtree and then created GitHub sub-issue and blocked-by links for every GitHub-linked issue in the workspace -- outward API writes on issues the user had excluded. It now resolves the subtree and requires membership in it. The traversal moves from gitlab.go to sync_flags.go as buildSyncDescendantSet, beside the --parent flag that populates the field, and the GitLab and GitHub link passes share the one copy. The doc comments that claimed parity with the engine's push loop now enumerate the selectors this path actually applies, and name the three it does not (State, ExcludeIDPrefix, ExcludeIDPatterns -- no GitHub command sets them today). PushLinkResult.UnsupportedSkipped had no reader anywhere in the repo, so a host without the sub-issue/dependency APIs reported nothing at all. pushGitHubDependencyLinks now emits one curated line for it, and a 404 on the source issue is classified apart from a 404 on the relationship endpoint: collapsing the two reported a deleted, renumbered or permission-hidden issue as an unsupported host. The classifying probe is memoized per issue number, so a source carrying both link types costs one extra read. `bd github push --dry-run` printed "Synced N relationship links" for links it had only planned, because PushLinks counts planned links in Created. The `bd github sync` twin already gated that line on its dry-run flag; the push side now does too. Tests: a table test over filterGitHubLinkScopedIssues with a row per selector -- its three ParentID rows fail without the scope fix -- plus a direct pin that a blocks-edge dependent is not a descendant, and httptest cases driving 404 through the list call, the create call and the source-issue probe. Not fixed here: the PR body still describes a `lastSync` advance that commit ee6d65692 removed from this PR. That is a PR-surface edit, not a code change, and is left to the finalize step. Also not fixed here, and named in buildSyncDescendantSet's doc comment so the shared helper does not read as covering every tracker: the ADO link pass has the same scope hole this commit closes for GitHub. pushADOLinks takes no sync options, so `bd ado sync --push --parent X` still writes ADO relations for the whole workspace. That predates this PR, and ADO is outside its diff. Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Gas City Adopt-PR Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Julian Knutsen <julian@gastownhall.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local>
40 lines
867 B
Python
40 lines
867 B
Python
load("@rules_go//go:def.bzl", "go_library", "go_test")
|
|
|
|
go_library(
|
|
name = "github",
|
|
srcs = [
|
|
"client.go",
|
|
"errors.go",
|
|
"fieldmapper.go",
|
|
"links.go",
|
|
"mapping.go",
|
|
"tracker.go",
|
|
"types.go",
|
|
],
|
|
importpath = "github.com/steveyegge/beads/internal/github",
|
|
visibility = ["//:__subpackages__"],
|
|
deps = [
|
|
"//internal/config",
|
|
"//internal/tracker",
|
|
"//internal/types",
|
|
],
|
|
)
|
|
|
|
go_test(
|
|
name = "github_test",
|
|
srcs = [
|
|
"client_ratelimit_test.go",
|
|
"links_test.go",
|
|
"mapping_test.go",
|
|
"push_dedup_test.go",
|
|
"review_fixes_test.go",
|
|
"tracker_test.go",
|
|
"types_test.go",
|
|
],
|
|
embed = [":github"],
|
|
deps = [
|
|
"//internal/config",
|
|
"//internal/tracker",
|
|
"//internal/types",
|
|
],
|
|
)
|