-
Notifications
You must be signed in to change notification settings - Fork 76
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
Workflow for tracking PRs assignment #1754
Conversation
a9800b7
to
7465641
Compare
b394940
to
595eb3c
Compare
595eb3c
to
911efd9
Compare
General overview at: rust-lang#1753 - Added a new DB table with the fields to track how many PRs are assigned to a contributor at any time - This tDB table will be updated everytime a PR is assigned or unassigned No initial sync is planned at this time. DB table population will happen over time automatically.
911efd9
to
9d7bfcd
Compare
[review-work-queue] | ||
enabled-for-teams = ["aaa", "bbb"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to enable this feature only for a subset of teams, rather than tracking all PRs of every contributor from the start.
But that would add a little of complexity to this PR. Maybe worth adding in a subsequent patch, when/if this one is merged?
// 2) create or increase by one the team members work queue | ||
// create team members if they don't exist | ||
for u in event.issue.assignees.iter() { | ||
let user_id = u.id.expect("Github user was expected! Please investigate."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check is just to cover the unlikely case where we receive a User
with an id=None
Unsure why the User struct is like that but better safe than sorry.
gentle ping for review @rust-lang/infra (maybe @ehuss?) thanks |
CC @jackh726, if you could please take a look. |
@@ -307,5 +307,13 @@ CREATE UNIQUE INDEX jobs_name_scheduled_at_unique_index | |||
ON jobs ( | |||
name, scheduled_at | |||
); | |||
", | |||
" | |||
CREATE table review_prefs ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the intention that this will eventually contain review preferences too? (That's what the name suggests)
My first thought was that there should instead be a table of PRs, with assigned reviewers in that list. But, maybe that doesn't make a bunch of sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct. The new DB table at the end of the story will also persist the review preferences for each reviewer (thus the name). I'm trying to slip in changes one by one and as slowly as possible, as per the plan detailed in #1753
PRs in a separate joined table def. make sense in general. But in this case I think the use case is so minimal to not warrant that. If in the far future the tool develops such as to make it a compelling choice, we can always migrate.
|
||
// Note: When changing assignees for a PR, we don't receive the assignee(s) removed, we receive | ||
// an event `Unassigned` and the remaining assignees | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would expect this function to "diff" the current assignees with the new assigness, and only update based on that diff...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is also why it makes sense to me that the table be of PRs with a list of assignees.
But, that complicates the querying. Could think about a table view that aggregates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would expect this function to "diff" the current assignees with the new assigness, and only update based on that diff
Hm, I'm a bit unclear on this comment 🤔 do you suggest a "3-way" comparison between two arrays (list of current assignees from the DB vs. new list of assignees from GH)? Example:
- assign to new assignees
- check if current assignees are still such
- unassign from removed assignees
(or maybe something else?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I mean, just compare the lists and find what needs to be removed and what needs to be added.
I'm thinking: It's pretty trivial to get a list of all open PRs and their assignees: Here's the graphql query (you do still have to paginate): query {
repository(owner: "rust-lang", name: "rust") {
pullRequests(first: 100, states:OPEN) {
pageInfo {
hasNextPage
endCursor
}
nodes {
number
assignees(first: 100) {
nodes {
login
id
}
}
}
}
}
} It's probably worth just setting up a sync once on start, and again every 30 minutes, along with listening for events. I don't think only just waiting for the table to populate over time will really work. I'd be curious to know how long it would take to run a whole "query the current state and update the DB". Probably not that long - even if we way over estimate, we should only have on the order of a 1000 PRs to deal with. |
f8ff17d
to
ed0389b
Compare
Error: Invalid
Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #t-infra on Zulip. |
ed0389b
to
e375877
Compare
Error: Invalid
Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #t-infra on Zulip. |
Why wouldn't it? Can you elaborate a bit on that? I'll think about your proposal but my immediate thought I think is that I don't agree with this. We would be losing the concept of a stable "source of truth". I am afraid that querying GH every n-minutes would introduce a point of failure in the consistency, the DB would just become a 'cache' reflecting the GH situation. Then why not just make it a full real cache serializing a json and avoid the DB table altogether? My reasoning about having the DB table is to have a storage persistence that can be used by the PR review assignment and not only by that. I imagine a future where it could be expanded and used also for statistics, for everything we want to know about PRs and reviews. |
Error: Invalid
Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #t-infra on Zulip. |
The concern I have is that Github is the source of truth right now. Do you expect otherwise?
I mean, this isn't a bad option, to keep just everything in memory. But seems unnecessary.
I think this is useful, but not with the current table schema. |
Closing and restarting from scratch in #1773 ... |
Error: Invalid
Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #t-infra on Zulip. |
General overview at: #1753
This patch implements the first part:
No initial sync is planned at this time. Populating the table will happen over time.
This feature is enabled by adding the following to the triagebot.toml in the Rust git repository: