Skip to content

fix(milestones): validate issue repository matches milestone repository in addIssue (#59) - #69

Open
ghzhost wants to merge 1 commit into
MergeFi:mainfrom
ghzhost:fix/59-milestones-add-issue-repository-validation
Open

fix(milestones): validate issue repository matches milestone repository in addIssue (#59)#69
ghzhost wants to merge 1 commit into
MergeFi:mainfrom
ghzhost:fix/59-milestones-add-issue-repository-validation

Conversation

@ghzhost

@ghzhost ghzhost commented Aug 16, 2026

Copy link
Copy Markdown

Overview

Fixes #59 by ensuring that MilestonesService.addIssue validates whether the attached Issue belongs to the same repository as the target Milestone.

Problem

Previously, addIssue directly updated issue.milestoneId without comparing issue.repositoryId to milestone.repositoryId. This allowed cross-repository issue attachment, which subsequently led to unintended budget dilution in resolveIssue's proportional distribution calculation.

Solution

  1. Repository Match Check: In MilestonesService.addIssue, check if (issue.repositoryId !== milestone.repositoryId).
  2. Actionable Error: Throw a BadRequestException identifying both repository IDs when a mismatch occurs: Issue <issueId> (repository: <issueRepo>) does not belong to Milestone <milestoneId> repository (<milestoneRepo>).
  3. Unit Tests: Added unit tests covering:
    • Successful attachment when repositoryId matches.
    • Rejection with descriptive BadRequestException when repositoryId does not match.
    • NotFoundException when the requested issue is missing.

Closes #59

…ry in addIssue (MergeFi#59)

- Reject cross-repository issue attachment with BadRequestException including both repository IDs
- Add unit tests verifying same-repository attachment, cross-repository rejection, and not-found handling
- Closes MergeFi#59
@vercel

vercel Bot commented Aug 16, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the chonilius' projects Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant