-
Notifications
You must be signed in to change notification settings - Fork 1
DR-5507 Delete workflow added #69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughIntroduces a new Cloudflare Workers scheduled workflow to delete stale Prisma projects. A DeleteStaleProjectsWorkflow class fetches projects via API, filters those older than 24 hours, and deletes them. Integration updates the main worker to register the workflow and apply a daily cron schedule. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Pre-merge checks❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
Comment |
|
✅ Preview CLIs & Workers are live! Test the CLIs locally under tag npx create-db@pr69
npx create-pg@pr69
npx create-postgres@pr69Worker URLs
|
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
claim-db-worker | b3e9ce8 | Commit Preview URL Branch Preview URL |
Dec 13 2025, 07:50 PM |
There was a problem hiding this 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
🧹 Nitpick comments (2)
create-db-worker/src/delete-stale-workflow.ts (2)
42-42: Consider wrapping JSON.parse in try/catch for better error messages.If the API returns malformed JSON, this will throw a generic parsing error. Wrapping it provides clearer diagnostics.
- const projects: ProjectsResponse = JSON.parse(res); + let projects: ProjectsResponse; + try { + projects = JSON.parse(res); + } catch (e) { + throw new Error(`Failed to parse projects response: ${e}`); + }
46-49: InvalidcreatedAtvalues will silently skip projects.If
createdAtis malformed,getTime()returnsNaNand the comparison fails, excluding the project. This is safe but might mask data issues.const staleProjects = projects.data.filter((project) => { const createdAt = new Date(project.createdAt).getTime(); + if (isNaN(createdAt)) { + console.warn(`Project ${project.id} has invalid createdAt: ${project.createdAt}`); + return false; + } return now - createdAt > twentyFourHours; });
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
create-db-worker/src/delete-stale-workflow.ts(1 hunks)create-db-worker/src/index.ts(2 hunks)create-db-worker/wrangler.jsonc(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
create-db-worker/src/index.ts (3)
claim-db-worker/lib/env.ts (1)
Env(1-9)claim-db-worker/worker-configuration.d.ts (1)
env(6913-6913)create-db-worker/worker-configuration.d.ts (1)
env(6794-6794)
⏰ 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). (2)
- GitHub Check: Workers Builds: claim-db-worker
- GitHub Check: Workers Builds: create-db-worker
🔇 Additional comments (6)
create-db-worker/src/delete-stale-workflow.ts (1)
53-69: LGTM!Each deletion is correctly wrapped in its own workflow step with a unique name, ensuring idempotency on retries. Sequential execution is appropriate for this use case.
create-db-worker/wrangler.jsonc (1)
17-25: LGTM!The workflow binding and cron trigger are correctly configured. Daily execution at midnight UTC is appropriate for stale project cleanup.
create-db-worker/src/index.ts (4)
2-2: LGTM!Import correctly references the new workflow module.
7-7: LGTM!The
Workflowtype binding is correctly added to theEnvinterface, matching the wrangler.jsonc configuration.
14-14: LGTM!Both workflow classes are correctly exported for Cloudflare to discover them.
199-202: LGTM!The scheduled handler correctly logs the cron expression and uses
ctx.waitUntilto create the workflow instance without blocking. The empty params object matches the workflow'sParamstype.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.