Repository navigation
Add dataset deletion cascade and scheduled cleanup (#120) - #131
Closed
neuromechanist wants to merge 3 commits into
Closed
neuromechanist wants to merge 3 commits into
neuromechanist wants to merge 3 commits into
Conversation
- DELETE /admin/datasets/:id backend route with permission checks - Published datasets (with DOI): owner-only, requires force=true - Unpublished datasets: admin or owner - Blocks deletion if active publication requests exist - Shared deletion service (backend/src/services/deletion.ts) - Cascade: GitHub repo, S3 objects, D1 records - Partial failure tracking with step-by-step results - CLI command: nemar admin delete-dataset <id> [--force] - Confirmation prompt, DOI warning, deletion summary - Scheduled cleanup cron (daily 3 AM UTC) - Sandbox (xx) datasets: auto-delete after 14 days - Stale nm datasets: delete if unpublished, no DOI, 90 days inactive - Migration 0011: add last_activity_at column to datasets - Integration tests for deletion endpoint Closes #120
📦 Package PreviewYour package is ready to test! bun install -g nemar-cli@PR131Version: 🤖 Updated on each push. |
- Backfill last_activity_at in migration (prevents cron deleting old datasets) - Use db.batch() for atomic D1 deletion (prevents partial orphans) - Remove dead skipS3 option from admin route - Add MAX_DELETIONS_PER_RUN limit (10) to cron handler
- deleted field now reflects all step outcomes (GitHub, S3, D1) - Wrap cron DB queries in independent try-catch blocks - Wrap cron and admin audit log writes in try-catch - CLI uses spinner.warn when deletion has warnings - Always log cron summary even when zero datasets found
Contributor
Author
|
Squash-merged manually to epic branch feature/issue-128-epic-deletion |
neuromechanist
added a commit
that referenced
this pull request
Feb 12, 2026
Phase 3 of epic #128: wires S3 and GitHub deletion into a full cascade. - Add shared deleteDatasetCascade service (GitHub, S3, D1 batch delete) - Add DELETE /admin/datasets/:id with DOI/owner permission checks - Add admin delete-dataset CLI command with confirmation prompt - Add scheduled cron cleanup (sandbox 14d, stale nm 90d) - Add last_activity_at migration with backfill - Harden error handling: all steps reflected in deleted field, independent try-catch for cron queries and audit log writes
This was referenced Feb 12, 2026
This branch was previously deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Phase 3 of deletion epic (#128). Builds on Phase 1 (S3 deletion, #129) and Phase 2 (GitHub deletion, #130) to provide full cascade deletion.
DELETE /admin/datasets/:idbackend route with role-based permission checksnemar admin delete-dataset <id>CLI command with confirmation and summarydeleteDatasetCascadeservice for reuse by cron and admin routelast_activity_atcolumn for staleness detectionPermission model
force=trueCascade steps
Scheduled cleanup
xx) datasets: auto-delete after 14 daysnmdatasets: unpublished, no DOI, 90 days inactiveTest plan
Closes #120