Skip to content

Support adding reward change description - #4301

Merged
steven-tey merged 2 commits into
mainfrom
add-reward-change-description
Aug 10, 2026
Merged

Support adding reward change description#4301
steven-tey merged 2 commits into
mainfrom
add-reward-change-description

Conversation

@steven-tey

@steven-tey steven-tey commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator
CleanShot 2026-08-09 at 16 59 57@2x

Summary by CodeRabbit

  • New Features
    • Add an optional message when creating, updating, or deleting rewards.
    • Messages are limited to 240 characters and automatically trimmed.
    • Partner notifications now include submitted reward change messages.
  • Activity Logs
    • Reward activity entries display change messages alongside the contributor’s avatar.
    • Updated reward details use a clearer card-based presentation.
  • Validation
    • Confirmation dialogs provide character counts and validation feedback for messages.
    • Empty messages are handled automatically without adding unnecessary content.

@cursor

cursor Bot commented Aug 9, 2026

Copy link
Copy Markdown

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.

@vercel

vercel Bot commented Aug 9, 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 10, 2026 12:10am

Request Review

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Reward changes now accept optional activityDescription values. The values are validated, passed through reward actions, stored in processing and activity-log payloads, and rendered in activity entries and partner update emails.

Changes

Reward activity descriptions

Layer / File(s) Summary
Description contracts and payloads
apps/web/lib/zod/schemas/rewards.ts, apps/web/lib/api/rewards/queue-reward-processing.ts, apps/web/lib/api/partners/notify-partner-reward-change.ts, packages/email/src/templates/partner-reward-updated.tsx
Added an optional trimmed activityDescription field with a 240-character limit. Processing payloads and partner update emails accept and render the field.
Description capture and reward actions
apps/web/ui/modals/confirm-reward-change-modal.tsx, apps/web/ui/partners/rewards/add-edit-reward-sheet.tsx, apps/web/lib/actions/partners/*-reward.ts
The confirmation modal collects and validates an optional message. Create, update, and delete flows pass it to reward actions, processing snapshots, and activity logs.
Activity log delivery
apps/web/lib/api/activity-log/track-reward-activity-log.ts
Activity logs trim descriptions and attach them to the primary reward lifecycle entry, or the first entry when no primary entry exists.
Activity presentation
apps/web/ui/activity-logs/action-renderers/reward-activity-renderer.tsx, apps/web/ui/activity-logs/activity-entry-chips.tsx
Reward activity entries display descriptions in a separate footer and preserve avatar layout.

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
Loading

Possibly related PRs

  • dubinc/dub#3923: Overlaps with the reward create, update, and delete action and snapshot flow.
  • dubinc/dub#3944: Introduced the reward-processing and notification flow extended here.
  • dubinc/dub#4080: Modified the reward confirmation modal and reward sheet flow extended here.

Suggested reviewers: devkiran, pepeladeira

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding descriptions to reward changes.
✨ 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 add-reward-change-description

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.

@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/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

📥 Commits

Reviewing files that changed from the base of the PR and between 84c432a and b0e693e.

📒 Files selected for processing (12)
  • apps/web/lib/actions/partners/create-reward.ts
  • apps/web/lib/actions/partners/delete-reward.ts
  • apps/web/lib/actions/partners/update-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/activity-logs/action-renderers/reward-activity-renderer.tsx
  • apps/web/ui/activity-logs/activity-entry-chips.tsx
  • 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

Comment thread apps/web/lib/api/activity-log/track-reward-activity-log.ts
@steven-tey

Copy link
Copy Markdown
Collaborator Author

@coderabbitai final review, any breaking changes?

@coderabbitai

coderabbitai Bot commented Aug 9, 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 --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 packages

Length 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-logs

Length of output: 28922


@steven-tey No breaking changes identified.

  • changeDescription is optional in every changed action and queue payload.
  • Existing onConfirm: () => Promise<void> callbacks remain compatible with the new optional parameter.
  • The reward-processing route preserves the description across queued batches and passes it to partner notifications.
  • Activity logs use the existing description field. No database migration is required.
  • The reward activity renderer renders the description as text.

git diff --check also completed without errors.

You are interacting with an AI system.

@steven-tey

Copy link
Copy Markdown
Collaborator Author

@coderabbitai I made some naming changes, final review please

@coderabbitai

coderabbitai Bot commented Aug 10, 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

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 packages

Length 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 packages

Length of output: 46249


@steven-tey Final review complete. I found no breaking changes.

  • activityDescription replaces the previous naming consistently.
  • The schema validates and trims the optional value.
  • The value persists through queued reward-processing batches.
  • Partner notifications and activity logs receive the value.
  • The activity-log UI renders the stored description safely as text.
  • No stale changeDescription identifiers remain in apps or packages.
  • git diff --check completed without errors.

I did not run runtime tests in this environment.

You are interacting with an AI system.

@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/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

📥 Commits

Reviewing files that changed from the base of the PR and between b0e693e and 52d2efe.

📒 Files selected for processing (9)
  • apps/web/lib/actions/partners/create-reward.ts
  • apps/web/lib/actions/partners/delete-reward.ts
  • apps/web/lib/actions/partners/update-reward.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
🚧 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

Comment thread apps/web/lib/api/rewards/queue-reward-processing.ts
@steven-tey
steven-tey merged commit bf5335e into main Aug 10, 2026
12 checks passed
@steven-tey
steven-tey deleted the add-reward-change-description branch August 10, 2026 02:12
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