Skip to content

fix(webhook): ignore bare issue references for xp awards#235

Merged
Ayush-Patel-56 merged 3 commits into
Coder-s-OG-s:mainfrom
Sujini-kudupudi:fix/issue-217
Jun 2, 2026
Merged

fix(webhook): ignore bare issue references for xp awards#235
Ayush-Patel-56 merged 3 commits into
Coder-s-OG-s:mainfrom
Sujini-kudupudi:fix/issue-217

Conversation

@Sujini-kudupudi
Copy link
Copy Markdown
Contributor

Summary

This PR fixes a bug where any bare issue reference (e.g., #42) in a pull request body or title would incorrectly trigger XP awards as if the PR had closed the issue. It restricts the regex to only match issue numbers preceded by closing keywords.

Type of Change

  • Bug fix
  • New feature
  • UI / UX improvement
  • Refactor
  • Documentation
  • Other

Related Issue

Closes #217

What was changed?

  • Removed the bare issue number alternative |#(\d+) from the ISSUE_REF regex in src/inngest/functions/process-pr-event.ts.
  • Updated extractIssueNumbers to only extract the first capture group.
  • Updated the tests in src/inngest/functions/process-pr-event.test.ts to assert that bare #N references correctly return an empty array and are ignored, avoiding false positive XP awards.

Screenshots

N/A

Checklist

  • My code follows the project structure and conventions
  • I tested this locally (npm run dev)
  • No hardcoded secrets or credentials
  • I have updated documentation if needed

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 28, 2026

@Sujini-kudupudi is attempting to deploy a commit to the codersogs-3057's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown
Collaborator

@Siddhartha-singh01 Siddhartha-singh01 left a comment

Choose a reason for hiding this comment

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

LGTM !

@Piyush-Thakkarr
Copy link
Copy Markdown
Collaborator

hey @Sujini-kudupudi, two notes while you're already in this regex.

1. fix #N (no trailing e) won't match. the new pattern is close[sd]?|fixe[sd]?|resolve[sd]?. that gives you close/closes/closed, fixe/fixes/fixed, resolve/resolves/resolved. but fix (one of the keywords github itself auto-closes on) needs e to be optional too. tiny tweak:

const ISSUE_REF = /(?:close[sd]?|fix(?:e[sd]?)?|resolve[sd]?)\s+#(\d+)/gi;

add a test for it: extractIssueNumbers('fix #7') should return [7]. pre-existing gap, but you're touching this regex so worth folding in.

2. you've bundled the linkPrToClaim array-normalize fix that's already in #228. identical change, byte-for-byte. whichever lands second will be an empty conflict. probably easiest: #228 owns that fix (it's the PR title's focus), so drop the linkPrToClaim chunk from this PR and keep this one focused on the regex change. that also makes the diff easier for the maintainer to merge.

related: there's a third site of the same issues!inner cast bug at src/inngest/functions/recommendations-build.ts:71 (silent skip-history corruption). i flagged that on #228, mentioning it here so we don't end up with three PRs each patching one site.

regex change itself is the right call. once the fix case is in and the linkPrToClaim chunk is dropped, this is ready.

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Jun 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
mergeship Ready Ready Preview, Comment Jun 2, 2026 9:45am

Copy link
Copy Markdown
Collaborator

@Ayush-Patel-56 Ayush-Patel-56 left a comment

Choose a reason for hiding this comment

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

cheers!

@Ayush-Patel-56 Ayush-Patel-56 added level:intermediate Intermediate level difficulty quality:clean Clean, well-structured contribution type:bug Bug fix gssoc:approved Approved by GSSOC admin mentor:Ayush-Patel-56 Replace Ayush-Patel-56 with mentor's GitHub handle to credit them labels Jun 2, 2026
@Ayush-Patel-56 Ayush-Patel-56 merged commit 9adabea into Coder-s-OG-s:main Jun 2, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved Approved by GSSOC admin level:intermediate Intermediate level difficulty mentor:Ayush-Patel-56 Replace Ayush-Patel-56 with mentor's GitHub handle to credit them quality:clean Clean, well-structured contribution type:bug Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] extractIssueNumbers bare #N alternative matches any issue reference, awarding XP for PRs that mention but do not fix an issue

4 participants