Skip to content

Add partner link titles and comments - #4275

Open
pepeladeira wants to merge 8 commits into
mainfrom
partner-link-titles
Open

Add partner link titles and comments#4275
pepeladeira wants to merge 8 commits into
mainfrom
partner-link-titles

Conversation

@pepeladeira

@pepeladeira pepeladeira commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features

    • Add optional private titles and comments to partner links.
    • Customize partner link displays between short links and titles, with Full or Cards analytics layouts.
    • Save, reset, and set display preferences as defaults.
    • Show partner link titles consistently across customer, earnings, events, and analytics views.
  • Improvements

    • Link titles are supported in filters, charts, tables, tooltips, and top-link reports.
    • Existing link comments are preserved during migration.
    • Long partner link titles are automatically limited to 120 characters.

@vercel

vercel Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated (UTC)
dub Ready Ready Preview Aug 5, 2026 10:14pm

Request Review

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 40399978-187b-46ed-92d5-fac3eb14fe2d

📥 Commits

Reviewing files that changed from the base of the PR and between 69d63f7 and e917165.

📒 Files selected for processing (3)
  • apps/web/app/(ee)/api/partner-profile/programs/[programId]/links/[linkId]/route.ts
  • apps/web/lib/zod/schemas/partner-profile.ts
  • apps/web/scripts/misc/restore-program-enrollments.ts

📝 Walkthrough

Walkthrough

Partner links now support private titles and comments. APIs and analytics return partner link titles. Partner pages share persisted display preferences for link titles, short links, and analytics layouts.

Changes

Partner link metadata and display

