Skip to content

Reimplement issue dependencies on go-github v89 REST API#2839

Open
tommaso-moro wants to merge 2 commits into
mainfrom
tommaso-moro-issue-dependencies-go-github
Open

Reimplement issue dependencies on go-github v89 REST API#2839
tommaso-moro wants to merge 2 commits into
mainfrom
tommaso-moro-issue-dependencies-go-github

Conversation

@tommaso-moro

@tommaso-moro tommaso-moro commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Switches the issue_dependency_read / issue_dependency_write tools from the GraphQL (githubv4) implementation to the first-class REST methods added in go-github v89.

Why

Issue dependencies (added in #2751) were built on GraphQL via githubv4. Because the pinned githubv4 library predates the dependency mutations, the code had to hand-declare AddBlockedByInput / RemoveBlockedByInput and resolve issue numbers to node IDs with a custom aliased query. go-github v89 now exposes maintained, typed REST methods (ListBlockedBy, ListBlocking, AddBlockedBy, RemoveBlockedBy), so the tools can drop the workaround and align with the rest of the REST-based issue tooling.

Refs #950 (original feature request; the capability itself already shipped in #2751 — this PR is a cleanup onto the public REST API).

What changed

  • Rewrite issue_dependencies.go on REST: page-based pagination for reads, and a single Issues.Get to resolve the blocking issue's database ID for writes. Tool names, methods, the self-dependency guard, and cross-repo support are all preserved.
  • Rewrite the issue-dependency tests on the REST mock helpers (drop githubv4mock for this file).
  • Regenerate the read toolsnap (cursor → page pagination) and the feature-flag docs.

MCP impact

  • Tool schema or behavior changed
    • issue_dependency_read pagination changes from cursor-based (after) to standard REST page-based (page / perPage), matching other list tools. issue_dependency_write behavior is unchanged. Both remain gated behind the issue_dependencies feature flag.

Prompts tested (tool changes only)

Covered by unit tests against the REST mock (both tools are feature-flagged; not exercised via live e2e here):

Security / limits

  • Auth / permissions considered
    • Same repo scope and behavior as before; no change to data exposure. Dependency tools stay behind the issue_dependencies feature flag.

Tool renaming

  • I am not renaming tools as part of this PR

Lint & tests

  • Linted locally with ./script/lint
  • Tested locally with ./script/test

I tested the tools manually too, example screenshot:
Screenshot 2026-07-08 at 14 21 32

Docs

  • Updated (README / docs / examples)

@tommaso-moro tommaso-moro force-pushed the tommaso-moro-issue-dependencies-go-github branch from 59d76d6 to 9247ed7 Compare July 8, 2026 10:17
@tommaso-moro tommaso-moro changed the base branch from main to tommaso-moro-bump-go-github-v89 July 8, 2026 10:18
@tommaso-moro tommaso-moro marked this pull request as ready for review July 8, 2026 13:21
@tommaso-moro tommaso-moro requested a review from a team as a code owner July 8, 2026 13:21
Copilot AI review requested due to automatic review settings July 8, 2026 13:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates the issue_dependency_read / issue_dependency_write feature-flagged tools from a GitHub GraphQL (githubv4) implementation to the first-class REST issue-dependency endpoints introduced in go-github/v89, aligning these tools with the rest of the REST-based issue tooling.

Changes:

  • Reimplemented issue dependency reads/writes in pkg/github/issue_dependencies.go using REST (ListBlockedBy, ListBlocking, AddBlockedBy, RemoveBlockedBy) and page-based pagination (page/perPage).
  • Rewrote unit tests to use the REST mock backend helpers (dropping githubv4mock for this tool).
  • Updated the tool snapshot and regenerated feature-flag/insiders docs to reflect pagination parameter changes.
Show a summary per file
File Description
pkg/github/issue_dependencies.go Switches dependency tooling from GraphQL to REST and updates pagination shape.
pkg/github/issue_dependencies_test.go Updates tests to mock REST endpoints and validate new pagination/output behavior.
pkg/github/toolsnaps/issue_dependency_read_ff_issue_dependencies.snap Updates tool schema snapshot (cursor → page pagination).
docs/insiders-features.md Regenerates docs to reflect page param and remove after.
docs/feature-flags.md Regenerates docs to reflect page param and remove after.

Review details

  • Files reviewed: 5/5 changed files
  • Comments generated: 4
  • Review effort level: Low

Comment thread pkg/github/issue_dependencies.go
Comment thread pkg/github/issue_dependencies.go
Comment thread pkg/github/issue_dependencies.go
Comment thread pkg/github/issue_dependencies_test.go
@tommaso-moro tommaso-moro force-pushed the tommaso-moro-issue-dependencies-go-github branch from 9247ed7 to 5e5e7ec Compare July 8, 2026 14:01
Base automatically changed from tommaso-moro-bump-go-github-v89 to main July 8, 2026 14:09
@tommaso-moro tommaso-moro marked this pull request as draft July 8, 2026 14:09
tommaso-moro and others added 2 commits July 8, 2026 16:24
Issue dependencies (blocked_by / blocking) were implemented on GraphQL via
githubv4. Because the pinned githubv4 library predates the dependency
mutations, the code hand-declared AddBlockedByInput / RemoveBlockedByInput
and resolved issue numbers to node IDs with a custom aliased query.

go-github v89 adds first-class REST methods (ListBlockedBy, ListBlocking,
AddBlockedBy, RemoveBlockedBy), so switch issue_dependency_read and
issue_dependency_write to those. This removes the workaround, aligns the
tools with the rest of the REST-based issue tooling, and simplifies tests.

- Rewrite issue_dependencies.go on REST: page-based pagination for reads,
  and a single Issues.Get to resolve the blocking issue's database ID for
  writes. Preserve the tool surface, self-dependency guard and cross-repo
  support.
- Rewrite the issue dependency tests on the REST mock helpers.
- Regenerate the read toolsnap (cursor -> page pagination) and docs.

Refs #950

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The REST issue-dependency endpoints return lower-case issue states
(open/closed), whereas the previous GraphQL implementation and the
sibling get_parent tool populate MinimalIssueRef.State from the GraphQL
IssueState enum (OPEN/CLOSED). Upper-case the state in
issueToDependencyRef so the field stays consistent across every tool that
emits a MinimalIssueRef, and guard against a nil issue while here.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@tommaso-moro tommaso-moro force-pushed the tommaso-moro-issue-dependencies-go-github branch from c5226df to e556a6e Compare July 8, 2026 15:24
@tommaso-moro tommaso-moro marked this pull request as ready for review July 8, 2026 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants