-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Enable additionalLinks by default #3054
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughAdds domain-derived Changes
Sequence Diagram(s)sequenceDiagram
participant Program
participant Utils as getDomainWithoutWWW
participant Service as Import/Create Flow
participant DB as Prisma (PartnerGroup)
Program->>Service: trigger create/upsert partner group (program.url, name, ...)
Service->>Utils: getDomainWithoutWWW(program.url)
Utils-->>Service: domain
Service->>DB: create/upsert PartnerGroup { name, slug, ..., additionalLinks: [{domain, validationMode:"domain"}], maxPartnerLinks }
DB-->>Service: created/updated group
Service-->>Program: return result
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (9)
🚧 Files skipped from review as they are similar to previous changes (3)
🧰 Additional context used🧠 Learnings (4)📚 Learning: 2025-06-06T07:59:03.120ZApplied to files:
📚 Learning: 2025-08-14T05:00:23.224ZApplied to files:
📚 Learning: 2025-10-15T01:05:43.266ZApplied to files:
📚 Learning: 2025-09-17T17:44:03.965ZApplied to files:
🧬 Code graph analysis (5)apps/web/app/(ee)/api/groups/[groupIdOrSlug]/default-links/route.ts (2)
apps/web/app/(ee)/api/cron/groups/remap-default-links/route.ts (1)
apps/web/tests/partner-groups/index.test.ts (1)
apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/groups/[groupSlug]/links/group-default-links.tsx (1)
apps/web/lib/actions/partners/create-program.ts (1)
⏰ 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)
🔇 Additional comments (5)
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. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
♻️ Duplicate comments (3)
apps/web/lib/partnerstack/import-groups.ts (1)
58-64: Verify null handling forgetDomainWithoutWWW.The code assumes
getDomainWithoutWWW(program.url)will never return null sinceprogram.urlis verified earlier (lines 23-25). However, if the URL format is invalid,getDomainWithoutWWWmight still returnnull, causing a type mismatch in theadditionalLinksarray.This is the same concern as in create-program.ts. Please verify the function's behavior with malformed URLs.
apps/web/lib/rewardful/import-campaigns.ts (1)
66-72: Verify null handling forgetDomainWithoutWWW.Same concern as in other files:
getDomainWithoutWWW(program.url)might returnnullif the URL format is invalid, even thoughprogram.urlis validated for existence earlier (lines 28-30).This is the same concern flagged in create-program.ts and partnerstack/import-groups.ts.
apps/web/lib/firstpromoter/import-campaigns.ts (1)
67-73: Verify null handling forgetDomainWithoutWWW.The non-null assertion on
program.url!is safe due to the early return at line 27. However,getDomainWithoutWWWmight still returnnullif the URL format is invalid, causing a potential type mismatch in theadditionalLinksarray.This is the same concern flagged in the other files.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
apps/web/lib/actions/partners/create-program.ts(2 hunks)apps/web/lib/firstpromoter/import-campaigns.ts(2 hunks)apps/web/lib/partnerstack/import-groups.ts(2 hunks)apps/web/lib/rewardful/import-campaigns.ts(2 hunks)packages/prisma/schema/program.prisma(0 hunks)
💤 Files with no reviewable changes (1)
- packages/prisma/schema/program.prisma
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: devkiran
Repo: dubinc/dub PR: 2735
File: apps/web/lib/actions/partners/delete-reward.ts:33-41
Timestamp: 2025-08-14T05:17:51.825Z
Learning: In the partner groups system, a rewardId can only belong to one group, establishing a one-to-one relationship between rewards and groups. This means using Prisma's `update` method (rather than `updateMany`) is appropriate when updating groups by rewardId.
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.
📚 Learning: 2025-06-06T07:59:03.120Z
Learnt from: devkiran
Repo: dubinc/dub PR: 2177
File: apps/web/lib/api/links/bulk-create-links.ts:66-84
Timestamp: 2025-06-06T07:59:03.120Z
Learning: In apps/web/lib/api/links/bulk-create-links.ts, the team accepts the risk of potential undefined results from links.find() operations when building invalidLinks arrays, because existing links are fetched from the database based on the input links, so matches are expected to always exist.
Applied to files:
apps/web/lib/partnerstack/import-groups.tsapps/web/lib/actions/partners/create-program.tsapps/web/lib/rewardful/import-campaigns.ts
📚 Learning: 2025-09-17T17:44:03.965Z
Learnt from: TWilson023
Repo: dubinc/dub PR: 2857
File: apps/web/lib/actions/partners/update-program.ts:96-0
Timestamp: 2025-09-17T17:44:03.965Z
Learning: In apps/web/lib/actions/partners/update-program.ts, the team prefers to keep the messagingEnabledAt update logic simple by allowing client-provided timestamps rather than implementing server-controlled timestamp logic to avoid added complexity.
Applied to files:
apps/web/lib/actions/partners/create-program.ts
📚 Learning: 2025-08-14T05:00:23.224Z
Learnt from: devkiran
Repo: dubinc/dub PR: 2735
File: apps/web/app/api/og/program/route.tsx:63-64
Timestamp: 2025-08-14T05:00:23.224Z
Learning: In Dub's partner program system, the default partner group will always exist. When programs are created, a default partner group is automatically upserted using DEFAULT_PARTNER_GROUP constant, so accessing program.groups[0] in contexts where the default group is queried is safe.
Applied to files:
apps/web/lib/actions/partners/create-program.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
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
Summary by CodeRabbit
New Features
Refactor
Tests