More precise package deletion: fixed cleanup order and clearer blocked-deletion reasons
Fixed deletion of terminal failed media packages that could remain undeletable because of the internal cleanup order. When a package truly cannot be deleted, the system now shows the real blocking items instead of a generic busy message.
When deleting package objects in the pipeline, some completed and failed package objects could remain undeletable because internal cleanup did not remove related work records in the correct order. This update fixes that internal deletion order so related processing records are removed safely and the package state is handled more accurately. Deletion diagnostics were also improved. Before removing files, the system now checks for real blockers. If the package is genuinely busy, the response includes a short list of the significant blocking items: type, identifier, associated source, and status. To keep the message useful, up to six main blockers are shown. If the database preflight check fails with an unexpected error, the system now gives a precise outcome: it reports that the deletion check failed and that storage files were not removed. The response includes a safe diagnostic code for support, while avoiding raw SQL, request internals, or sensitive details. What this means for users: terminal failed packages are easier to clean up, and deletion blocks are more explainable. The system no longer mixes active processing with ordinary data dependencies, helping users understand what should be completed or removed before deleting a package.