fix: add authorAssociation to IssueFragment (GraphQL path)#2265
fix: add authorAssociation to IssueFragment (GraphQL path)#2265lanxevo3 wants to merge 1 commit into
Conversation
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.
|
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. |
|
Hi, I will try to look and get this in soon. It does make sense to provide the data. |
SamMorrowDrums
left a comment
There was a problem hiding this comment.
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!
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
Note
The REST path (\convertToMinimalIssue()) already correctly sets \AuthorAssociation\ from \issue.GetAuthorAssociation(). The GraphQL path was missing this field.
Fixes #2250