Skip to content

Migrate GitHubGraphQLClient to GraphQL.Client library with pagination support#77

Merged
Malcolmnixon merged 6 commits intomainfrom
copilot/switch-to-graphql-client
Feb 17, 2026
Merged

Migrate GitHubGraphQLClient to GraphQL.Client library with pagination support#77
Malcolmnixon merged 6 commits intomainfrom
copilot/switch-to-graphql-client

Conversation

Copy link
Contributor

Copilot AI commented Feb 16, 2026

Pull Request

Description

Refactored GitHubGraphQLClient from raw HttpClient to use GraphQL.Client library for type-safe GraphQL query execution. This standardizes GraphQL interactions and prepares the codebase for eventual Octokit retirement.

Key Changes:

  • Moved GitHubGraphQLClient to RepoConnectors/GitHub/ subfolder
  • Moved GitHubGraphQLClientTests.cs to test/DemaConsulting.BuildMark.Tests/RepoConnectors/GitHub/ subfolder to mirror production code structure
  • Added GraphQL.Client (v6.1.0) and GraphQL.Client.Serializer.SystemTextJson (v6.1.0)
  • Created flattened response record types in GitHubGraphQLTypes.cs
  • Replaced manual JSON serialization with GraphQLHttpClient.SendQueryAsync<T>()
  • Preserved constructor overload accepting HttpClient for test mocking
  • Implemented cursor-based pagination support with automatic page fetching
  • Updated all copyright headers to "Copyright (c) 2026 DEMA Consulting" to match LICENSE file

Implementation Details:

  • Response types are flattened in the namespace (no static class wrapper) for cleaner code organization
  • Added reusable PageInfo record type for pagination across future GraphQL queries
  • Cursor-based pagination automatically fetches all pages using hasNextPage and endCursor
  • Response types use nullable int? for IssueNode.Number to handle malformed API responses
  • Filters out nodes with missing numbers using LINQ .Where(n => n.Number.HasValue)
  • Maintains existing error handling (returns empty list on failure)
  • Removes previous 100-issue limitation with full pagination support

Type of Change

  • New feature (non-breaking change which adds functionality)
  • Code quality improvement

Related Issues

Pre-Submission Checklist

Before submitting this pull request, ensure you have completed the following:

Build and Test

  • Code builds successfully: dotnet build --configuration Release
  • All tests pass: dotnet test --configuration Release
  • Code produces zero warnings

Code Quality

  • Code formatting is correct: dotnet format --verify-no-changes
  • New code has appropriate XML documentation comments
  • Static analyzer warnings have been addressed

Quality Checks

Please run the following checks before submitting:

  • Spell checker passes: cspell "**/*.{md,cs}"
  • Markdown linter passes: markdownlint "**/*.md"
  • YAML linter passes: yamllint '**/*.{yml,yaml}'

Testing

  • Added unit tests for new functionality
  • Updated existing tests if behavior changed
  • All tests follow the AAA (Arrange, Act, Assert) pattern
  • Test coverage is maintained or improved

Documentation

  • Updated README.md (if applicable)
  • Updated ARCHITECTURE.md (if applicable)
  • Added code examples for new features (if applicable)
  • Updated requirements.yaml (if applicable)

Additional Notes

All 8 GitHubGraphQLClient unit tests pass, including a new test for pagination scenarios. CodeQL scan shows zero security alerts. Dependencies verified against GitHub Advisory Database with no vulnerabilities found.

The pagination implementation is designed to be reusable for future GraphQL queries, as the PageInfo record type can be used with any paginated GraphQL response.

Test files are now organized in a subfolder structure (test/DemaConsulting.BuildMark.Tests/RepoConnectors/GitHub/) that mirrors the production code organization, improving maintainability and discoverability.

Original prompt

This section details on the original issue you should resolve

<issue_title>[Feature]: Switch to GraphQL.Client</issue_title>
<issue_description>### Problem Statement

The GitHubGraphQLClient class should use GraphQL.Client and GraphQL.Client.Serializer.SystemTextJson to perform GraphQL qeries.

Proposed Solution

The current GitHubGraphQLClient.cs should:

  • Be moved to a src/DemaConsulting.BuildMark/RepoConnectors/GitHub sub-folder
  • Switch from using a naked HttpClient to using a GraphQLHttpClient
  • Still support taking an HttpClient for mocking (using the GraphQLHttpClient constructor that takes an HttpClient)
  • Create a file for the GitHub response types
  • Modify the GitHubGraphQLClient.FindIssueIdsLinkedToPullRequestAsync method to use the GraphQL.Client APIs

