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
{{ message }}
Repository navigation
Stale-nm cleanup cron silently hard-deletes real datasets #662
The daily Cloudflare Workers cron (scheduledCleanup in backend/src/index.ts, crons = ["0 3 * * *"]) hard-deleted three real datasets on 2026-05-27 03:00 UTC with no human involvement and no owner warning:
nm000111 (ISRUC-Sleep, 126 files, owner user 16)
nm000116 (SEED-V, 144 files)
nm000117 (SEED-VIG, 23 files)
They matched the stale-nm rule (private + no concept DOI + no active pub request + inactive 90 days). The cron calls the same total cascade as a manual admin delete (deleteDatasetCascade: GitHub repo + S3 + D1), so all three layers were wiped. Recoverable only because the S3 bucket has versioning enabled (delete markers, not purged versions). 103 more private/no-DOI nm datasets are exposed to the same fate as they age past 90 days.
Root cause
A cron should never silently and permanently delete real archive (nm) datasets. The 90-day private+no-DOI heuristic matches legitimate datasets awaiting publication. last_activity_at is also not reliably bumped, so the effective age is just created_at.
Fix
Replace silent nm auto-deletion with a warning runway + human gate:
Email the owner escalating warnings at 30 / 14 / 7 / 2 / 1 days before the 90-day mark (once per threshold, tracked in D1 so the daily cron does not re-spam).
Copy admins on the final-stage notice.
At day 0, the cron does NOT delete; it emails admins a 'ready to delete, confirm manually' notice. nm deletion becomes a deliberate admin action only.
Sandbox xx 14-day auto-deletion is unchanged (disposable).
Reset tracking when a dataset gets fresh activity.
Recovery
S3 objects undeleted for nm000111/116/117 (delete markers removed)
Restore GitHub repos (org settings, within 90-day window)
S3 objects undeleted for nm000111/116/117 (delete markers removed; 891/490/47 objects restored from retained versions)
GitHub repos restored via org settings (within 90-day window)
D1 rows + owner S3 permissions re-registered; recovery written to audit_log (action=dataset_recovered)
Owner is user 16 (PierreGtch / [email protected]). Datasets are back as active/private with last_activity_at reset.
Follow-up: run nemar admin reindex nm000111 nm000116 nm000117 to repopulate enrichment + metadata columns (subject_count/modalities/file_size are currently NULL) so the ww2.nemar.org detail pages render fully. Fix for the root cause is in #663.
Fix merged to dev via #663 (squash ea53cc5, admin-override — the only red check was a pre-existing, unrelated dev-env failure: nm099999 had been deleted from the dev backend, failing test/iam-removal.test.ts; not touched by this PR).
Remaining to reach prod (where the cron actually runs): a routine dev -> main PR per the release flow. Until then the prod cron is unchanged, but 0 datasets are at risk before then (verified). Leaving this issue open until the fix lands on main.
Follow-up infra (separate): restore the nm099999 + test-user collaborator fixture on dev so unit-test-all is green again; investigate what deletes nm099999 on dev.
Activity
neuromechanist commentedon May 30, 2026
Recovery complete (all three layers):
Owner is user 16 (PierreGtch / [email protected]). Datasets are back as active/private with last_activity_at reset.
Follow-up: run
nemar admin reindex nm000111 nm000116 nm000117to repopulate enrichment + metadata columns (subject_count/modalities/file_size are currently NULL) so the ww2.nemar.org detail pages render fully. Fix for the root cause is in #663.review(#662): gate staleness state on actual email delivery
fix(cron): warn owners before stale-nm deletion, never auto-delete (#662
neuromechanist commentedon May 30, 2026
Fix merged to dev via #663 (squash ea53cc5, admin-override — the only red check was a pre-existing, unrelated dev-env failure: nm099999 had been deleted from the dev backend, failing test/iam-removal.test.ts; not touched by this PR).
Remaining to reach prod (where the cron actually runs): a routine dev -> main PR per the release flow. Until then the prod cron is unchanged, but 0 datasets are at risk before then (verified). Leaving this issue open until the fix lands on main.
Follow-up infra (separate): restore the nm099999 + test-user collaborator fixture on dev so unit-test-all is green again; investigate what deletes nm099999 on dev.
docs: choose public data with a private repository
Analyze pseudonymous deposit for double-blind review (#1400)