Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@steven-tey
Copy link
Collaborator

@steven-tey steven-tey commented Oct 9, 2025

Summary by CodeRabbit

  • New Features

    • Finalized submissions record and show a completion date; performance bounties show “Completed” with that date. Bounty cards now show an “Ended {Month}” badge when finished.
    • Submission counts and labels now differentiate “completed” (performance) vs “submitted” (others).
  • Bug Fixes

    • Fixed inconsistent date sources so status badges and tables display the correct completion/review dates.
  • Chores

    • Backend now stores completion timestamps and backfills existing submissions.

@vercel
Copy link
Contributor

vercel bot commented Oct 9, 2025

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

Project Deployment Preview Updated (UTC)
dub Ready Ready Preview Oct 9, 2025 7:47pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 9, 2025

Walkthrough

Adds a nullable completedAt timestamp to BountySubmission (schema, Zod, Prisma), writes completedAt when submissions are finalized/submitted, updates APIs to backfill and filter counts by submitted/approved, and adjusts UI to use completedAt/reviewedAt for status labels and displayed dates.

Changes

Cohort / File(s) Summary
Schema: submission timestamp
packages/prisma/schema/bounty.prisma, apps/web/lib/zod/schemas/bounties.ts
Add completedAt to BountySubmission (Prisma DateTime?; Zod z.date().nullable()).
Backend: set completedAt on submit/finalize
apps/web/lib/actions/partners/create-bounty-submission.ts, apps/web/lib/api/workflows/execute-complete-bounty-workflow.ts
Write completedAt = new Date() for non-draft submissions and when marking a submission submitted via workflow.
API: submissions count filtered
apps/web/app/(ee)/api/bounties/route.ts
Change submissions count query to count only submissions with status in ["submitted","approved"].
Backfill script
apps/web/scripts/migrations/backfill-submission-completedat.ts
Add migration to populate null completedAt for submissions (using updatedAt) in the ACME program for statuses submitted/approved.
UI: status/date presentation updates
apps/web/app/(ee)/partners.dub.co/.../partner-bounty-card.tsx, apps/web/ui/partners/bounties/claim-bounty-modal.tsx
For submitted state: show Completed for performance bounties and Submitted for others, using submission.completedAt when present; for approved/confirmed state render unified Confirmed with submission.reviewedAt.
UI: table & card sources
apps/web/app/app.dub.co/.../bounty-submissions-table.tsx, apps/web/app/app.dub.co/.../bounties/bounty-card.tsx, apps/web/app/app.dub.co/.../bounty-info.tsx
Swap displayed dates to completedAt where applicable; add BountyEndedBadge when endsAt is past; adjust submission text to use “completed” for performance bounties and “submitted” otherwise.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant UI
  participant API
  participant DB

  User->>UI: Finalize submission (isDraft=false)
  UI->>API: POST /create-bounty-submission { isDraft:false, ... }
  API->>DB: upsert BountySubmission { ..., completedAt: now }
  DB-->>API: saved submission
  API-->>UI: return submission
  UI-->>User: show status/date using completedAt/reviewedAt

  Note over UI,API: Workflow path
  UI->>API: POST /execute-complete-bounty-workflow
  API->>DB: update BountySubmission { status: submitted, completedAt: now }
  DB-->>API: updated
  API-->>UI: ack
  UI-->>User: reflect Completed / Confirmed labels and dates
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • TWilson023

Poem

I hopped through schema, timestamp in paw,
I set "completedAt" — a neat little law. 🥕
Cards now show done, tables keep time,
Reviewers, hop in — the dates align.
A rabbit-approved commit, light and prime.

Pre-merge checks and finishing touches

❌ 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%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly and accurately captures the core change of the pull request, namely adding a completedAt column to submissions, providing clear context without unnecessary detail.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch submission-completedat

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 and usage tips.

@steven-tey
Copy link
Collaborator Author

@coderabbitai full review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 9, 2025

✅ Actions performed

Full review triggered.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1f33912 and 61e51aa.