Layer / File(s) Summary
Metadata contracts and data flow
apps/web/prisma/schema/*, apps/web/lib/zod/schemas/*, apps/web/lib/api/links/*, apps/web/app/(ee)/api/partner-profile/*, apps/web/ui/modals/partner-link-modal.tsx, apps/web/scripts/migrations/*
Partner links store partnerLinkTitle and partnerLinkComments. Schemas, creation and update APIs, analytics responses, grouped counts, forms, restoration, and the comments backfill use the new fields.
Shared display preferences
apps/web/lib/swr/use-partner-links-display.tsx, apps/web/lib/actions/partners/*, apps/web/lib/zod/schemas/programs.ts, apps/web/prisma/schema/program.prisma, apps/web/app/(ee)/partners.dub.co/.../links/*
Partner enrollment preferences store link display modes and properties. The provider resolves defaults, tracks changes, persists settings, and supplies the link display controls.
Partner customer, earnings, and analytics surfaces
apps/web/app/(ee)/partners.dub.co/.../customers/*, apps/web/app/(ee)/partners.dub.co/.../earnings/*, apps/web/ui/analytics/*
Partner titles appear in link cards, customer and earnings views, event tables, top links, and filters when title display is enabled. Views retain formatted short-link fallbacks.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant PartnerLinkAPI
  participant PrismaLink
  participant PartnerLinksDisplayProvider
  participant PartnerAnalyticsView
  PartnerLinkAPI->>PrismaLink: store partnerLinkTitle and partnerLinkComments
  PrismaLink-->>PartnerAnalyticsView: return partnerLinkTitle with link metrics
  PartnerAnalyticsView->>PartnerLinksDisplayProvider: read displayProperties
  PartnerLinksDisplayProvider-->>PartnerAnalyticsView: return title or link preference
  PartnerAnalyticsView-->>PartnerAnalyticsView: render title or short-link fallback
Loading

Possibly related PRs

  • dubinc/dub#3686: Both PRs modify earnings-composite-chart.tsx.
  • dubinc/dub#3861: Both PRs modify use-analytics-filters.tsx and partner-link filter behavior.

Suggested reviewers: devkiran, steven-tey

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 5.56% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main changes: adding titles and comments to partner links.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch partner-link-titles

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.

@pepeladeira
pepeladeira marked this pull request as ready for review August 5, 2026 14:46

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
apps/web/ui/analytics/use-analytics-filters.tsx (1)

426-448: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Refresh filter labels when display preferences change.

LinkFilterItem now reads partnerDisplayProperties, but the filters useMemo does not depend on it. When the preference changes after mount, link filter labels can retain the old title setting. Add partnerDisplayProperties to that dependency array.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/web/ui/analytics/use-analytics-filters.tsx` around lines 426 - 448,
Update the filters useMemo in use-analytics-filters.tsx so it includes
partnerDisplayProperties in its dependency array, since LinkFilterItem derives
its label from that value. Keep the existing LinkFilterItem and options mapping
logic unchanged, and ensure the memo recomputes when display preferences change
so link labels refresh after mount.
apps/web/ui/analytics/events/events-table.tsx (1)

174-199: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Do not format a partner link title as a URL.

shortLinkTitle returns arbitrary partnerLinkTitle values on partner pages. The Link cell later calls getPrettyUrl on that value. A title such as www.example/ renders as example.

Return label metadata from this callback, or skip getPrettyUrl when the value is a partner link title.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/web/ui/analytics/events/events-table.tsx` around lines 174 - 199, Update
shortLinkTitle and the Link cell’s rendering path so partnerLinkTitle values are
treated as display labels rather than URLs; either return metadata identifying
the title source and bypass getPrettyUrl, or conditionally skip getPrettyUrl for
that result. Preserve URL formatting for actual shortLink values and existing
fallback behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/web/lib/swr/use-partner-links-display.tsx`:
- Around line 149-158: Update the resolved preferences logic around
resolvedPersisted and resolveDefaultViewMode so persisted "cards" preferences
are overridden to row mode when showDetailedAnalytics is unavailable, preventing
PartnerLinkCard from rendering StatsCharts without analytics. Preserve the
original persisted preference separately if eligible programs need to restore it
later, while leaving eligible saved preferences unchanged.

In `@apps/web/lib/zod/schemas/partners.ts`:
- Around line 818-825: Apply the product maximum for partnerLinkComments in the
shared link validation schemas, then enforce the same bound in both createLink
and updateLink before passing rest.partnerLinkComments to Prisma. Keep
partnerLinkTitle behavior unchanged and ensure persisted comments cannot exceed
the Link.partnerLinkComments Text-column limit.

In `@apps/web/scripts/migrations/backfill-partner-link-comments.ts`:
- Around line 34-41: Update the migration’s write in the links batch around the
prisma link update to use updateMany with both id and partnerLinkComments: null
in the where clause, preserving the null guard so newly saved comments are not
overwritten by legacy values.

---

Outside diff comments:
In `@apps/web/ui/analytics/events/events-table.tsx`:
- Around line 174-199: Update shortLinkTitle and the Link cell’s rendering path
so partnerLinkTitle values are treated as display labels rather than URLs;
either return metadata identifying the title source and bypass getPrettyUrl, or
conditionally skip getPrettyUrl for that result. Preserve URL formatting for
actual shortLink values and existing fallback behavior.

In `@apps/web/ui/analytics/use-analytics-filters.tsx`:
- Around line 426-448: Update the filters useMemo in use-analytics-filters.tsx
so it includes partnerDisplayProperties in its dependency array, since
LinkFilterItem derives its label from that value. Keep the existing
LinkFilterItem and options mapping logic unchanged, and ensure the memo
recomputes when display preferences change so link labels refresh after mount.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 6c1b54b1-b032-4aa7-b1e8-6ea097767961

📥 Commits

Reviewing files that changed from the base of the PR and between 05e2193 and dbc4db1.

📒 Files selected for processing (26)
  • apps/web/app/(ee)/api/partner-profile/programs/[programId]/customers/count/route.ts
  • apps/web/app/(ee)/api/partner-profile/programs/[programId]/earnings/count/route.ts
  • apps/web/app/(ee)/api/partner-profile/programs/[programId]/links/[linkId]/route.ts
  • apps/web/app/(ee)/api/partner-profile/programs/[programId]/links/route.ts
  • apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/customers/(index)/page.tsx
  • apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/customers/(index)/use-partner-customer-filters.tsx
  • apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/earnings/earnings-composite-chart.tsx
  • apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/earnings/earnings-table.tsx
  • apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/links/page-client.tsx
  • apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/links/partner-link-card.tsx
  • apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/links/partner-link-display.tsx
  • apps/web/lib/analytics/get-analytics.ts
  • apps/web/lib/api/links/create-link.ts
  • apps/web/lib/api/links/update-link.ts
  • apps/web/lib/swr/use-partner-links-display.tsx
  • apps/web/lib/zod/schemas/analytics-response.ts
  • apps/web/lib/zod/schemas/customer-activity.ts
  • apps/web/lib/zod/schemas/links.ts
  • apps/web/lib/zod/schemas/partner-profile.ts
  • apps/web/lib/zod/schemas/partners.ts
  • apps/web/prisma/schema/link.prisma
  • apps/web/scripts/migrations/backfill-partner-link-comments.ts
  • apps/web/ui/analytics/events/events-table.tsx
  • apps/web/ui/analytics/top-links.tsx
  • apps/web/ui/analytics/use-analytics-filters.tsx
  • apps/web/ui/modals/partner-link-modal.tsx

Comment thread apps/web/lib/zod/schemas/partners.ts Outdated
Comment thread apps/web/scripts/migrations/backfill-partner-link-comments.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/web/lib/swr/use-partner-links-display.tsx`:
- Around line 75-84: The persisted preference path in use-partner-links-display
currently returns legacy stored data as-is, so an object with viewMode but no
displayOption bypasses the defaulting logic. Update the resolvedPersisted memo
to normalize the persisted shape before returning it, using displayOption as the
canonical field and falling back to the computed default when the stored value
is missing or incompatible; keep STORAGE_KEY unchanged unless you choose to
version and ignore old values instead.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 446f49c6-d348-484c-b784-2f66e6b96278

📥 Commits

Reviewing files that changed from the base of the PR and between dbc4db1 and 263551b.

📒 Files selected for processing (4)
  • apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/links/page-client.tsx
  • apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/links/partner-link-card.tsx
  • apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/links/partner-link-display.tsx
  • apps/web/lib/swr/use-partner-links-display.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/links/partner-link-display.tsx
  • apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/links/partner-link-card.tsx

Comment thread apps/web/lib/swr/use-partner-links-display.tsx

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/web/scripts/migrations/backfill-partner-link-comments.ts (1)

36-43: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Count rows updated, not rows selected.

updateMany can return count: 0 when another writer fills partnerLinkComments between findMany and this write. The current totalProcessed += links.length then logs rows as backfilled even when no row changed. Sum the update results instead.

Proposed fix
-    await Promise.all(
+    const updates = await Promise.all(
       links.map(({ id, comments }) =>
         prisma.link.updateMany({
           where: { id, partnerLinkComments: null },
           data: { partnerLinkComments: comments },
         }),
       ),
     );

-    totalProcessed += links.length;
+    const updatedCount = updates.reduce(
+      (total, { count }) => total + count,
+      0,
+    );
+    totalProcessed += updatedCount;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/web/scripts/migrations/backfill-partner-link-comments.ts` around lines
36 - 43, Update the backfill loop to count rows actually modified by each
prisma.link.updateMany call rather than links selected by findMany. Capture the
updateMany results and sum their count values into totalProcessed, preserving
the existing conditional update behavior for concurrent writes.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@apps/web/scripts/migrations/backfill-partner-link-comments.ts`:
- Around line 36-43: Update the backfill loop to count rows actually modified by
each prisma.link.updateMany call rather than links selected by findMany. Capture
the updateMany results and sum their count values into totalProcessed,
preserving the existing conditional update behavior for concurrent writes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 599b4e22-120f-4c2d-9e1e-b115587a7c3b

📥 Commits

Reviewing files that changed from the base of the PR and between 263551b and aec9d02.

📒 Files selected for processing (4)
  • apps/web/lib/swr/use-partner-links-display.tsx
  • apps/web/scripts/migrations/backfill-partner-link-comments.ts
  • apps/web/ui/analytics/events/events-table.tsx
  • apps/web/ui/analytics/use-analytics-filters.tsx
🚧 Files skipped from review as they are similar to previous changes (3)
  • apps/web/ui/analytics/events/events-table.tsx
  • apps/web/lib/swr/use-partner-links-display.tsx
  • apps/web/ui/analytics/use-analytics-filters.tsx

@pepeladeira

Copy link
Copy Markdown
Collaborator Author

@coderabbitai full review. any breaking changes or security issues?

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

@pepeladeira I will run a full review of #4275. I will check breaking API changes, authorization boundaries, private metadata exposure, validation, and migration behavior.

✅ Action performed

Full review finished.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@apps/web/app/`(ee)/api/partner-profile/programs/[programId]/links/[linkId]/route.ts:
- Around line 18-26: Both partner-link handlers silently ignore the legacy
comments field. Update the request parsing in the link-by-ID handler and the
collection handler to map comments to partnerLinkComments as a deprecated alias,
or explicitly reject comments with a clear 4xx; ensure neither handler accepts
and ignores the field.

In `@apps/web/lib/zod/schemas/partner-profile.ts`:
- Around line 96-97: Update PartnerProfileLinkSchema to preserve the deprecated
comments response field during migration, mapping it to the current
partnerLinkComments value so both partner link list and detail endpoints
continue serving existing clients.

In `@apps/web/prisma/schema/link.prisma`:
- Around line 81-83: Ensure the Prisma schema migration adding partnerLinkTitle
and partnerLinkComments is applied before deploying the partner-link profile
create/update writers, and verify these nullable columns exist before generating
or deploying clients that read or write them.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a2359374-3ed2-4135-9410-4894b1799a7b

📥 Commits

Reviewing files that changed from the base of the PR and between 05e2193 and aec9d02.

📒 Files selected for processing (26)
  • apps/web/app/(ee)/api/partner-profile/programs/[programId]/customers/count/route.ts
  • apps/web/app/(ee)/api/partner-profile/programs/[programId]/earnings/count/route.ts
  • apps/web/app/(ee)/api/partner-profile/programs/[programId]/links/[linkId]/route.ts
  • apps/web/app/(ee)/api/partner-profile/programs/[programId]/links/route.ts
  • apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/customers/(index)/page.tsx
  • apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/customers/(index)/use-partner-customer-filters.tsx
  • apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/earnings/earnings-composite-chart.tsx
  • apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/earnings/earnings-table.tsx
  • apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/links/page-client.tsx
  • apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/links/partner-link-card.tsx
  • apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/links/partner-link-display.tsx
  • apps/web/lib/analytics/get-analytics.ts
  • apps/web/lib/api/links/create-link.ts
  • apps/web/lib/api/links/update-link.ts
  • apps/web/lib/swr/use-partner-links-display.tsx
  • apps/web/lib/zod/schemas/analytics-response.ts
  • apps/web/lib/zod/schemas/customer-activity.ts
  • apps/web/lib/zod/schemas/links.ts
  • apps/web/lib/zod/schemas/partner-profile.ts
  • apps/web/lib/zod/schemas/partners.ts
  • apps/web/prisma/schema/link.prisma
  • apps/web/scripts/migrations/backfill-partner-link-comments.ts
  • apps/web/ui/analytics/events/events-table.tsx
  • apps/web/ui/analytics/top-links.tsx
  • apps/web/ui/analytics/use-analytics-filters.tsx
  • apps/web/ui/modals/partner-link-modal.tsx

Comment thread apps/web/lib/zod/schemas/partner-profile.ts Outdated
Comment thread apps/web/prisma/schema/link.prisma

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/web/lib/zod/schemas/partner-profile.ts`:
- Around line 89-94: Introduce a separate update schema for partner-link PATCH
requests rather than reusing createPartnerProfileLinkSchema. Make the update
schema distinguish an omitted url from an explicitly supplied destination, and
update the sibling PATCH route to preserve link.url when url is omitted while
validating and applying only an explicitly changed URL.

In `@apps/web/prisma/schema/program.prisma`:
- Line 150: Add a Prisma migration for the PartnerEnrollment.partnerPreferences
field, creating the nullable JSON column to match the schema. Ensure the release
flow applies this migration before enabling server actions that save partner
preferences.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: bea9d121-5817-4bd9-a1c6-d4e08c285a3a

📥 Commits

Reviewing files that changed from the base of the PR and between aec9d02 and 69d63f7.

📒 Files selected for processing (10)
  • apps/web/app/(ee)/api/partner-profile/programs/[programId]/links/[linkId]/route.ts
  • apps/web/app/(ee)/api/partner-profile/programs/[programId]/links/route.ts
  • apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/links/page-client.tsx
  • apps/web/lib/actions/partners/update-program-enrollment-preferences.ts
  • apps/web/lib/analytics/get-analytics.ts
  • apps/web/lib/swr/use-partner-links-display.tsx
  • apps/web/lib/types.ts
  • apps/web/lib/zod/schemas/partner-profile.ts
  • apps/web/lib/zod/schemas/programs.ts
  • apps/web/prisma/schema/program.prisma
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/web/app/(ee)/api/partner-profile/programs/[programId]/links/[linkId]/route.ts
  • apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/links/page-client.tsx

Comment thread apps/web/lib/zod/schemas/partner-profile.ts
Comment thread apps/web/prisma/schema/program.prisma
@pepeladeira

Copy link
Copy Markdown
Collaborator Author

@coderabbitai final review. any breaking changes?

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

git diff --stat HEAD^ HEAD
git diff -- apps/web/app/\(ee\)/api/partner-profile/programs/\[programId\]/links/route.ts \
  apps/web/app/\(ee\)/api/partner-profile/programs/\[programId\]/links/\[linkId\]/route.ts \
  apps/web/lib/actions/partners/update-program-enrollment-preferences.ts \
  apps/web/lib/zod/schemas/partner-profile.ts \
  apps/web/lib/zod/schemas/programs.ts \
  apps/web/lib/swr/use-partner-links-display.tsx \
  apps/web/scripts/migrations/backfill-partner-link-comments.ts \
  apps/web/lib/api/links/create-link.ts \
  apps/web/lib/api/links/update-link.ts \
  apps/web/lib/analytics/get-analytics.ts \
  apps/web/prisma/schema/link.prisma \
  apps/web/prisma/schema/program.prisma

ast-grep outline 'apps/web/app/(ee)/api/partner-profile/programs/[programId]/links/route.ts' --view expanded
ast-grep outline 'apps/web/app/(ee)/api/partner-profile/programs/[programId]/links/[linkId]/route.ts' --view expanded
ast-grep outline apps/web/lib/actions/partners/update-program-enrollment-preferences.ts --view expanded
ast-grep outline apps/web/lib/zod/schemas/partner-profile.ts --view expanded
ast-grep outline apps/web/lib/zod/schemas/programs.ts --view expanded

Length of output: 5332


🏁 Script executed:

#!/bin/bash
set -euo pipefail

base_ref=""
for ref in origin/main main; do
  if git rev-parse --verify -q "$ref" >/dev/null; then
    base_ref="$ref"
    break
  fi
done
if [ -z "$base_ref" ]; then
  echo "ERROR: main base ref is unavailable"
  exit 1
fi

merge_base="$(git merge-base "$base_ref" HEAD)"
printf 'BASE=%s\nMERGE_BASE=%s\n' "$base_ref" "$merge_base"
git diff --stat "$merge_base"...HEAD
git diff --name-status "$merge_base"...HEAD

git diff --find-renames -- "$merge_base"...HEAD -- \
  'apps/web/app/(ee)/api/partner-profile/programs/[programId]/links/route.ts' \
  'apps/web/app/(ee)/api/partner-profile/programs/[programId]/links/[linkId]/route.ts' \
  apps/web/lib/actions/partners/update-program-enrollment-preferences.ts \
  apps/web/lib/zod/schemas/partner-profile.ts \
  apps/web/lib/zod/schemas/programs.ts \
  apps/web/lib/swr/use-partner-links-display.tsx \
  apps/web/scripts/migrations/backfill-partner-link-comments.ts \
  apps/web/lib/api/links/create-link.ts \
  apps/web/lib/api/links/update-link.ts \
  apps/web/lib/analytics/get-analytics.ts \
  apps/web/prisma/schema/link.prisma \
  apps/web/prisma/schema/program.prisma \
  apps/web/scripts/misc/restore-program-enrollments.ts

sed -n '1,230p' 'apps/web/app/(ee)/api/partner-profile/programs/[programId]/links/[linkId]/route.ts'
sed -n '80,155p' apps/web/lib/zod/schemas/partner-profile.ts
sed -n '1,130p' apps/web/lib/actions/partners/update-program-enrollment-preferences.ts
sed -n '130,180p' apps/web/lib/zod/schemas/programs.ts
sed -n '1,130p' apps/web/scripts/migrations/backfill-partner-link-comments.ts

rg -n -C 3 'updateProgramEnrollmentPreferences\s*\(' apps/web --glob '*.{ts,tsx}'
rg -n -C 3 'partnerLinkComments|partnerLinkTitle' 'apps/web/app/(ee)/api/partner-profile' --glob '*.{ts,tsx}'

Length of output: 18606


🏁 Script executed:

#!/bin/bash
set -euo pipefail

sed -n '1,190p' 'apps/web/app/(ee)/api/partner-profile/programs/[programId]/links/route.ts'
sed -n '1,240p' apps/web/lib/swr/use-partner-links-display.tsx
sed -n '1,240p' 'apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/links/partner-link-display.tsx'
sed -n '1,220p' apps/web/ui/modals/partner-link-modal.tsx
sed -n '1,120p' apps/web/prisma/schema/link.prisma
sed -n '1,110p' apps/web/prisma/schema/program.prisma
sed -n '1,130p' apps/web/scripts/misc/restore-program-enrollments.ts

rg -n -C 4 '\bcomments\b|partnerLinkComments|partnerLinkTitle' \
  'apps/web/app/(ee)/api/partner-profile/programs/[programId]/links' \
  apps/web/ui/modals/partner-link-modal.tsx \
  --glob '*.{ts,tsx}' || true

rg -n -C 4 '\bupdateProgramEnrollmentPreferences\b' apps/web --glob '*.{ts,tsx}' || true

fd -a -t d 'migrations|migration' apps/web/prisma . | head -40
fd -a -t f . apps/web/prisma | head -100

Length of output: 50676


@pepeladeira I found one breaking API change.

  • The partner-link API replaces comments with partnerLinkComments in both POST and PATCH requests and partner-link responses.
  • Existing clients that send comments will not update comments. The request succeeds because the schema strips the unknown field.
  • Existing clients that read comments will no longer receive it.
  • The backfill script preserves existing database values, but it does not preserve API compatibility.

To avoid the break, accept comments as a deprecated alias during a transition period and return it alongside partnerLinkComments, or release this as a documented versioned API change.

I found no security issue in the reviewed authorization paths. The new enrollment-preferences action verifies that the authenticated partner owns the target enrollment before it updates preferences.

You are interacting with an AI system.

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.

1 participant