Skip to content

fix: add authorAssociation to IssueFragment (GraphQL path)#2265

Open
lanxevo3 wants to merge 1 commit into
github:mainfrom
lanxevo3:main
Open

fix: add authorAssociation to IssueFragment (GraphQL path)#2265
lanxevo3 wants to merge 1 commit into
github:mainfrom
lanxevo3:main

Conversation

@lanxevo3

Copy link
Copy Markdown

Summary

Adds the missing \�uthorAssociation\ field to the \IssueFragment\ GraphQL struct and populates it in \ ragmentToMinimalIssue(), fixing the missing \�uthor_association\ field in \list_issues\ responses when using the GraphQL path.

Changes

  • \pkg/github/issues.go: Added \Author.Association\ field to \IssueFragment\ struct (GraphQL)
  • \pkg/github/minimal_types.go: Set \AuthorAssociation\ in \ ragmentToMinimalIssue()\ from \ ragment.Author.Association\

Note

The REST path (\convertToMinimalIssue()) already correctly sets \AuthorAssociation\ from \issue.GetAuthorAssociation(). The GraphQL path was missing this field.

Fixes #2250

Adds missing authorAssociation field to IssueFragment GraphQL struct
and populates it in fragmentToMinimalIssue(), fixing the missing
author_association field in list_issues responses from the GraphQL path.

The REST path already correctly sets this via convertToMinimalIssue().
Fixes github#2250.
@lanxevo3 lanxevo3 requested a review from a team as a code owner March 26, 2026 20:28
@lanxevo3

Copy link
Copy Markdown
Author

Hey @github/mcp-team — checking in on this PR. It's been open since March 26 and is mergeable. Adds �uthorAssociation field to IssueFragment to fix the GraphQL codegen path. Any blockers or feedback? Happy to iterate.

@SamMorrowDrums

Copy link
Copy Markdown
Collaborator

Hi, I will try to look and get this in soon. It does make sense to provide the data.

@SamMorrowDrums SamMorrowDrums left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for tackling this @lanxevo3, and apologies for the slow response.

Unfortunately the change as written won't work at runtime — authorAssociation isn't a field on the Actor interface that author returns, it's a top-level field on the Issue node itself. I verified against the live GraphQL API:

$ gh api graphql -f query='{ repository(owner:"github", name:"github-mcp-server") { issues(first:1) { nodes { author { login association } } } } }'
{"errors":[{"message":"Field 'association' doesn't exist on type 'Actor'", ...}]}

vs. the correct shape:

$ gh api graphql -f query='{ repository(owner:"github", name:"github-mcp-server") { issues(first:1) { nodes { authorAssociation author { login } } } } }'
{"data":{"repository":{"issues":{"nodes":[{"authorAssociation":"MEMBER","author":{"login":"toby"}}]}}}}

The unit tests pass because they mock the GraphQL response shape rather than validating against the real schema, so this slipped through.

What needs to change

In pkg/github/issues.go, move the field out of the Author struct and onto IssueFragment itself:

type IssueFragment struct {
    Number            githubv4.Int
    Title             githubv4.String
    Body              githubv4.String
    State             githubv4.String
    DatabaseID        int64
    AuthorAssociation githubv4.String

    Author struct {
        Login githubv4.String
    }
    // ...
}

In pkg/github/minimal_types.go, read the new field directly:

AuthorAssociation: string(fragment.AuthorAssociation),

One more (optional) ask

Issue #2250 also calls out that MinimalPullRequest is missing author_association on the REST path — it'd be great to address that here too while you're at it, but happy to take it as a follow-up if you'd rather keep this PR focused.

Let me know if you'd like me to push the fix on top, otherwise feel free to update and I'll re-review. Thanks!

@advancedresearcharray

Copy link
Copy Markdown

Addressed the review feedback from @SamMorrowDrumsauthorAssociation is a top-level field on the Issue node, not on Actor.

Changes

