Skip to content

fix: edit merged PR shoutout when the program label lands late - #105

Merged
anurag629 merged 1 commit into
codercops:developfrom
harshit-exe-dev:fix/late-label-shoutout-59
Oct 26, 2026
Merged

anurag629 merged 1 commit into
codercops:developfrom
harshit-exe-dev:fix/late-label-shoutout-59

Conversation

@harshit-exe-dev

Copy link
Copy Markdown
Contributor

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 labeled event 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 typecheck passes.
  • npm test passes: 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.

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 anurag629 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

@anurag629 anurag629 added the hacktoberfest-accepted PR counts for Hacktoberfest label Oct 26, 2026
@anurag629
anurag629 merged commit ec255d7 into codercops:develop Oct 26, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hacktoberfest-accepted PR counts for Hacktoberfest

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Merged PR shoutout misses the count when the program label is added after the merge

2 participants