Enforce program support email#4039
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthrough
ChangessupportEmail required in program onboarding
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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.
🧹 Nitpick comments (1)
apps/web/lib/zod/schemas/programs.ts (1)
106-106: 💤 Low valueMisleading comment: field is
optional()but comment says "required".The comment states support email is required, but this schema marks it as
.optional(). The actual requirement is enforced inprogramSupportSchema(inprogram-onboarding.ts). Consider clarifying or removing the comment to avoid confusion.- supportEmail: z.email().max(255).optional(), // Support email is required for a program + supportEmail: z.email().max(255).optional(), // Requirement enforced in programSupportSchema for onboarding🤖 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/lib/zod/schemas/programs.ts` at line 106, The comment on the `supportEmail` field in the `supportEmail: z.email().max(255).optional()` line is misleading because it states the field is required, but the schema marks it as `.optional()`. Remove or clarify this comment to accurately reflect that the field is optional in this schema, but note that the actual requirement is enforced in the `programSupportSchema` in `program-onboarding.ts` to avoid confusion for future maintainers.
🤖 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.
Nitpick comments:
In `@apps/web/lib/zod/schemas/programs.ts`:
- Line 106: The comment on the `supportEmail` field in the `supportEmail:
z.email().max(255).optional()` line is misleading because it states the field is
required, but the schema marks it as `.optional()`. Remove or clarify this
comment to accurately reflect that the field is optional in this schema, but
note that the actual requirement is enforced in the `programSupportSchema` in
`program-onboarding.ts` to avoid confusion for future maintainers.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 4230e566-e0a6-446f-958c-2812ee6bf3de
📒 Files selected for processing (3)
apps/web/app/(ee)/app.dub.co/(new-program)/[slug]/program/new/overview/page-client.tsxapps/web/lib/zod/schemas/program-onboarding.tsapps/web/lib/zod/schemas/programs.ts
|
@coderabbitai full review please |
🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Read all changed files
echo "=== programs.ts ==="
cat apps/web/lib/zod/schemas/programs.ts
echo ""
echo "=== program-onboarding.ts ==="
cat apps/web/lib/zod/schemas/program-onboarding.ts
echo ""
echo "=== page-client.tsx (overview) ==="
cat "apps/web/app/(ee)/app.dub.co/(new-program)/[slug]/program/new/overview/page-client.tsx"
echo ""
echo "=== program-help-and-support.tsx ==="
cat apps/web/app/app.dub.co/\(dashboard\)/\[slug\]/\(ee\)/program/resources/program-help-and-support.tsx
echo ""
echo "=== program-onboarding-form-wrapper.tsx ==="
cat apps/web/ui/partners/program-onboarding-form-wrapper.tsxLength of output: 26076 🏁 Script executed: #!/bin/bash
echo "=== updateProgramAction ==="
fd "update-program" apps/web/lib/actions --type f -x cat {}
echo ""
echo "=== onboard-program action ==="
fd "onboard-program" apps/web/lib/actions --type f -x cat {}
echo "=== ProgramData type ==="
rg -n "ProgramData" apps/web/lib/types.ts | head -20
rg -n "supportEmail" apps/web/lib/types.ts
echo ""
echo "=== Check DB update for supportEmail ==="
rg -rn "supportEmail" apps/web/lib --include="*.ts" -C 2Length of output: 15674
SummaryThe PR correctly enforces 1. Misleading comment in
|
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/zod/schemas/programs.ts`:
- Line 106: The inline comment for the supportEmail field in the programs schema
contradicts the actual schema definition. The field is marked as optional() but
the comment states "Support email is required for a program," which is incorrect
and misleading. Update the comment on the supportEmail field to accurately
reflect that the field is optional, not required, or clarify the intent if this
is intentional and the optional requirement is conditional.
🪄 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: e7e24ce3-58a3-4af5-8c5e-285d4ff5f50a
📒 Files selected for processing (5)
apps/web/app/(ee)/app.dub.co/(new-program)/[slug]/program/new/overview/page-client.tsxapps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/resources/program-help-and-support.tsxapps/web/lib/zod/schemas/program-onboarding.tsapps/web/lib/zod/schemas/programs.tsapps/web/ui/partners/program-onboarding-form-wrapper.tsx
| message: `Minimum payout amount must be one of ${ALLOWED_MIN_PAYOUT_AMOUNTS.join(", ")}`, | ||
| }), | ||
| supportEmail: z.email().max(255).nullish(), | ||
| supportEmail: z.email().max(255).optional(), // Support email is required for a program |
There was a problem hiding this comment.
Fix contradictory inline comment for supportEmail.
The schema is optional() here, but the comment says “required,” which misstates this specific contract and can mislead future edits.
Suggested clarification
- supportEmail: z.email().max(255).optional(), // Support email is required for a program
+ supportEmail: z.email().max(255).optional(), // Required during onboarding; optional in update schema (often consumed via .partial())📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| supportEmail: z.email().max(255).optional(), // Support email is required for a program | |
| supportEmail: z.email().max(255).optional(), // Required during onboarding; optional in update schema (often consumed via .partial()) |
🤖 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/lib/zod/schemas/programs.ts` at line 106, The inline comment for the
supportEmail field in the programs schema contradicts the actual schema
definition. The field is marked as optional() but the comment states "Support
email is required for a program," which is incorrect and misleading. Update the
comment on the supportEmail field to accurately reflect that the field is
optional, not required, or clarify the intent if this is intentional and the
optional requirement is conditional.
Summary by CodeRabbit
New Features
Bug Fixes