Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve Race Condition in Pull RequestManager #9876

Open
chidozieononiwu opened this issue Feb 20, 2025 · 0 comments
Open

Resolve Race Condition in Pull RequestManager #9876

chidozieononiwu opened this issue Feb 20, 2025 · 0 comments
Labels
APIView Central-EngSys This issue is owned by the Engineering System team.

Comments

@chidozieononiwu
Copy link
Member

Occurs when a PR contains changes in multiple packages. Especially when those changes are made incrementally with multiple commits
Detect-API-Change step fires multiple calls to APIView for the various packages
One single package that does not have an existing pull request will cause the entire PR comment to be over written.

Image

The issue starts at

var pullRequestModel = await _pullRequestsRepository.GetPullRequestAsync(prNumber, repoName, packageName, language);
if (pullRequestModel == null)
{
var repoInfo = repoName.Split("/");
var pullRequest = await _githubClient.PullRequest.Get(repoInfo[0], repoInfo[1], prNumber);
pullRequestModel = new PullRequestModel()
{
RepoName = repoName,
PullRequestNumber = prNumber,
FilePath = originalFile,
CreatedBy = pullRequest.User.Login,
PackageName = packageName,
Language = language,
Assignee = pullRequest.Assignee?.Login
};
}
return pullRequestModel;

If no pullRequestModel is found for the package it will create a new pullRequestModel with no APIRevisionId (Line 78)

The presence of APIRevisionId determines if we fetch pullRequest information

if (!string.IsNullOrEmpty(pullRequestModel.APIRevisionId))

Then we later check there is any pr info

This leads to all the packages in the PR being marked as having no changes even though its just one package

else
{
bldr.Append(PR_APIVIEW_BOT_NO_CHANGE_COMMENT);
}

@github-actions github-actions bot added the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Feb 20, 2025
@kurtzeborn kurtzeborn added APIView Central-EngSys This issue is owned by the Engineering System team. and removed needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. labels Feb 24, 2025
@github-project-automation github-project-automation bot moved this to 🆕 New in ApiView Feb 24, 2025
@kurtzeborn kurtzeborn moved this from 🤔 Triage to 📋 Backlog in Azure SDK EngSys 🤖🧠 Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
APIView Central-EngSys This issue is owned by the Engineering System team.
Projects
Status: 🆕 New
Status: 📋 Backlog
Development

No branches or pull requests

2 participants