📒 Files selected for processing (7)
  • apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/bounties/partner-bounty-card.tsx (2 hunks)
  • apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-submissions-table.tsx (1 hunks)
  • apps/web/lib/actions/partners/create-bounty-submission.ts (2 hunks)
  • apps/web/lib/api/workflows/execute-complete-bounty-workflow.ts (1 hunks)
  • apps/web/lib/zod/schemas/bounties.ts (1 hunks)
  • apps/web/ui/partners/bounties/claim-bounty-modal.tsx (1 hunks)
  • packages/prisma/schema/bounty.prisma (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (7)
apps/web/lib/api/workflows/execute-complete-bounty-workflow.ts (1)

173-173: LGTM!

The completedAt timestamp is correctly set when marking the submission as submitted. The early return check (lines 95-101) ensures this only executes once per submission, preventing duplicate timestamp updates.

apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-submissions-table.tsx (1)

205-209: LGTM! This fixes a semantic inconsistency.

The "Completed" column now correctly displays the completion date (completedAt) rather than the commission creation date. This is semantically correct for performance bounties where completion (meeting criteria) precedes approval (commission creation). The null check ensures graceful handling of legacy submissions without completedAt.

apps/web/lib/zod/schemas/bounties.ts (1)

127-127: LGTM!

The schema addition is correct. The nullable type appropriately handles both draft submissions (which don't have a completion date) and legacy submissions (created before this field existed).

apps/web/lib/actions/partners/create-bounty-submission.ts (1)

160-160: LGTM!

The completedAt timestamp is correctly set only for non-draft submissions, ensuring that both the create and update paths capture the finalization moment. This correctly distinguishes between record creation (createdAt) and submission finalization (completedAt).

packages/prisma/schema/bounty.prisma (1)

79-79: LGTM!

The schema addition is correct. The optional DateTime type appropriately handles draft submissions and ensures backward compatibility with existing records, which will have NULL values for this field.

apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/bounties/partner-bounty-card.tsx (1)

149-152: LGTM!

The "Confirmed" label with reviewedAt correctly represents the approval timestamp for the default status path.

apps/web/ui/partners/bounties/claim-bounty-modal.tsx (1)

350-357: LGTM!

The "Confirmed" label with reviewedAt correctly represents the approval timestamp for approved submissions.

@steven-tey
Copy link
Collaborator Author

@coderabbitai full review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 9, 2025

✅ Actions performed

Full review triggered.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 61e51aa and 1353936.

📒 Files selected for processing (6)
  • apps/web/app/(ee)/api/bounties/route.ts (1 hunks)
  • apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/bounties/partner-bounty-card.tsx (2 hunks)
  • apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-info.tsx (2 hunks)
  • apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/bounty-card.tsx (3 hunks)
  • apps/web/scripts/migrations/backfill-submission-completedat.ts (1 hunks)
  • apps/web/ui/partners/bounties/claim-bounty-modal.tsx (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-25T17:39:38.965Z
Learnt from: devkiran
PR: dubinc/dub#2736
File: apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-info.tsx:45-56
Timestamp: 2025-08-25T17:39:38.965Z
Learning: In the bounty system, each partner can only submit to the same bounty once. This means totalSubmissions (pending + approved + rejected) equals the number of unique partners who have submitted, making UI text like "X of Y partners completed" accurate when using totalSubmissions.

Applied to files:

  • apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-info.tsx
  • apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/bounty-card.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
packages/prisma/schema/bounty.prisma (1)

79-79: Consider adding an index on completedAt for query performance.

If you plan to filter or sort submissions by completedAt (e.g., in analytics or reporting queries), consider adding an index to improve performance.

Example:

  completedAt      DateTime?
+ 
+ @@index(completedAt)
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1f33912 and 1353936.

📒 Files selected for processing (11)
  • apps/web/app/(ee)/api/bounties/route.ts (1 hunks)
  • apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/bounties/partner-bounty-card.tsx (2 hunks)
  • apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-info.tsx (2 hunks)
  • apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-submissions-table.tsx (1 hunks)
  • apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/bounty-card.tsx (3 hunks)
  • apps/web/lib/actions/partners/create-bounty-submission.ts (2 hunks)
  • apps/web/lib/api/workflows/execute-complete-bounty-workflow.ts (1 hunks)
  • apps/web/lib/zod/schemas/bounties.ts (1 hunks)
  • apps/web/scripts/migrations/backfill-submission-completedat.ts (1 hunks)
  • apps/web/ui/partners/bounties/claim-bounty-modal.tsx (1 hunks)
  • packages/prisma/schema/bounty.prisma (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-25T17:39:38.965Z
Learnt from: devkiran
PR: dubinc/dub#2736
File: apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-info.tsx:45-56
Timestamp: 2025-08-25T17:39:38.965Z
Learning: In the bounty system, each partner can only submit to the same bounty once. This means totalSubmissions (pending + approved + rejected) equals the number of unique partners who have submitted, making UI text like "X of Y partners completed" accurate when using totalSubmissions.

Applied to files:

  • apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-info.tsx
  • apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/bounty-card.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (14)
apps/web/lib/api/workflows/execute-complete-bounty-workflow.ts (1)

166-178: LGTM!

The addition of completedAt: new Date() when transitioning from draft to submitted status is correct and consistent with the schema changes.

apps/web/lib/actions/partners/create-bounty-submission.ts (2)

149-163: LGTM!

The conditional addition of completedAt for non-draft submissions in the update path is correct.


165-179: LGTM!

The conditional addition of completedAt for non-draft submissions in the create path is correct and consistent with the update path.

apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-info.tsx (2)

24-28: LGTM!

Filtering to only count "submitted" and "approved" submissions aligns with the API changes and provides more accurate counts for completed bounties.


81-82: LGTM!

The type-specific text ("completed" for performance, "submitted" for others) provides clearer messaging to users.

apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/bounty-card.tsx (3)

55-57: LGTM!

The conditional rendering of the ended badge when endsAt is in the past is correct and provides good visual feedback.


111-119: LGTM!

The BountyEndedBadge component is clean and well-positioned. The styling is consistent with the codebase.


101-102: LGTM!

The type-specific text matches the changes in bounty-info.tsx and provides consistent messaging.

apps/web/scripts/migrations/backfill-submission-completedat.ts (1)

6-12: Limit scope to ACME program or adjust filter

The migration currently only targets ACME_PROGRAM_ID. Verify whether submissions in other programs also need backfilling (e.g., query all programIds where status in ["submitted","approved"] and completedAt is null). If they do, remove or parameterize the programId filter; otherwise, document this limitation.

apps/web/app/(ee)/api/bounties/route.ts (1)

76-83: Verify no clients rely on total submissions count
This change filters submissionsCount to only "submitted" and "approved", altering the API response shape. Confirm that no other integrations, SDKs, mobile apps, or webhooks consume this endpoint expecting the previous total‐count behavior.

apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/bounties/[bountyId]/bounty-submissions-table.tsx (1)

199-213: completedAt is set for all completed submissions
create-bounty-submission (non-draft), execute-complete-bounty-workflow, and backfill migration assign completedAt.

apps/web/lib/zod/schemas/bounties.ts (1)

127-127: LGTM!

The completedAt field is correctly added to the schema with an appropriate nullable date type, consistent with other timestamp fields like reviewedAt.

apps/web/ui/partners/bounties/claim-bounty-modal.tsx (1)

339-355: LGTM! Past review comment addressed.

The status badge rendering now correctly uses completedAt for submitted bounties and reviewedAt for approved bounties, resolving the previous issue where createdAt was incorrectly used. The conditional rendering appropriately handles nullable dates.

apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/bounties/partner-bounty-card.tsx (1)

122-141: LGTM! Past review comment addressed.

The status badge rendering now correctly uses completedAt for submitted bounties (lines 123-124) and reviewedAt for approved bounties (lines 140-141), resolving the previous issue where createdAt was incorrectly used. The implementation is consistent with the claim-bounty-modal.tsx file.

@steven-tey steven-tey merged commit d81962c into main Oct 9, 2025
8 checks passed
@steven-tey steven-tey deleted the submission-completedat branch October 9, 2025 19:59
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.

2 participants