Support adding reward change description - #4301
Conversation
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughReward changes now accept optional ChangesReward activity descriptions
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Partner
participant ConfirmRewardChangeModal
participant AddEditRewardSheet
participant RewardAction
participant ActivityLog
participant PartnerEmail
Partner->>ConfirmRewardChangeModal: Enter optional activityDescription
ConfirmRewardChangeModal->>AddEditRewardSheet: Submit trimmed activityDescription
AddEditRewardSheet->>RewardAction: Send reward change payload
RewardAction->>ActivityLog: Record description with reward lifecycle event
RewardAction->>PartnerEmail: Send reward snapshot with description
PartnerEmail-->>Partner: Render program message
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 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.
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/activity-log/track-reward-activity-log.ts`:
- Around line 227-239: Update the activity-log handling around
updateRewardAction so an activityDescription creates a reward.updated entry when
no activity logs exist, while preserving the existing description assignment for
existing reward logs. Ensure unchanged reward updates persist the submitted
description and retain the notification flow.
🪄 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: 32ac4bfd-e66e-4d9a-9ac9-6bbc86b7bcef
📒 Files selected for processing (12)
apps/web/lib/actions/partners/create-reward.tsapps/web/lib/actions/partners/delete-reward.tsapps/web/lib/actions/partners/update-reward.tsapps/web/lib/api/activity-log/track-reward-activity-log.tsapps/web/lib/api/partners/notify-partner-reward-change.tsapps/web/lib/api/rewards/queue-reward-processing.tsapps/web/lib/zod/schemas/rewards.tsapps/web/ui/activity-logs/action-renderers/reward-activity-renderer.tsxapps/web/ui/activity-logs/activity-entry-chips.tsxapps/web/ui/modals/confirm-reward-change-modal.tsxapps/web/ui/partners/rewards/add-edit-reward-sheet.tsxpackages/email/src/templates/partner-reward-updated.tsx
|
@coderabbitai final review, any breaking changes? |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
git diff --check origin/main...HEAD
git diff --find-renames --unified=80 origin/main...HEAD -- \
apps/web/lib/actions/partners/create-reward.ts \
apps/web/lib/actions/partners/update-reward.ts \
apps/web/lib/actions/partners/delete-reward.ts \
apps/web/lib/api/activity-log/track-reward-activity-log.ts \
apps/web/lib/api/partners/notify-partner-reward-change.ts \
apps/web/lib/api/rewards/queue-reward-processing.ts \
apps/web/lib/zod/schemas/rewards.ts \
apps/web/ui/modals/confirm-reward-change-modal.tsx \
apps/web/ui/partners/rewards/add-edit-reward-sheet.tsx \
packages/email/src/templates/partner-reward-updated.tsx
printf '\n--- Changed API usage search ---\n'
rg -n -C 3 \
'useConfirmRewardChangeModal|openConfirmRewardChangeModal|ConfirmRewardChangeModal|trackRewardActivityLog|notifyPartnerRewardChange|queueRewardProcessing|createRewardAction|updateRewardAction|deleteRewardAction|rewardChangeDescriptionSchema' \
apps packagesLength of output: 81236 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '--- Relevant source outlines ---'
ast-grep outline 'apps/web/app/(ee)/api/cron/rewards/process/route.ts' --items all
ast-grep outline apps/web/lib/api/activity-log/track-reward-activity-log.ts --items all
ast-grep outline apps/web/ui/activity-logs/action-renderers/reward-activity-renderer.tsx --items all
ast-grep outline apps/web/lib/api/activity-log/track-activity-log.ts --items all 2>/dev/null || true
printf '%s\n' '--- Processing and activity-log path ---'
sed -n '1,230p' 'apps/web/app/(ee)/api/cron/rewards/process/route.ts'
sed -n '1,230p' apps/web/lib/api/activity-log/track-reward-activity-log.ts
sed -n '1,220p' apps/web/lib/api/activity-log/track-activity-log.ts 2>/dev/null || true
printf '%s\n' '--- Remaining changed UI diff ---'
git diff --find-renames --unified=80 origin/main...HEAD -- \
apps/web/ui/activity-logs/action-renderers/reward-activity-renderer.tsx \
apps/web/ui/activity-logs/activity-entry-chips.tsx
printf '%s\n' '--- Activity description rendering and persistence references ---'
rg -n -C 3 'description:.*activity|activity.*description|ActivityLog.*description|description.*ActivityLog|activity\.description' \
apps/web/lib/api/activity-log apps/web/ui/activity-logsLength of output: 28922
You are interacting with an AI system. |
|
@coderabbitai I made some naming changes, final review please |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
base="origin/main...HEAD"
printf '%s\n' '--- Diff check ---'
git diff --check "$base"
printf '%s\n' '--- Changed files ---'
git diff --name-status "$base"
printf '%s\n' '--- Focused diff ---'
git diff --find-renames --unified=60 "$base" -- \
apps/web/lib/actions/partners/create-reward.ts \
apps/web/lib/actions/partners/update-reward.ts \
apps/web/lib/actions/partners/delete-reward.ts \
apps/web/lib/api/activity-log/track-reward-activity-log.ts \
apps/web/lib/api/partners/notify-partner-reward-change.ts \
apps/web/lib/api/rewards/queue-reward-processing.ts \
apps/web/lib/zod/schemas/rewards.ts \
apps/web/ui/modals/confirm-reward-change-modal.tsx \
apps/web/ui/partners/rewards/add-edit-reward-sheet.tsx \
packages/email/src/templates/partner-reward-updated.tsx
printf '%s\n' '--- Export and contract outlines ---'
ast-grep outline apps/web/lib/zod/schemas/rewards.ts --items all
ast-grep outline apps/web/lib/actions/partners/create-reward.ts --items all
ast-grep outline apps/web/lib/actions/partners/update-reward.ts --items all
ast-grep outline apps/web/lib/actions/partners/delete-reward.ts --items all
ast-grep outline apps/web/lib/api/activity-log/track-reward-activity-log.ts --items all
ast-grep outline apps/web/lib/api/partners/notify-partner-reward-change.ts --items all
ast-grep outline apps/web/lib/api/rewards/queue-reward-processing.ts --items all
ast-grep outline apps/web/ui/modals/confirm-reward-change-modal.tsx --items all
ast-grep outline packages/email/src/templates/partner-reward-updated.tsx --items all
printf '%s\n' '--- Reward-description references and call sites ---'
rg -n -C 4 --glob '*.ts' --glob '*.tsx' \
'changeDescription|rewardChangeDescriptionSchema|trackRewardActivityLog\s*\(|notifyPartnerRewardChange\s*\(|queueRewardProcessing\s*\(|useConfirmRewardChangeModal\s*\(|openConfirmRewardChangeModal\s*\(' \
apps packagesLength of output: 75458 🏁 Script executed: #!/bin/bash
set -euo pipefail
base="origin/main...HEAD"
printf '%s\n' '--- Remaining changed UI diff ---'
git diff --find-renames --unified=80 "$base" -- \
apps/web/ui/activity-logs/action-renderers/reward-activity-renderer.tsx \
apps/web/ui/activity-logs/activity-entry-chips.tsx
printf '%s\n' '--- Activity-log parameter type and renderer ---'
sed -n '1,230p' apps/web/lib/api/activity-log/track-reward-activity-log.ts
sed -n '1,280p' apps/web/ui/activity-logs/action-renderers/reward-activity-renderer.tsx
sed -n '1,240p' apps/web/ui/activity-logs/activity-entry-chips.tsx
printf '%s\n' '--- Reward job parsing and notification path ---'
sed -n '1,240p' 'apps/web/app/(ee)/api/cron/rewards/process/route.ts'
printf '%s\n' '--- Stale identifier search ---'
rg -n -C 2 --glob '*.ts' --glob '*.tsx' \
'\bchangeDescription\b|rewardChangeDescriptionSchema' \
apps packages || true
printf '%s\n' '--- Activity-description property coverage ---'
rg -n -C 2 --glob '*.ts' --glob '*.tsx' \
'\bactivityDescription\b' \
apps packagesLength of output: 46249
I did not run runtime tests in this environment. You are interacting with an AI system. |
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/rewards/queue-reward-processing.ts`:
- Line 29: Update rewardJobSchema so activityDescription reuses
rewardActivityDescriptionSchema instead of a generic optional string, preserving
the canonical trimming and 240-character validation for queued jobs. Ensure the
value is validated before qstash.publishJSON and remains compatible with the
cron replay input path.
🪄 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: ab9c56b9-cf09-4ca8-ade5-8a68e63fc662
📒 Files selected for processing (9)
apps/web/lib/actions/partners/create-reward.tsapps/web/lib/actions/partners/delete-reward.tsapps/web/lib/actions/partners/update-reward.tsapps/web/lib/api/partners/notify-partner-reward-change.tsapps/web/lib/api/rewards/queue-reward-processing.tsapps/web/lib/zod/schemas/rewards.tsapps/web/ui/modals/confirm-reward-change-modal.tsxapps/web/ui/partners/rewards/add-edit-reward-sheet.tsxpackages/email/src/templates/partner-reward-updated.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
- apps/web/ui/partners/rewards/add-edit-reward-sheet.tsx
- apps/web/lib/actions/partners/update-reward.ts
Summary by CodeRabbit