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

Skip to content

Conversation

@steven-tey
Copy link
Collaborator

@steven-tey steven-tey commented Dec 19, 2025

Summary by CodeRabbit

  • Bug Fixes
    • Corrected partner link schema configuration to enforce default values for critical tracking fields. UTM parameters (source, medium, campaign, term, content), program identification, partner ID, conversion tracking, and folder ID are now protected and cannot be overridden at the link level.

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

@vercel
Copy link
Contributor

vercel bot commented Dec 19, 2025

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

Project Deployment Review Updated (UTC)
dub Ready Ready Preview Dec 19, 2025 8:25pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 19, 2025

Walkthrough

A single-file change expanding the omission set for linkProps in a Zod schema, preventing additional fields (programId, partnerId, trackConversion, folderId, UTM parameters, and ref) from being overrideable while removing duplicate omissions.

Changes

Cohort / File(s) Summary
Schema Configuration
apps/web/lib/zod/schemas/partners.ts
Expanded omitted fields for linkProps in createPartnerSchema to include default programId, partnerId, trackConversion, folderId, UTM fields (utm_source, utm_medium, utm_campaign, utm_term, utm_content), and ref; removed duplicate omissions from later section

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • Single file change affecting only configuration of omitted fields
  • No functional logic modifications or behavioral changes
  • Straightforward addition and deduplication of field restrictions

Poem

🐰 The schema hops with care today,
UTM fields now locked in place to stay,
No more duplicates to clutter the way,
Just cleaner omissions—hip, hip, hooray! 🎉

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: expanding the omission set for linkProps to remove (make unsupported) additional fields like UTM parameters and default IDs from being overrideable via linkProps.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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 improve-partners-api

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 934da8e and 45c1936.

📒 Files selected for processing (1)
  • apps/web/lib/zod/schemas/partners.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: TWilson023
Repo: dubinc/dub PR: 2935
File: packages/prisma/schema/workspace.prisma:21-36
Timestamp: 2025-10-06T15:48:45.956Z
Learning: In the Dub repository (dubinc/dub), Prisma schema changes are not managed with separate migration files. Do not flag missing Prisma migration files when schema changes are made to files like `packages/prisma/schema/workspace.prisma` or other schema files.
📚 Learning: 2025-08-16T11:14:00.667Z
Learnt from: devkiran
Repo: dubinc/dub PR: 2754
File: apps/web/lib/partnerstack/schemas.ts:47-52
Timestamp: 2025-08-16T11:14:00.667Z
Learning: The PartnerStack API always includes the `group` field in partner responses, so the schema should use `.nullable()` rather than `.nullish()` since the field is never omitted/undefined.

Applied to files:

  • apps/web/lib/zod/schemas/partners.ts
📚 Learning: 2025-11-24T09:10:12.536Z
Learnt from: devkiran
Repo: dubinc/dub PR: 3089
File: apps/web/lib/api/fraud/fraud-rules-registry.ts:17-25
Timestamp: 2025-11-24T09:10:12.536Z
Learning: In apps/web/lib/api/fraud/fraud-rules-registry.ts, the fraud rules `partnerCrossProgramBan` and `partnerDuplicatePayoutMethod` intentionally have stub implementations that return `{ triggered: false }` because they are partner-scoped rules handled separately during partner application/onboarding flows (e.g., in detect-record-fraud-application.ts), rather than being evaluated per conversion event like other rules in the registry. The stubs exist only to satisfy the `Record<FraudRuleType, ...>` type constraint.

Applied to files:

  • apps/web/lib/zod/schemas/partners.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/partners.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 (1)
apps/web/lib/zod/schemas/partners.ts (1)

562-592: The expanded omission list correctly restricts fields that should be system-managed.

The comments clearly explain each category of omitted fields—default programId/partnerId assignments, always-on trackConversion behavior, system-derived UTM parameters and folderId, and unsupported fields—which improves code clarity and maintainability. Verification confirms no existing API consumers reference these fields in linkProps, so this change carries no breaking change risk.


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: 0

🧹 Nitpick comments (1)
apps/web/lib/api/partners/generate-partner-link.ts (1)

21-21: Clarify the purpose of the tenantId property or remove it.

The tenantId property is added to the link interface but is never used. Line 66 explicitly uses partner.tenantId instead, which means any value passed via link.tenantId would be overridden by the explicit assignment.

If the intent is to allow link.tenantId to override partner.tenantId, consider:

tenantId: link.tenantId ?? partner.tenantId,

Otherwise, if partner.tenantId should always be used (which aligns with the schema now omitting tenantId from linkProps), this property should be removed from the interface to avoid confusion.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 344f875 and 934da8e.

📒 Files selected for processing (1)
  • apps/web/lib/api/partners/generate-partner-link.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: TWilson023
Repo: dubinc/dub PR: 2935
File: packages/prisma/schema/workspace.prisma:21-36
Timestamp: 2025-10-06T15:48:45.956Z
Learning: In the Dub repository (dubinc/dub), Prisma schema changes are not managed with separate migration files. Do not flag missing Prisma migration files when schema changes are made to files like `packages/prisma/schema/workspace.prisma` or other schema files.
Learnt from: devkiran
Repo: dubinc/dub PR: 2754
File: apps/web/lib/partnerstack/schemas.ts:47-52
Timestamp: 2025-08-16T11:14:00.667Z
Learning: The PartnerStack API always includes the `group` field in partner responses, so the schema should use `.nullable()` rather than `.nullish()` since the field is never omitted/undefined.
⏰ 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

@steven-tey steven-tey merged commit ef4e2b5 into main Dec 19, 2025
7 of 8 checks passed
@steven-tey steven-tey deleted the improve-partners-api branch December 19, 2025 20:33
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.

2 participants