Skip to content

fix(dto,escrow): validate future deadline, deduplicate split validation, and separate integration specs (#171, #167, #177) - #180

Open
ghzhost wants to merge 1 commit into
MergeFi:mainfrom
ghzhost:fix/deadline-and-split-util-171-167-177
Open

fix(dto,escrow): validate future deadline, deduplicate split validation, and separate integration specs (#171, #167, #177)#180
ghzhost wants to merge 1 commit into
MergeFi:mainfrom
ghzhost:fix/deadline-and-split-util-171-167-177

Conversation

@ghzhost

@ghzhost ghzhost commented Aug 21, 2026

Copy link
Copy Markdown

Summary & Fixes

This PR addresses three related developer experience and data validation issues in mergefi-backend:

  1. Future Deadline Validation (CreateMilestoneDto doesn't validate that deadline is in the future, same gap as CreateBountyDto (#108) #171):

    • Added @IsFutureDate() custom decorator and validator (src/common/validators/future-date.validator.ts) ensuring ISO-8601 deadlines on both CreateMilestoneDto and CreateBountyDto are strictly in the future.
    • Added test coverage in future-date.validator.spec.ts and create-milestone.dto.spec.ts.
  2. Deduplicated Split Percentages Validation (team-split.util.ts's validateSplitPercentages and escrow.service.ts's assertValidSplits independently reimplement near-identical split-percentage validation #167):

    • Replaced duplicate percentage checking in EscrowService.assertValidSplits with unified validateSplitPercentages from src/teams/team-split.util.ts.
    • Preserved customized error prefix while guaranteeing consistent tolerance (sum ~ 100 within 0.01) and boundary checks (0 < percentage <= 100).
  3. Jest Integration Spec Separation (jest config doesn't separate DB-requiring integration specs from unit specs — npm run test fails without a live Postgres, with no clear signal why #177):

    • Configured testPathIgnorePatterns: [".*\.integration\.spec\.ts$"] in package.json jest config so npm run test executes fast, mock-driven unit tests without failing on missing live Postgres.
    • Added test:integration script specifically for running DB-dependent specs.

Verification

  • npm run lint: 0 errors
  • npm run build: successful
  • npm test: 22 test suites passed (171 tests passed)
  • npm run test:cov: passed with full coverage report

Closes #171, #167, #177

@vercel

vercel Bot commented Aug 21, 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

Development

Successfully merging this pull request may close these issues.

CreateMilestoneDto doesn't validate that deadline is in the future, same gap as CreateBountyDto (#108)

1 participant