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

Skip to content

Conversation

@devkiran
Copy link
Collaborator

@devkiran devkiran commented Dec 16, 2025

Summary by CodeRabbit

  • New Features
    • Commission filtering by reward status is now available for better organization and tracking.
    • "Scheduled" added as a recognized commission status alongside hold, pending, approved, declined, and paid.
    • Scheduled commissions are now imported after the main commission fetch to ensure all items are captured.

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link
Contributor

vercel bot commented Dec 16, 2025

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

Project Deployment Review Updated (UTC)
dub Ready Ready Preview Dec 16, 2025 7:43pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 16, 2025

Warning

Rate limit exceeded

@devkiran has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 16 minutes and 47 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 9b38277 and c3b39eb.

📒 Files selected for processing (1)
  • apps/web/lib/partnerstack/import-commissions.ts (2 hunks)

Walkthrough

Added optional status filtering to PartnerStack API calls, extended commission schema to accept "scheduled", updated import flow to map "scheduled" -> "pending", and added a separate scheduled-commissions import step that runs after the main fetch completes.

Changes

Cohort / File(s) Summary
API client
apps/web/lib/partnerstack/api.ts
Added optional status parameter to listCommissions() so queries can include status=<reward_status> alongside existing pagination.
Import logic
apps/web/lib/partnerstack/import-commissions.ts
toDubStatus maps "scheduled" to "pending". After the main fetch loop completes (when hasMore is false), a separate import step fetches commissions with status: "scheduled" from the last cursor and processes them via the existing create path.
Schema
apps/web/lib/partnerstack/schemas.ts
Extended partnerStackCommission.reward_status enum to include "scheduled".

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Review the scheduled-import sequencing to ensure it uses the correct cursor and does not reprocess items.
  • Verify listCommissions query-building preserves pagination and correctly encodes status.
  • Confirm scheduled -> pending mapping aligns with downstream expectations and does not break existing workflows.

Suggested reviewers

  • steven-tey
  • TWilson023

Poem

🐰 I hopped through schemas, API, and queue,
Found "scheduled" and made it true—
Mapped it gentle to pending's door,
Fetched it later, then processed more. 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The title 'Fix PS commissions sync' is vague and uses abbreviation 'PS' without context. While it relates to PartnerStack commissions, it doesn't clearly convey what specific issue is being fixed or what the main change accomplishes. Clarify the title with more specificity, e.g., 'Add scheduled status support to PartnerStack commissions sync' or 'Fix PartnerStack scheduled commissions import' to better explain the change.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 75d08f3 and 33b1464.

📒 Files selected for processing (3)
  • apps/web/lib/partnerstack/api.ts (1 hunks)
  • apps/web/lib/partnerstack/import-commissions.ts (2 hunks)
  • apps/web/lib/partnerstack/schemas.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 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/partnerstack/schemas.ts
📚 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/lib/partnerstack/schemas.ts
🔇 Additional comments (3)
apps/web/lib/partnerstack/schemas.ts (1)

97-104: LGTM!

The enum extension correctly adds "scheduled" as a valid reward status, aligning with the API filtering capability and the status mapping in import-commissions.ts.

apps/web/lib/partnerstack/import-commissions.ts (1)

29-29: LGTM!

Mapping "scheduled" to "pending" is appropriate since scheduled commissions haven't been finalized yet.

apps/web/lib/partnerstack/api.ts (1)

122-138: LGTM!

The optional status parameter is cleanly integrated, follows the existing pattern of other list methods, and maintains type safety by using PartnerStackCommission["reward_status"].

@steven-tey steven-tey merged commit 815ecff into main Dec 16, 2025
7 of 8 checks passed
@steven-tey steven-tey deleted the investigate-ps-commissions branch December 16, 2025 23:17
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