Repository navigation
fix: edit merged PR shoutout when the program label lands late - #105
Merged
anurag629 merged 1 commit intoOct 26, 2026
Merged
Conversation
A merged PR whose program label is added after the merge used to keep a shoutout with no count, and the board only refreshed when the cache ran out. Handle the labeled event for an already-merged PR: count it the same way a merge does, refresh the board, and edit the stored shoutout so it reads like it had the label at the merge, including the qualify line. A shoutout that already has the count, an open PR, or any other label changes nothing. Closes codercops#59
anurag629
approved these changes
Oct 26, 2026
anurag629
left a comment
Member
There was a problem hiding this comment.
Thanks @harshit-exe-dev, this works. Typecheck and all 385 tests pass on top of develop, and five of the six new tests fail with develop's webhook.ts (the sixth checks that nothing changes, which develop already does by ignoring the event). Keeping the shoutout id in KV and leaving the message alone when the record is gone is the right call.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A merged PR whose program label is added after the merge (for example by the accepted-label workflow when a maintainer missed it) used to keep a shoutout with no count, and the board only refreshed when the cache ran out.
This handles the
labeledevent for an already-merged PR: when the added label is a program's label and the merge falls in that program's window, it counts the PR the same way a merge does, refreshes the board, and edits the stored shoutout so it reads like it had the label at the merge, including the qualify line on the PR that reaches the minimum. The shoutout's message id is stored in KV when it is posted (3-day expiry), so a late label edits instead of posting a second shoutout. A shoutout that already has the count, an open PR, or any other label changes nothing, and when there is no stored shoutout the board still refreshes and no message is guessed at.Closes #59
How I tested this
npm run typecheckpasses.npm testpasses: 385 tests across 15 files, including 6 new tests for the late-label cases: shoutout edited with the count and qualify lines plus a refreshed board, count without the qualify line below the minimum, no double count when search already includes the PR, no change for an open PR / another label / a shoutout that already has the count, board refreshed with no edit when the shoutout record is gone, and shoutout left alone with the board cleared when search fails.AI assistance
This change was written with assistance from an AI coding assistant, and the tests above were run locally before opening the PR.