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
Add dataset deletion with two-tier admin permissions #35
Following the accidental deletion of datasets nm000103-nm000107 (now restored), we MUST implement backend fail-safes to prevent deletion of critical datasets.
Fail-Safe Requirements
1. Prevent Deletion of Datasets with DOIs
Datasets with concept DOIs or version DOIs are preserved on Zenodo and MUST NOT be deletable:
// backend/src/routes/datasets.ts - DELETE endpointif(dataset.concept_doi||dataset.latest_version_doi){thrownewError(`Cannot delete dataset ${dataset.dataset_id}: has DOI(s). `+`Datasets with DOIs are preserved on Zenodo and cannot be deleted. `+`Contact owner ([email protected]) if deletion is absolutely necessary.`);}
2. Prevent Deletion of Public/Published Datasets
if(dataset.status==='published'||dataset.visibility==='public'){thrownewError(`Cannot delete published/public dataset ${dataset.dataset_id}. `+`Published datasets must remain available. `+`Contact owner ([email protected]) if deletion is absolutely necessary.`);}
3. Two-Tier Admin Permissions
Tier 1 (nemarAdmin): Can delete own datasets
Tier 2 (Owner): Can delete ANY dataset
if(dataset.owner_user_id \!==requesting_user_id){if(\!requesting_user_is_owner){thrownewError(`Cannot delete dataset ${dataset.dataset_id}: `+`Only the owner can delete datasets created by other users.`);}}
4. Require Explicit Confirmation
if(\!request.body.confirm_deletion||request.body.confirmation_text \!==dataset.dataset_id){thrownewError(`Deletion requires explicit confirmation. `+`Set confirm_deletion=true and confirmation_text='${dataset.dataset_id}'`);}
describe('Dataset Deletion Fail-Safes',()=>{it('should prevent deletion of datasets with concept DOI',async()=>{// Test that deletion throws error});it('should prevent deletion of published datasets',async()=>{// Test that deletion throws error});it('should prevent non-owner from deleting others datasets',async()=>{// Test permission error});it('should require explicit confirmation',async()=>{// Test that missing confirmation fails});it('should log all deletion attempts',async()=>{// Test audit log entry created});});
Implementation Priority
Priority: P0 (Critical) - Implement ASAP
These fail-safes would have prevented the accidental deletion on 2026-01-18.
Activity
neuromechanist commentedon Jan 19, 2026
Backend Fail-Safes Required (CRITICAL)
Following the accidental deletion of datasets nm000103-nm000107 (now restored), we MUST implement backend fail-safes to prevent deletion of critical datasets.
Fail-Safe Requirements
1. Prevent Deletion of Datasets with DOIs
Datasets with concept DOIs or version DOIs are preserved on Zenodo and MUST NOT be deletable:
2. Prevent Deletion of Public/Published Datasets
3. Two-Tier Admin Permissions
4. Require Explicit Confirmation
5. Audit Logging
CLI Fail-Safes
Also update
src/commands/dataset.tsto:Test Cases
Implementation Priority
Priority: P0 (Critical) - Implement ASAP
These fail-safes would have prevented the accidental deletion on 2026-01-18.
See also:
Add disaster recovery procedures and documentation
neuromechanist commentedon Feb 12, 2026
Superseded by #128. Full deletion system implemented with two-tier permissions (owner-only for published datasets, admin for unpublished).