pkg/github/issues.go

  • Added AuthorAssociation githubv4.String to IssueFragment (and LegacyIssueFragment for the flag-disabled path)
  • Removed the incorrect Author.Association nested field from the original PR

pkg/github/minimal_types.go

pkg/github/issues_test.go

  • Updated GraphQL query matchers to include authorAssociation
  • Mock responses now use top-level authorAssociation (matching the live schema)
  • Added assertions that the field is populated in responses

Ready branch

Rebased on current main (includes #2605): https://github.com/advancedresearcharray/github-mcp-server/tree/fix/author-association-issue-fragment-2265

Compare: main...advancedresearcharray:fix/author-association-issue-fragment-2265

go test ./pkg/github/ -count=1 passes.

@lanxevo3 — if you can cherry-pick or merge that branch onto main in your fork, this should be ready for re-review. @SamMorrowDrums — happy for you to push the fix on top here if that's easier (maintainer edits are enabled).

advancedresearcharray pushed a commit to advancedresearcharray/github-mcp-server that referenced this pull request Jun 6, 2026
Move authorAssociation onto the Issue GraphQL node (not Actor.author) per
review feedback on github#2265, populate it in fragmentToMinimalIssue and the
legacy GraphQL path, and add author_association to MinimalPullRequest on
the REST path (fixes github#2250).

Co-authored-by: Cursor <cursoragent@cursor.com>
advancedresearcharray pushed a commit to advancedresearcharray/github-mcp-server that referenced this pull request Jun 6, 2026
Move authorAssociation onto the Issue GraphQL node (not Actor.author) per
review feedback on github#2265, populate it in fragmentToMinimalIssue and the
legacy GraphQL path, and add author_association to MinimalPullRequest on
the REST path (fixes github#2250).

Co-authored-by: Cursor <cursoragent@cursor.com>
advancedresearcharray pushed a commit to advancedresearcharray/github-mcp-server that referenced this pull request Jun 6, 2026
Move authorAssociation onto the Issue GraphQL node (not Actor.author) per
review feedback on github#2265, populate it in fragmentToMinimalIssue and the
legacy GraphQL path, and add author_association to MinimalPullRequest on
the REST path (fixes github#2250).
advancedresearcharray pushed a commit to advancedresearcharray/github-mcp-server that referenced this pull request Jun 6, 2026
Move authorAssociation onto the Issue GraphQL node (not Actor.author) per
review feedback on github#2265, populate it in fragmentToMinimalIssue and the
legacy GraphQL path, and add author_association to MinimalPullRequest on
the REST path (fixes github#2250).
@advancedresearcharray

Copy link
Copy Markdown

Updated the fix branch per @SamMorrowDrums's review feedback — authorAssociation is now a top-level field on IssueFragment (not nested under Actor.author), with tests and MinimalPullRequest.author_association included.

Verification: go test ./pkg/github/ -count=1 passes on current main.

Delivery options (no write access to lanxevo3/github-mcp-server):

  1. Ready branch: https://github.com/advancedresearcharray/github-mcp-server/tree/fix/author-association-issue-fragment-2265
  2. PR to update author's fork: fix: address review feedback for #2265 (authorAssociation on Issue node) lanxevo3/github-mcp-server#1 — merging this updates the fix: add authorAssociation to IssueFragment (GraphQL path) #2265 head branch
  3. Upstream PR with the fix: fix: add authorAssociation to IssueFragment (GraphQL path) #2620 — maintainers can merge this directly if preferred

@SamMorrowDrums — since maintainer edits are enabled on this PR, pushing the fix branch onto lanxevo3/main would also unblock re-review here. Happy to close #2265 in favor of #2620 if that's easier.

@advancedresearcharray

Copy link
Copy Markdown

Addressed @SamMorrowDrums's review feedback — authorAssociation is now a top-level field on IssueFragment (not nested under Actor.author), with tests and MinimalPullRequest.author_association included.

Changes (4 files)

pkg/github/issues.go

  • Added AuthorAssociation githubv4.String to IssueFragment (and LegacyIssueFragment)
  • Removed the incorrect Author.Association nested field

pkg/github/minimal_types.go

pkg/github/issues_test.go

  • Updated GraphQL query matchers to include authorAssociation
  • Mock responses now use top-level authorAssociation (matching the live schema)
  • Added assertions that the field is populated in responses

pkg/github/pullrequests_test.go

  • Added author_association assertions for get/list pull request handlers

Verification

go test ./pkg/github/ -count=1 -run 'Test_ListIssues|Test_GetPullRequest|Test_ListPullRequests' passes.

Delivery

Ready branch rebased on this PR's head: https://github.com/advancedresearcharray/github-mcp-server/tree/fix/pr-2265-review-feedback

Mergeable PR to update this head branch: lanxevo3#2

@SamMorrowDrums — maintainer edits are enabled; pushing the fix branch onto lanxevo3/main would unblock re-review here. Alternatively, the same fix on current main is in #2620.

advancedresearcharray added a commit to advancedresearcharray/github-mcp-server that referenced this pull request Jun 6, 2026
Move authorAssociation onto the Issue GraphQL node (not Actor.author) per
review feedback on github#2265, populate it in fragmentToMinimalIssue and the
legacy GraphQL path, and add author_association to MinimalPullRequest on
the REST path (fixes github#2250).

@perplexiphone-cmd perplexiphone-cmd left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Issue

advancedresearcharray pushed a commit to advancedresearcharray/github-mcp-server that referenced this pull request Jun 9, 2026
Move authorAssociation onto the Issue GraphQL node (not Actor.author) per
review feedback on github#2265, populate it in fragmentToMinimalIssue and the
legacy GraphQL path, and add author_association to MinimalPullRequest on
the REST path (fixes github#2250).
advancedresearcharray pushed a commit to advancedresearcharray/github-mcp-server that referenced this pull request Jun 9, 2026
Move authorAssociation to a top-level field on IssueFragment and
LegacyIssueFragment per the GitHub GraphQL schema, populate it in
fragmentToMinimalIssue conversions, and add MinimalPullRequest REST
path coverage with tests.

Fixes github#2250. Addresses review feedback on github#2265.

Co-authored-by: Cursor <cursoragent@cursor.com>
advancedresearcharray pushed a commit to advancedresearcharray/github-mcp-server that referenced this pull request Jun 29, 2026
Move authorAssociation to a top-level field on IssueFragment per the GitHub
GraphQL schema, populate it in fragmentToMinimalIssue, and add
MinimalPullRequest REST path coverage with tests.

Rebased on current main. Fixes github#2250. Addresses review feedback on github#2265.

Co-authored-by: Cursor <cursoragent@cursor.com>
advancedresearcharray pushed a commit to advancedresearcharray/github-mcp-server that referenced this pull request Jun 29, 2026
Move authorAssociation to a top-level field on IssueFragment per the GitHub
GraphQL schema, populate it in fragmentToMinimalIssue, and add
MinimalPullRequest REST path coverage with tests.

Rebased on current main. Fixes github#2250. Addresses review feedback on github#2265.

Co-authored-by: Cursor <cursoragent@cursor.com>
advancedresearcharray pushed a commit to advancedresearcharray/github-mcp-server that referenced this pull request Jun 29, 2026
Move authorAssociation to a top-level field on IssueFragment per the GitHub
GraphQL schema, populate it in fragmentToMinimalIssue, and add
MinimalPullRequest REST path coverage with tests.

Rebased on current main. Fixes github#2250. Addresses review feedback on github#2265.
advancedresearcharray pushed a commit to advancedresearcharray/github-mcp-server that referenced this pull request Jun 29, 2026
Move authorAssociation to a top-level field on IssueFragment per the GitHub
GraphQL schema, populate it in fragmentToMinimalIssue, and add
MinimalPullRequest REST path coverage with tests.

Fixes github#2250. Addresses review feedback on github#2265.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants