Skip to content

fix: prevent self-merge recommended-XP loop (#873) - #878

Merged
jakharmonika364 merged 1 commit into
Coder-s-OG-s:mainfrom
ionfwsrijan:fix/issue-873-self-merge-recommended-xp-guard
Aug 4, 2026
Merged

fix: prevent self-merge recommended-XP loop (#873)#878
jakharmonika364 merged 1 commit into
Coder-s-OG-s:mainfrom
ionfwsrijan:fix/issue-873-self-merge-recommended-xp-guard

Conversation

@ionfwsrijan

Copy link
Copy Markdown
Contributor

Problem

A user who merged their own PR could receive XP both from the normal merge event and from the recommended-PR award path, double-crediting self-merges and letting users farm XP by merging their own recommendations.

Fix

  • New shared helper isSelfMerge(repoFullName, githubLogin) (strict owner/repo shape, case-insensitive owner match) so handleMerge and both claim actions cannot drift.
  • The guard is hoisted to the top of handleMerge and also enforced inside awardRecommendedMerge.
  • claimIssue and claimRecommendation reject forbidden on self-merge.

Files changed

  • src/lib/xp/self-merge.ts (new)
  • src/inngest/functions/process-pr-event.ts
  • src/app/actions/issues.ts
  • src/app/actions/recommendations.ts
  • Tests: self-merge.test.ts, plus claim/denial tests

Testing

  • Full MergeShip suite passes.
  • New tests cover the self-merge denial in both the event handler and claim actions.

Closes #873

@vercel

vercel Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

@ionfwsrijan 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.

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

Hey @ionfwsrijan

You have 7 open PRs right now. The limit is 3 at a time.

Please get your existing PRs merged or closed before opening new ones:

This PR will remain open but won't be reviewed until you're under the limit. See our Contributing Guidelines for details.

@ionfwsrijan

Copy link
Copy Markdown
Contributor Author

@jakharmonika364 @Soumya-codr Please review this

@jakharmonika364 jakharmonika364 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@jakharmonika364
jakharmonika364 merged commit 57d8442 into Coder-s-OG-s:main Aug 4, 2026
3 of 4 checks passed
@ecsoc-sentinel ecsoc-sentinel Bot added ECSoC26-L3 Hard and removed ECSoC26-L3 Hard labels Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

2 participants