fix(retention): switch data retention to be org-level#4270
fix(retention): switch data retention to be org-level#4270TheodoreSpeaks merged 8 commits intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
@BugBot review |
PR SummaryMedium Risk Overview Adds a new org-scoped API at Updates cleanup job dispatching to resolve enterprise retention from the owning organization’s settings, and fixes log cleanup to also purge Reviewed by Cursor Bugbot for commit 39bb125. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
@BugBot review |
|
@BugBot review |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 78151ad. Configure here.
…n-storage # Conflicts: # apps/sim/app/api/workspaces/[id]/data-retention/route.ts
Greptile SummaryThis PR moves data retention configuration from the workspace level to the organization level, replacing three integer columns on
Confidence Score: 4/5Safe to merge after confirming no production enterprise workspaces have existing per-workspace retention values configured, or after adding a data migration step. One P1 concern: the migration irreversibly drops three workspace retention columns without migrating existing data. If any enterprise workspace has these set in production, those settings are permanently lost. The rest of the PR is well-structured with correct auth checks, proper cache invalidation, and a clean bug fix for job execution log cleanup. packages/db/migrations/0196_retention_org_level.sql — needs a data migration step before the DROP COLUMN statements. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[dispatchCleanupJobs] --> B{Plan type?}
B -->|free/pro/team| C[resolveWorkspaceIdsForPlan]
B -->|enterprise| D[Query workspaces\nINNER JOIN organization\nINNER JOIN subscription\nWHERE org.dataRetentionSettings->>key IS NOT NULL]
C --> E[Enqueue cleanup job\nplan payload]
D --> F[Enqueue cleanup job\nworkspaceId payload]
E --> G[resolveCleanupScope]
F --> G
G -->|plan payload| H[Use CLEANUP_CONFIG defaults]
G -->|enterprise payload| I[JOIN workspace → organization\nRead settings->>key]
H --> J[runCleanupLogs]
I --> J
J --> K[cleanupTier\nworkflow_execution_logs]
J --> L[cleanupJobExecutionLogsTier\njob_execution_logs]
Reviews (1): Last reviewed commit: "Merge remote-tracking branch 'origin/sta..." | Re-trigger Greptile |

Summary
Switched data retention setting to be org level. This allows for easier organizational management, since we don't expect users to want this per workspace.
Also fixed bug where mothership ran workflow logs weren't being cleaned up
Type of Change
Testing
Checklist
Screenshots/Videos