Confirmed permanent Package deletion with scoped file cleanup
Project owners and admins can explicitly delete one Package from the detail page. The action removes the Package, sources, drafts, processing history, summaries, handoff snapshots, and the Package's private original and artifact files. It is admin-only, requires confirmation, blocks active uploads/processing or unresolved dependencies, preserves minimal audit records, and returns 410 Gone for deleted machine snapshots.
The feature appears only for active OWNER or ADMIN users in the relevant project. After opening a Package, they can expand a Delete Package section, tick a mandatory confirmation field, and submit the request through the existing CSRF-protected browser action. The system checks project permission again under a dedicated database transaction before touching storage. If allowed, it removes the scoped Package rows: sources, drafts, originals metadata, processing runs/attempts/results/artifacts/provenance, source/package summaries, handoff publications and snapshot data. It also removes private object-storage objects below originals/{projectId}/{packageId}/ and artifacts/{projectId}/{packageId}/, including orphan files of that Package. File cleanup is available when private object storage is configured; ordinary filesystem cleanup or bucket-wide deletion is not offered. Missing storage objects or bucket are treated as already clean, which lets deletion succeed when some files were previously removed manually. Other storage errors stop the operation, keep the database evidence, and show retry guidance because a partial file cleanup may have occurred. Active uploads, processing/work items, ingestion, or surviving corrections/references are rejected before any binary file is deleted. Normal immutability protections remain active for unrelated content. The upgrade adds audit and tombstone support without deleting existing rows. Minimal deletion audit stores Package ID, project ID, actor ID, and time; deleted machine snapshot identities are preserved so reads in the same project respond with 410 Gone. No automatic or background deletion is triggered. Successful deletion returns to the Package list with a success notice; failure remains on the Package page with an explanation.