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

Handle open/close PR events in PR tracking #1905

Merged
merged 4 commits into from
Feb 18, 2025

Conversation

Kobzol
Copy link
Contributor

@Kobzol Kobzol commented Feb 17, 2025

This should improve the robustness of PR tracking, as before it was not taking (re)open/close/merge PR events into account. This PR also extends the test infrastructure. We still don't test the input/output GitHub API calls, but even just testing the DB is better than nothing.

Best reviewed commit by commit.

r? @apiraino :)

Copy link
Contributor

@apiraino apiraino left a comment

Choose a reason for hiding this comment

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

I checked the code part and skimmed through the tests.

Besides a nit , I think it looks good.

thanks @Kobzol !

Comment on lines +181 to +183
record_username(db, user.id, &user.login)
.await
.context("failed to record username")?;
Copy link
Contributor

Choose a reason for hiding this comment

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

Here there is now a "hidden" a second SQL query where I expect to only have one. upsert_pr_into_workqueue says to just "Add a PR to the workqueue of a team member", we are sort of breaking this promise.

Maybe call record_username() just before (at the cost of calling everywhere)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think that it's better if the function works in a self-contained way, rather than not working if you don't call a specific other function before it. We don't call it in a loop outside tests, it's always called incrementally, and the code that calls it always called record_username before it anyways, so there wouldn't be any change.

But mainly, I want to nuke this whole code in a follow-up PR, so.. 😆

Comment on lines 264 to 269
record_username(client, user.id, &user.login).await.unwrap();
for &pr in prs {
upsert_pr_into_workqueue(&ctx.db_client().await.client(), user.id, pr as u64)
.await
.unwrap();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

given my other comment, here you would end with multiple redundant SQL INSERT being run.

(ok this is just a test, but still)

@Kobzol Kobzol merged commit 4188c2a into rust-lang:master Feb 18, 2025
3 checks passed
@Kobzol Kobzol deleted the pr-tracking-pr-status branch February 18, 2025 17:33
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