You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Accept per-type row limits on the existing log and soft-delete cleanup endpoints, returning HTTP 202 and one queued job ID.
Pass a shared remaining budget through the existing cleanup selectors so limits apply across every workspace and organization chunk. Omitted types are skipped.
Serialize retention jobs, disable automatic task retries, and use smaller owner-discovery pages for manual runs. Fail manual jobs on owner subscription lookup errors. Preserve existing retention rules, billing, storage, and child cleanup behavior.
Type of Change
New feature
Testing
107 focused contract, route, dispatch, worker, and cleanup-helper tests passed.
Lint, all 46 audits, block registry, docs manifest, and app/auth type checks passed.
The PR appears safe to merge; no actionable new defects or outstanding previous findings remain.
Summary
This PR adds authenticated, per-type row limits to the existing log and soft-delete cleanup endpoints while retaining the existing behavior for parameterless scheduled calls.
Queues each bounded request as one serialized Trigger.dev job with automatic retries disabled.
Shares mutable row budgets across workspace and organization scopes, counting selected roots before destructive side effects.
Extends cleanup helpers for bounded log, metadata, snapshot, file, knowledge-base, and other soft-delete cleanup.
Adds route, contract, dispatcher, worker, and helper coverage plus operational documentation.
Diagram
sequenceDiagram
participant Cron as Maintenance caller
participant API as Cleanup API
participant Trigger as Trigger.dev
participant Worker as Cleanup worker
participant Owners as Owner discovery
participant Cleanup as Existing cleanup helpers
Cron->>API: GET with per-type limits
API->>API: Authenticate and validate limits
API->>Trigger: Queue one bounded job
API-->>Cron: 202 + runId + limits
Trigger->>Worker: Run serialized job
Worker->>Worker: Create shared row budgets
loop Until every budget is exhausted or owners end
Worker->>Owners: Read next owner page
Owners-->>Worker: Retention scopes
Worker->>Cleanup: Run scope with shared budgets
Cleanup->>Cleanup: Select roots and consume budgets
Cleanup-->>Worker: Cleanup result
end
Fixed the owner-lookup finding in 8e834e3. Manual cleanup now propagates personal, organization-workspace, and organization subscription lookup errors instead of reporting success after skipping those owners. Added regression coverage for all three paths; existing scheduled dispatch behavior is preserved.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Type of Change
Testing
Checklist