Skip to content

Add logging to the review assignment script - #9363

Open
tlively wants to merge 1 commit into
mainfrom
reviewer-assignment-logging
Open

tlively wants to merge 1 commit into
mainfrom
reviewer-assignment-logging

Conversation

@tlively

@tlively tlively commented Nov 7, 2026

Copy link
Copy Markdown
Member

This will give us more visibility into the results to make sure it's working as expected and to fine tune the logic if we want.

This will give us more visibility into the results to make sure it's working as expected and to fine tune the logic if we want.
@tlively
tlively requested a review from a team as a code owner November 7, 2026 02:40
@tlively
tlively requested review from kripken and removed request for a team November 7, 2026 02:40

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request enhances the reviewer assignment script by tracking and logging the raw counts of review-requested and authored PRs per reviewer, and updating the selection logic to sort and print all candidate reviewers. The feedback suggests optimizing the sorting key by precomputing reviewer indices into a dictionary to avoid O(N) lookups during sorting.

Comment on lines +299 to 306
ranked = sorted(
eligible,
key=lambda r: (
round(scores[r], 6),
last_assigned[r],
reviewers.index(r),
),
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Calling reviewers.index(r) inside the sorting key function results in an O(N) lookup for each comparison. Although the list of reviewers is small, it is more efficient and idiomatic to precompute the reviewer indices into a dictionary for O(1) lookups during sorting.

Suggested change
ranked = sorted(
eligible,
key=lambda r: (
round(scores[r], 6),
last_assigned[r],
reviewers.index(r),
),
)
reviewer_index = {r: i for i, r in enumerate(reviewers)}
ranked = sorted(
eligible,
key=lambda r: (
round(scores[r], 6),
last_assigned[r],
reviewer_index[r],
),
)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Definitely not.

This branch has not been deployed

No deployments
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.

1 participant