Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@steven-tey
Copy link
Collaborator

@steven-tey steven-tey commented Nov 4, 2025

Summary by CodeRabbit

  • New Features

    • Percentage-based rewards can now be configured up to 100% (previously limited to 99.99%).
  • Improvements

    • Updated guidance text in payout settings for enhanced clarity on eligibility requirements.

@vercel
Copy link
Contributor

vercel bot commented Nov 4, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
dub Ready Ready Preview Nov 4, 2025 5:50pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 4, 2025

Walkthrough

The changes expand the maximum reward percentage amount from 99.99% to 100% across three coordinated layers: the Zod validation schema (allowing up to 100%), the Prisma database schema (increased decimal precision from 4,2 to 5,2), and UI text in the payout settings modal clarifying eligibility language.

Changes

Cohort / File(s) Summary
Reward percentage limit expansion
apps/web/lib/zod/schemas/rewards.ts, packages/prisma/schema/reward.prisma
Updated PERCENTAGE_REWARD_AMOUNT_SCHEMA max constraint from 99.99 to 100 with corresponding error message update; increased amountInPercentage field precision from Decimal(4, 2) to Decimal(5, 2) to accommodate the new maximum value
Payout settings UI clarification
apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/payouts/program-payout-settings-modal.tsx
Updated descriptive text in two paragraphs to clarify payout eligibility language in Payout holding period and Minimum payout amount sections

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Verify database migration strategy for the Decimal precision change (4,2 → 5,2)—confirm existing data remains compatible
  • Confirm no other validation rules or business logic elsewhere in the codebase depend on the 99.99% ceiling
  • Cross-reference UI text changes with any related documentation or user-facing materials

Possibly related PRs

  • #2619: Modifies min-payout input validation in the same program payout settings modal component, closely related to this PR's UI and validation updates

Poem

🐰 From ninety-nine point nine we rise,
To one-hundred's generous skies,
Five digits now, precision blessed,
Rewards can bloom and truly test,
A rabbit's hop towards completeness! 🎉

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Support 100% reward' directly and clearly summarizes the main change across all modified files, which is enabling 100% reward percentage support by updating schema constraints and validation logic.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch support-100-reward

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b4cdafc and fcb0606.

📒 Files selected for processing (3)
  • apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/payouts/program-payout-settings-modal.tsx (2 hunks)
  • apps/web/lib/zod/schemas/rewards.ts (1 hunks)
  • packages/prisma/schema/reward.prisma (1 hunks)
🧰 Additional context used
🧠 Learnings (4)
📚 Learning: 2025-10-15T01:05:43.266Z
Learnt from: steven-tey
Repo: dubinc/dub PR: 2958
File: apps/web/app/app.dub.co/(dashboard)/[slug]/settings/members/page-client.tsx:432-457
Timestamp: 2025-10-15T01:05:43.266Z
Learning: In apps/web/app/app.dub.co/(dashboard)/[slug]/settings/members/page-client.tsx, defer refactoring the custom MenuItem component (lines 432-457) to use the shared dub/ui MenuItem component to a future PR, as requested by steven-tey.

Applied to files:

  • apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/payouts/program-payout-settings-modal.tsx
📚 Learning: 2025-07-30T15:29:54.131Z
Learnt from: TWilson023
Repo: dubinc/dub PR: 2673
File: apps/web/ui/partners/rewards/rewards-logic.tsx:268-275
Timestamp: 2025-07-30T15:29:54.131Z
Learning: In apps/web/ui/partners/rewards/rewards-logic.tsx, when setting the entity field in a reward condition, dependent fields (attribute, operator, value) should be reset rather than preserved because different entities (customer vs sale) have different available attributes. Maintaining existing fields when the entity changes would create invalid state combinations and confusing UX.

Applied to files:

  • apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/payouts/program-payout-settings-modal.tsx
  • apps/web/lib/zod/schemas/rewards.ts
📚 Learning: 2025-09-12T17:31:10.548Z
Learnt from: devkiran
Repo: dubinc/dub PR: 2833
File: apps/web/lib/actions/partners/approve-bounty-submission.ts:53-61
Timestamp: 2025-09-12T17:31:10.548Z
Learning: In approve-bounty-submission.ts, the logic `bounty.rewardAmount ?? rewardAmount` is intentional. Bounties with preset reward amounts should use those fixed amounts, and the rewardAmount override parameter is only used when bounty.rewardAmount is null/undefined (for custom reward bounties). This follows the design pattern where bounties are either "flat rate" (fixed amount) or "custom" (variable amount set during approval).

Applied to files:

  • apps/web/lib/zod/schemas/rewards.ts
📚 Learning: 2025-07-30T15:25:13.936Z
Learnt from: TWilson023
Repo: dubinc/dub PR: 2673
File: apps/web/ui/partners/rewards/add-edit-reward-sheet.tsx:56-66
Timestamp: 2025-07-30T15:25:13.936Z
Learning: In apps/web/ui/partners/rewards/add-edit-reward-sheet.tsx, the form schema uses partial condition objects to allow users to add empty/unconfigured condition fields without type errors, while submission validation uses strict schemas to ensure data integrity. This two-stage validation pattern improves UX by allowing progressive completion of complex forms.

Applied to files:

  • apps/web/lib/zod/schemas/rewards.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (3)
apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/payouts/program-payout-settings-modal.tsx (1)

116-116: LGTM! Improved terminology clarity.

The text changes from "withdrawal and processing" to "payout" provide clearer, more concise messaging for users.

Also applies to: 142-143

apps/web/lib/zod/schemas/rewards.ts (1)

135-136: LGTM! Validation schema properly updated.

The maximum percentage increased from 99.99% to 100%, and the error message is updated accordingly. This change coordinates correctly with the database schema update to Decimal(5, 2).

packages/prisma/schema/reward.prisma (1)

19-19: Schema change is correct and requires no further action.

The precision change from Decimal(4, 2) to Decimal(5, 2) is necessary to support 100% rewards. Per the Dub repository's workflow, Prisma schema changes in packages/prisma/schema/ files do not require separate migration files.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@steven-tey steven-tey merged commit 3ce3eae into main Nov 4, 2025
8 of 9 checks passed
@steven-tey steven-tey deleted the support-100-reward branch November 4, 2025 17:55
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.

3 participants