FEAT: Dynamic bounty start date - #4187
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThis PR adds absolute and enrollment-relative bounty timing, centralizes partner eligibility and effective-period calculations, and updates bounty APIs, cron workflows, submission flows, dashboard/embed interfaces, Slack output, webhooks, and tests. ChangesBounty timing and eligibility
Estimated code review effort: 5 (Critical) | ~90 minutes 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/tests/bounties/index.test.ts`:
- Around line 624-638: Move the onTestFinished cleanup registration to
immediately after the successful bounty creation POST, before the PATCH request
and assertions; keep it targeting the created bounty’s id so cleanup runs even
when later test steps fail.
🪄 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: 9483f6a8-0918-4c4d-8b93-f3d489d98c3b
📒 Files selected for processing (1)
apps/web/tests/bounties/index.test.ts
| const { status: patchStatus, data: updated } = await http.patch<Bounty>({ | ||
| path: `/bounties/${bounty.id}`, | ||
| body: { endsAfterDays: 180 }, | ||
| }); | ||
|
|
||
| expect(patchStatus).toEqual(200); | ||
| expect(updated).toMatchObject({ | ||
| startMode: BountyStartMode.relative, | ||
| startsAt: null, | ||
| endsAfterDays: 180, | ||
| }); | ||
|
|
||
| onTestFinished(async () => { | ||
| await h.deleteBounty(bounty.id); | ||
| }); |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
Register cleanup immediately after creation.
If the PATCH call or either assertion fails, onTestFinished is never registered and the created bounty remains in the E2E environment. Register it directly after the successful POST.
Proposed fix
expect(bounty).toMatchObject({
startMode: BountyStartMode.relative,
startsAt: null,
endsAt: null,
endsAfterDays: 30,
});
+ onTestFinished(async () => {
+ await h.deleteBounty(bounty.id);
+ });
+
const { status: patchStatus, data: updated } = await http.patch<Bounty>({
path: `/bounties/${bounty.id}`,
body: { endsAfterDays: 180 },
});
-
- onTestFinished(async () => {
- await h.deleteBounty(bounty.id);
- });📝 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.
| const { status: patchStatus, data: updated } = await http.patch<Bounty>({ | |
| path: `/bounties/${bounty.id}`, | |
| body: { endsAfterDays: 180 }, | |
| }); | |
| expect(patchStatus).toEqual(200); | |
| expect(updated).toMatchObject({ | |
| startMode: BountyStartMode.relative, | |
| startsAt: null, | |
| endsAfterDays: 180, | |
| }); | |
| onTestFinished(async () => { | |
| await h.deleteBounty(bounty.id); | |
| }); | |
| const { status: patchStatus, data: updated } = await http.patch<Bounty>({ | |
| path: `/bounties/${bounty.id}`, | |
| body: { endsAfterDays: 180 }, | |
| }); | |
| expect(patchStatus).toEqual(200); | |
| expect(updated).toMatchObject({ | |
| startMode: BountyStartMode.relative, | |
| startsAt: null, | |
| endsAfterDays: 180, | |
| }); | |
| onTestFinished(async () => { | |
| await h.deleteBounty(bounty.id); | |
| }); |
🤖 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/tests/bounties/index.test.ts` around lines 624 - 638, Move the
onTestFinished cleanup registration to immediately after the successful bounty
creation POST, before the PATCH request and assertions; keep it targeting the
created bounty’s id so cleanup runs even when later test steps fail.
Summary by CodeRabbit