Skip to content

Refactor PR status checks to use typed GraphQL union types#5

Merged
Armode merged 1 commit intorelective-pr-lookupfrom
copilot/update-cli-documentation
Mar 4, 2026
Merged

Refactor PR status checks to use typed GraphQL union types#5
Armode merged 1 commit intorelective-pr-lookupfrom
copilot/update-cli-documentation

Conversation

Copy link

Copilot AI commented Feb 28, 2026

PullRequest.ChecksStatus() was incorrectly deserializing StatusContext and CheckRun as flat fields, causing test failures when the GraphQL API returns them as discriminated union types.

Summary

Details

  • New PullRequestComplex type: Replaces direct State/Status/Conclusion fields on context nodes with proper StatusContext and CheckRun union sub-structs; adds PullRequestMinimal as a shared base
  • Rewritten PullRequests query: Migrated from raw GraphQL string to typed githubv4/graphql structs; introduces PullRequestByNumber and PullRequestForBranch via reflection for generic PR lookups
  • PullRequestDiff signature: Changed from *PullRequest to prNumber int — caller no longer needs a full PR struct to fetch a diff
  • PullRequestAndTotalCount: Now holds []PullRequestComplex; old []PullRequest variant renamed to LegacyPullRequestAndTotalCount
  • Test fixtures: Updated to match actual GraphQL response shapes — issueCount (was totalCount), nodes (was edges), projectCards (was projectcards)
  • api/pull_request_test.go: Updated JSON payload to wrap status nodes as {"StatusContext": {...}} / {"CheckRun": {...}} union objects
Original prompt

Pull Request: #4


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Update CLI documentation for improved clarity Refactor PR status checks to use typed GraphQL union types Feb 28, 2026
@Armode Armode marked this pull request as ready for review March 4, 2026 03:49
@Armode Armode self-requested a review March 4, 2026 03:50
@Armode Armode merged commit 00ccd35 into relective-pr-lookup Mar 4, 2026
2 checks passed
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