Duplicate partners links - #4153
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedNo new commits to review since the last review. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughShared-platform matching moved into a reusable helper, with new admin and program API routes and program-specific response types. Partner UI components now fetch and render admin or program matches, including enrollment statuses and program-specific links. ChangesShared partner platform flows
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant PartnerView
participant PartnerPlatformSummary
participant SharedPlatformsAPI
participant getSharedPartnerPlatforms
participant Prisma
PartnerView->>PartnerPlatformSummary: enable shared-platform display
PartnerPlatformSummary->>SharedPlatformsAPI: request workspace-scoped matches
SharedPlatformsAPI->>getSharedPartnerPlatforms: pass partnerId and programId
getSharedPartnerPlatforms->>Prisma: query verified matching platforms
Prisma-->>getSharedPartnerPlatforms: partners and enrollment statuses
getSharedPartnerPlatforms-->>SharedPlatformsAPI: grouped shared platforms
SharedPlatformsAPI-->>PartnerPlatformSummary: validated platform data
PartnerPlatformSummary-->>PartnerView: render status-aware partner links
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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.
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/api/partners/get-shared-partner-platforms.ts`:
- Around line 78-121: Replace the single combined `partnerPlatform.findMany`
query in the shared-platform matching logic with per-platform-type queries, each
restricted to that type and limited to the downstream per-type cap (10), then
combine the results. Preserve the existing partner, verification, program,
ordering, and match-condition filters while ensuring every verified platform
type receives its own result allowance before the per-type slicing logic.
🪄 Autofix (Beta)
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
Run ID: 1868be53-65cc-49c7-8070-d46d5f48b6a0
📒 Files selected for processing (11)
.gitignoreapps/web/app/(ee)/api/admin/partners/[partnerId]/shared-platforms/route.tsapps/web/app/(ee)/api/partners/[partnerId]/shared-platforms/route.tsapps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/applications/rejected/page-client.tsxapps/web/lib/api/partners/get-shared-partner-platforms.tsapps/web/lib/types.tsapps/web/lib/zod/schemas/partners.tsapps/web/ui/partners/partner-about.tsxapps/web/ui/partners/partner-application-sheet.tsxapps/web/ui/partners/partner-platform-shared-partners.tsxapps/web/ui/partners/partner-platform-summary.tsx
|
@coderabbitai full review. any breaking changes or security issues? |
🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
gh pr view 4153 --repo dubinc/dub --json title,body,files,additions,deletions | head -c 3000
echo "---DIFF ROUTE ADMIN---"
gh pr diff 4153 --repo dubinc/dub -- apps/web/app/\(ee\)/api/admin/partners/\[partnerId\]/shared-platforms/route.ts || true
echo "---DIFF ROUTE PARTNER---"
gh pr diff 4153 --repo dubinc/dub -- apps/web/app/\(ee\)/api/partners/\[partnerId\]/shared-platforms/route.ts || true
echo "---DIFF GET-SHARED---"
gh pr diff 4153 --repo dubinc/dub -- apps/web/lib/api/partners/get-shared-partner-platforms.ts || trueLength of output: 3064 🏁 Script executed: #!/bin/bash
set -euo pipefail
gh pr diff 4153 --repo dubinc/dub > /tmp/pr.diff
wc -l /tmp/pr.diff
echo "---ROUTE ADMIN---"
awk '/diff --git a\/apps\/web\/app\/\(ee\)\/api\/admin\/partners\/\[partnerId\]\/shared-platforms\/route.ts/,/^diff --git/' /tmp/pr.diff | head -160
echo "---ROUTE PARTNER---"
awk '/diff --git a\/apps\/web\/app\/\(ee\)\/api\/partners\/\[partnerId\]\/shared-platforms\/route.ts/,/^diff --git/' /tmp/pr.diff | head -80
echo "---GET-SHARED---"
awk '/diff --git a\/apps\/web\/lib\/api\/partners\/get-shared-partner-platforms.ts/,0' /tmp/pr.diff | head -220Length of output: 7441 🏁 Script executed: #!/bin/bash
set -euo pipefail
python3 - <<'EOF'
import re
with open('/tmp/pr.diff') as f:
content = f.read()
parts = re.split(r'(?=^diff --git )', content, flags=re.M)
for p in parts:
if 'admin/partners/[partnerId]/shared-platforms/route.ts' in p.splitlines()[0] if p.strip() else False:
print(p)
print('=====END=====')
if p.strip() and 'app/(ee)/api/partners/[partnerId]/shared-platforms/route.ts' in p.splitlines()[0] and 'admin' not in p.splitlines()[0]:
print(p)
print('=====END=====')
EOFLength of output: 6372 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "---withWorkspace default permission model---"
rg -n "export function withWorkspace|requiredPlan|requiredRole" apps/web/lib/auth/workspace.ts | head -40
echo "---getProgramEnrollmentOrThrow---"
fd get-program-enrollment-or-throw
cat apps/web/lib/api/programs/get-program-enrollment-or-throw.ts 2>/dev/null | head -60
echo "---similar existing partner routes for pattern comparison---"
rg -n "withWorkspace\(" apps/web/app/\(ee\)/api/partners --type=ts -l | head -20
echo "---partner-platform-summary diff---"
python3 - <<'EOF'
import re
with open('/tmp/pr.diff') as f:
content = f.read()
parts = re.split(r'(?=^diff --git )', content, flags=re.M)
for p in parts:
if p.strip() and 'partner-platform-summary.tsx' in p.splitlines()[0]:
print(p)
EOFLength of output: 7529 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "--- partners/[partnerId]/route.ts ---"
sed -n '1,60p' "apps/web/app/(ee)/api/partners/[partnerId]/route.ts"
echo "--- partners/[partnerId]/comments/route.ts (role check pattern) ---"
sed -n '1,40p' "apps/web/app/(ee)/api/partners/[partnerId]/comments/route.ts"
echo "--- check DubApiError not_found code exposure vs enumeration ---"
rg -n "not_found" apps/web/lib/api/errors.ts | head -5Length of output: 2800 Good, this confirms consistent patterns with existing partner endpoints (no
No breaking changes found:
Security review — nothing severe, but two things worth a closer look:
One minor non-security note: Overall the refactor to share logic between admin/program routes is clean, and the enrollment-status scoping for program view is correctly enforced. ✅ Action performedReview finished.
|
|
@coderabbitai full review. any breaking changes or security issues? |
|
Breaking changes: None found. The admin route refactor and Security:
If there have been new commits pushed since my last pass, let me know and I'll kick off a fresh full review; otherwise the above still stands as my complete assessment. ✅ Action performedFull review finished. |
|
@coderabbitai I've pushed new changes. full review. any breaking changes or security issues? |
🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
gh pr view 4153 --repo dubinc/dub --json commits,updatedAt,additions,deletions | python3 -m json.tool | tail -60
echo "---LATEST DIFF SUMMARY---"
gh pr diff 4153 --repo dubinc/dub --name-only
echo "---FULL DIFF SAVE---"
gh pr diff 4153 --repo dubinc/dub > /tmp/pr_new.diff
wc -l /tmp/pr_new.diffLength of output: 3267 🏁 Script executed: #!/bin/bash
set -euo pipefail
python3 - <<'EOF'
import re
with open('/tmp/pr_new.diff') as f:
content = f.read()
parts = re.split(r'(?=^diff --git )', content, flags=re.M)
for p in parts:
if p.strip() and 'get-shared-partner-platforms.ts' in p.splitlines()[0]:
print(p)
print("=====END=====")
EOFLength of output: 5983 🏁 Script executed: #!/bin/bash
set -euo pipefail
python3 - <<'EOF'
import re
with open('/tmp/pr_new.diff') as f:
content = f.read()
parts = re.split(r'(?=^diff --git )', content, flags=re.M)
for p in parts:
if not p.strip():
continue
header = p.splitlines()[0]
if 'get-shared-partner-platforms.ts' in header:
continue
print(p)
print("=====END=====")
EOFLength of output: 18278 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "---PartnerStatusBadges---"
fd partner-status-badges
cat apps/web/ui/partners/partner-status-badges.tsx 2>/dev/null | head -40
echo "---ArrowUpRight2 export---"
rg -n "ArrowUpRight2" packages/ui/src/icons -l 2>/dev/null || rg -n "ArrowUpRight2" --type=ts -l | head -5
echo "---useWorkspace slug typing---"
rg -n "export default function useWorkspace" -A 30 apps/web/lib/swr/use-workspace.ts | head -40
echo "---getProgramEnrollmentOrThrow signature---"
sed -n '1,60p' apps/web/lib/api/programs/get-program-enrollment-or-throw.tsLength of output: 947 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "---PartnerStatusBadges---"
cat apps/web/ui/partners/partner-status-badges.ts
echo "---ArrowUpRight2 export---"
rg -n "ArrowUpRight2" --type=ts --type=tsx -g '!node_modules' | head -10 || true
rg -n "ArrowUpRight2" -g '*.ts' -g '*.tsx' | head -10 || true
echo "---useWorkspace slug typing---"
rg -n "slug" apps/web/lib/swr/use-workspace.ts | head -20
echo "---getProgramEnrollmentOrThrow signature---"
sed -n '1,60p' apps/web/lib/api/programs/get-program-enrollment-or-throw.ts || trueLength of output: 2027 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "---ArrowUpRight2 export---"
rg -n "ArrowUpRight2" -g '*.ts' -g '*.tsx' packages/ui 2>/dev/null | head -10
echo "---useWorkspace slug---"
rg -n "slug" apps/web/lib/swr/use-workspace.ts | head -20
echo "---getProgramEnrollmentOrThrow---"
fd get-program-enrollment-or-throw
sed -n '1,60p' apps/web/lib/api/programs/get-program-enrollment-or-throw.tsLength of output: 2438
Breaking changes: None. All changes remain additive/backward-compatible — same as before. Security:
Improvement since last review: The minor "N queries per platform type" overhead I flagged earlier has actually been addressed. One tiny nit (non-blocking): In the new Overall: still no breaking changes or severe security issues, and the query consolidation is a solid improvement over the previous version. ✅ Action performedReview finished.
|
Summary by CodeRabbit