Skip to content

fix(issues): surface adaptBounty teamSplitsValid result in IssueDetailPage (#85) - #95

Open
ghzhost wants to merge 1 commit into
MergeFi:mainfrom
ghzhost:fix/issue-85-surface-team-splits-valid
Open

fix(issues): surface adaptBounty teamSplitsValid result in IssueDetailPage (#85)#95
ghzhost wants to merge 1 commit into
MergeFi:mainfrom
ghzhost:fix/issue-85-surface-team-splits-valid

Conversation

@ghzhost

@ghzhost ghzhost commented Aug 16, 2026

Copy link
Copy Markdown

Overview

Closes #85.

Previously, adaptBounty evaluated teamSplitsValid for every bounty containing team payout splits, but the resulting object was never consumed in UI pages or typed as part of the core Bounty domain model. When team splits sum to an invalid amount (e.g. 85% or 110%), the breakdown was silently rendered without any indication to contributors or maintainers.

Key Changes

  1. Domain Model & Type Alignment (src/types/index.ts):

    • Added TeamSplitsValidation interface ({ valid: boolean; sum: number; message?: string }).
    • Added teamSplitsValid?: TeamSplitsValidation to the Bounty interface so it flows cleanly through fetchBounty, fetchBounties, and React components.
  2. Clean Adapter Return Type (src/lib/adapters.ts):

    • Simplified adaptBounty(raw: RawBounty): Bounty now that teamSplitsValid is natively part of Bounty.
  3. Surface Invalid Splits Warning in IssueDetailPage (src/app/issues/[id]/page.tsx):

    • Renders a visible alert banner (role="alert" and AlertTriangle icon) displaying the pre-computed teamSplitsValid.message whenever bounty.teamSplitsValid?.valid === false.
    • Preserves normal clean display when splits sum to 100%.
  4. Utils & Test Suite Support (src/lib/utils.ts, package.json):

    • Unified validateTeamSplits definition.
    • Added comprehensive tests in src/app/issues/[id]/IssueDetailPage.test.tsx verifying valid split rendering, invalid split warning banner presentation, and absent/empty split handling.

Verification

  • npx tsc --noEmit passed with 0 errors.
  • npm test passed (14/14 tests across all suites).
  • npm run build compiled successfully (Turbopack).
  • npm run lint and verification scripts passed.

…lPage (MergeFi#85)

- Add teamSplitsValid to Bounty domain interface in types/index.ts
- Render visible alert banner with computed message in IssueDetailPage when team splits sum != 100%
- Cleanly simplify adaptBounty return signature and utils.ts validateTeamSplits
- Add full test coverage in IssueDetailPage.test.tsx
@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

Development

Successfully merging this pull request may close these issues.

Surface adaptBounty's teamSplitsValid result in IssueDetailPage instead of computing and discarding it

1 participant