Note that once this PR is done, most of the Octokit queries will be converted to use GraphQL queries through GitHubGraphQLClient with the goal of retiring Octokit; and eventually other clients such as the Azure DevOps client will also make use of GraphQLHttpClient.

Alternatives Considered

No response

Usage Examples

Benefits

Use of standard GraphQL implementation

Priority

Low - Nice to have

Willingness to Contribute

Yes, I can submit a pull request

Additional Context

No response

Checklist

  • I have searched existing issues to ensure this is not a duplicate
  • I have provided a clear description of the feature
  • I have explained why this feature would be useful</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits February 16, 2026 19:30
Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Copilot AI changed the title [WIP] Switch GitHubGraphQLClient to use GraphQL.Client Migrate GitHubGraphQLClient to GraphQL.Client library Feb 16, 2026
Copilot AI requested a review from Malcolmnixon February 16, 2026 19:34
Copilot AI and others added 2 commits February 16, 2026 20:47
Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 16, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/demaconsulting/BuildMark/commits
    • Triggering command: /usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/BuildMark/BuildMark/test/DemaConsulting.BuildMark.Tests/bin/Release/net10.0/DemaConsulting.BuildMark.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/BuildMark/BuildMark/test/DemaConsulting.BuildMark.Tests/bin/Release/net10.0/DemaConsulting.BuildMark.Tests.deps.json /home/REDACTED/work/BuildMark/BuildMark/test/DemaConsulting.BuildMark.Tests/bin/Release/net10.0/testhost.dll --port 42457 --endpoint 127.0.0.1:042457 --role client --parentprocessid 5761 --telemetryoptedin false (http block)
  • https://api.github.com/repos/demaconsulting/BuildMark/issues
    • Triggering command: /usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/BuildMark/BuildMark/test/DemaConsulting.BuildMark.Tests/bin/Release/net10.0/DemaConsulting.BuildMark.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/BuildMark/BuildMark/test/DemaConsulting.BuildMark.Tests/bin/Release/net10.0/DemaConsulting.BuildMark.Tests.deps.json /home/REDACTED/work/BuildMark/BuildMark/test/DemaConsulting.BuildMark.Tests/bin/Release/net10.0/testhost.dll --port 42457 --endpoint 127.0.0.1:042457 --role client --parentprocessid 5761 --telemetryoptedin false (http block)
  • https://api.github.com/repos/demaconsulting/BuildMark/pulls
    • Triggering command: /usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/BuildMark/BuildMark/test/DemaConsulting.BuildMark.Tests/bin/Release/net10.0/DemaConsulting.BuildMark.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/BuildMark/BuildMark/test/DemaConsulting.BuildMark.Tests/bin/Release/net10.0/DemaConsulting.BuildMark.Tests.deps.json /home/REDACTED/work/BuildMark/BuildMark/test/DemaConsulting.BuildMark.Tests/bin/Release/net10.0/testhost.dll --port 42457 --endpoint 127.0.0.1:042457 --role client --parentprocessid 5761 --telemetryoptedin false (http block)
  • https://api.github.com/repos/demaconsulting/BuildMark/releases
    • Triggering command: /usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/BuildMark/BuildMark/test/DemaConsulting.BuildMark.Tests/bin/Release/net10.0/DemaConsulting.BuildMark.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/BuildMark/BuildMark/test/DemaConsulting.BuildMark.Tests/bin/Release/net10.0/DemaConsulting.BuildMark.Tests.deps.json /home/REDACTED/work/BuildMark/BuildMark/test/DemaConsulting.BuildMark.Tests/bin/Release/net10.0/testhost.dll --port 42457 --endpoint 127.0.0.1:042457 --role client --parentprocessid 5761 --telemetryoptedin false (http block)
  • https://api.github.com/repos/demaconsulting/BuildMark/tags
    • Triggering command: /usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/BuildMark/BuildMark/test/DemaConsulting.BuildMark.Tests/bin/Release/net10.0/DemaConsulting.BuildMark.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/BuildMark/BuildMark/test/DemaConsulting.BuildMark.Tests/bin/Release/net10.0/DemaConsulting.BuildMark.Tests.deps.json /home/REDACTED/work/BuildMark/BuildMark/test/DemaConsulting.BuildMark.Tests/bin/Release/net10.0/testhost.dll --port 42457 --endpoint 127.0.0.1:042457 --role client --parentprocessid 5761 --telemetryoptedin false (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title Migrate GitHubGraphQLClient to GraphQL.Client library Migrate GitHubGraphQLClient to GraphQL.Client library with pagination support Feb 16, 2026
Copilot AI requested a review from Malcolmnixon February 16, 2026 20:50
Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 16, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/demaconsulting/BuildMark/commits
    • Triggering command: /usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/BuildMark/BuildMark/test/DemaConsulting.BuildMark.Tests/bin/Release/net10.0/DemaConsulting.BuildMark.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/BuildMark/BuildMark/test/DemaConsulting.BuildMark.Tests/bin/Release/net10.0/DemaConsulting.BuildMark.Tests.deps.json /home/REDACTED/work/BuildMark/BuildMark/test/DemaConsulting.BuildMark.Tests/bin/Release/net10.0/testhost.dll --port 46527 --endpoint 127.0.0.1:046527 --role client --parentprocessid 4192 --telemetryoptedin false (http block)
  • https://api.github.com/repos/demaconsulting/BuildMark/issues
    • Triggering command: /usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/BuildMark/BuildMark/test/DemaConsulting.BuildMark.Tests/bin/Release/net10.0/DemaConsulting.BuildMark.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/BuildMark/BuildMark/test/DemaConsulting.BuildMark.Tests/bin/Release/net10.0/DemaConsulting.BuildMark.Tests.deps.json /home/REDACTED/work/BuildMark/BuildMark/test/DemaConsulting.BuildMark.Tests/bin/Release/net10.0/testhost.dll --port 46527 --endpoint 127.0.0.1:046527 --role client --parentprocessid 4192 --telemetryoptedin false (http block)
  • https://api.github.com/repos/demaconsulting/BuildMark/pulls
    • Triggering command: /usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/BuildMark/BuildMark/test/DemaConsulting.BuildMark.Tests/bin/Release/net10.0/DemaConsulting.BuildMark.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/BuildMark/BuildMark/test/DemaConsulting.BuildMark.Tests/bin/Release/net10.0/DemaConsulting.BuildMark.Tests.deps.json /home/REDACTED/work/BuildMark/BuildMark/test/DemaConsulting.BuildMark.Tests/bin/Release/net10.0/testhost.dll --port 46527 --endpoint 127.0.0.1:046527 --role client --parentprocessid 4192 --telemetryoptedin false (http block)
  • https://api.github.com/repos/demaconsulting/BuildMark/releases
    • Triggering command: /usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/BuildMark/BuildMark/test/DemaConsulting.BuildMark.Tests/bin/Release/net10.0/DemaConsulting.BuildMark.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/BuildMark/BuildMark/test/DemaConsulting.BuildMark.Tests/bin/Release/net10.0/DemaConsulting.BuildMark.Tests.deps.json /home/REDACTED/work/BuildMark/BuildMark/test/DemaConsulting.BuildMark.Tests/bin/Release/net10.0/testhost.dll --port 46527 --endpoint 127.0.0.1:046527 --role client --parentprocessid 4192 --telemetryoptedin false (http block)
  • https://api.github.com/repos/demaconsulting/BuildMark/tags
    • Triggering command: /usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/BuildMark/BuildMark/test/DemaConsulting.BuildMark.Tests/bin/Release/net10.0/DemaConsulting.BuildMark.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/BuildMark/BuildMark/test/DemaConsulting.BuildMark.Tests/bin/Release/net10.0/DemaConsulting.BuildMark.Tests.deps.json /home/REDACTED/work/BuildMark/BuildMark/test/DemaConsulting.BuildMark.Tests/bin/Release/net10.0/testhost.dll --port 46527 --endpoint 127.0.0.1:046527 --role client --parentprocessid 4192 --telemetryoptedin false (http block)

If you need me to access, download, or install something from one of these locations, you can either:

@Malcolmnixon Malcolmnixon marked this pull request as ready for review February 17, 2026 03:10
@Malcolmnixon Malcolmnixon merged commit 82f54bd into main Feb 17, 2026
11 checks passed
@Malcolmnixon Malcolmnixon deleted the copilot/switch-to-graphql-client branch February 17, 2026 03:10
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.

[Feature]: Switch to GraphQL.Client

2 participants