Skip to content

Conversation

@adamzip
Copy link
Contributor

@adamzip adamzip commented Jul 21, 2025

Copilot AI review requested due to automatic review settings July 21, 2025 12:44
Copy link
Contributor

Copilot AI left a comment

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 introduces GitHub ETag caching functionality to improve API performance and reduce rate limiting issues when fetching GitHub resources. The implementation adds Redis-based caching support and refactors pull request models to use internal types instead of Octokit types.

  • Implements ETag-based caching mechanism for GitHub API resources to reduce redundant requests
  • Refactors pull request models to use internal DarcLib types instead of directly exposing Octokit types
  • Adds Redis cache client integration across multiple components and test projects

Reviewed Changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/Microsoft.DotNet.Darc/DarcLib/Models/*.cs New model classes and interfaces supporting ETag caching
src/Microsoft.DotNet.Darc/DarcLib/GitHubClient.cs Implements ETag-based resource fetching and removes unused comment functionality
src/ProductConstructionService/ProductConstructionService.DependencyFlow/PullRequestUpdater.cs Updates to use HeadBranchCommitSha instead of TargetBranchCommitSha
test/* files Updates constructors and type references to support new Redis cache dependency
src/*/RemoteFactory.cs Adds Redis cache client parameter to factory constructors
Comments suppressed due to low confidence (1)

src/Microsoft.DotNet.Darc/DarcLib/Models/GithubResourceConverters.cs:12

  • [nitpick] The class name 'GitResourceConverters' should be 'GithubResourceConverters' to match the filename and maintain consistency with the GitHub naming convention used elsewhere in the codebase.
internal class GitResourceConverters

@adamzip adamzip force-pushed the use-github-etags branch 2 times, most recently from 3d0485e to 76a28f5 Compare July 22, 2025 01:26
@adamzip adamzip requested review from dkurepa and premun July 22, 2025 01:44
IGitHubClient client,
Func<K, T> resourceConverter)
{
await Task.FromResult<T>(null);
Copy link
Member

Choose a reason for hiding this comment

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

why do we have this line here?

Copy link
Member

Choose a reason for hiding this comment

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

Not sure I understand the point of this implementation in general

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are testing GithubClient's GetLatestPullRequestReviewsAsync as a whole, but we need to mock the part of GithubClient (the overriden method implementation you are commenting on) that actually fetches the reviews.
I hate this implementation too so let me know if you have another idea.
Even though RequestResourceUsingEtagsAsync is just one method, maybe it should be on a different layer than GithubClient - just how the Octokit client that actually fetches the resource is on a different layer from GithubClient, which has logic for what to do with the base resources

@adamzip adamzip requested a review from dkurepa July 22, 2025 22:29
premun
premun previously approved these changes Jul 29, 2025
TargetBranchCommitSha was erroneously called "target branch" because it
represents the branch in the codeflow that belongs to the `target` repo.
Howevever, in practice it is actually the PR Head branch. Therefore it
is now renamed to HeadBranchCommitSha.
Furthermore, setting HeadBRanchCommitSha is fixed in the Azdo client.
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.

3 participants