Skip to content

fix(utils): reject empty splits by default in validateTeamSplits with allowEmpty option (Fixes #948) - #959

Open
Lion4467cat wants to merge 1 commit into
MergeFi:mainfrom
Lion4467cat:fix/issue-948-validate-team-splits-empty
Open

Lion4467cat wants to merge 1 commit into
MergeFi:mainfrom
Lion4467cat:fix/issue-948-validate-team-splits-empty

Conversation

@Lion4467cat

@Lion4467cat Lion4467cat commented Nov 14, 2026 •

Copy link
Copy Markdown

Fixes #948

What changed

  • Added an allowEmpty option (defaulting to false) to validateTeamSplits in src/lib/utils.ts, returning { valid: false, sum: 0, message: "Team splits must include at least one member summing to 100%" } when splits is empty and allowEmpty is not enabled.
  • Updated adaptBounty in src/lib/adapters.ts to pass { allowEmpty: true } so read-only adaptation of an empty split array preserves its existing behavior while form/team validation rejects empty member lists.
  • Added unit tests in src/lib/utils.test.ts for both default (allowEmpty: false) and opt-in (allowEmpty: true) modes.

Why

  • validateTeamSplits([]) previously returned { valid: true, sum: 0 }, allowing a team with zero members to pass validation even though team splits must sum to 100%.

How to test

  • npx jest src/lib/utils.test.ts src/lib/adapters.test.ts --no-coverage (127 passed, 127 total)
  • npx eslint src/lib/utils.ts src/lib/adapters.ts src/lib/utils.test.ts src/lib/adapters.test.ts (0 errors, 0 warnings)

@vercel

vercel Bot commented Nov 14, 2026

Copy link
Copy Markdown

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

A member of the Team first needs to authorize it.

@Lion4467cat
Lion4467cat force-pushed the fix/issue-948-validate-team-splits-empty branch from 2cae4b8 to 2a40c80 Compare November 14, 2026 10:41

This branch has not been deployed

No deployments
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.

validateTeamSplits returns valid: true for an empty split list, so a team with no members passes validation

1 participant