Project deletion efficiency
On 2026-10-26, the production revision bdec59ec sent project nodes through
the generic subtree hard delete. Four attempts to delete one project expired
the default five-second interactive transaction with Prisma P2028.
Read-only inventory found 543 nodes and 487 distinct stored object keys. The
deployed code enqueued each key separately before deleting the related rows.
These observations establish the expired transaction; they do not provide
per-query production timings.
The unified project soft delete in 809f56a1 removes this work from project
deletion altogether. Both delete entry points retain files and stored objects,
revoke grants, remove filings and move the retained paths under the project
tombstone. No file cleanup tasks are queued. Authorization, active-computation
checks, reference validation and slug isolation remain in one transaction.
This change was absent from that production revision; source availability is
not evidence of a deployed fix.
Folders and episodes still require a hard delete. Their object cleanup must
be recorded atomically with removal of the last database handles, then drained
by the existing worker after commit. The implementation batches deduplicated
(bucket, objectKey) targets in groups of at most 100 rather than issuing two
Prisma operations for every object. Every existing task is still written so
a concurrent worker claim causes a transaction conflict. Enqueue preserves
claim tokens, retry counts and leases, marks existing tasks for reinspection,
and returns retained tasks to the queue. Any failed or incomplete batch aborts
the entire transaction. No S3 deletion occurs in the request transaction.
Exhausted write-conflict retries on a hard delete answer 409 rather than
being masked as 500; timeouts and other faults are not retried as conflicts.
Validation uses disposable local MongoDB fixtures: the incident-sized project, hard deletion with hundreds of file keys, duplicate targets, worker claims, rollback and slug reuse. Local timings and controlled latency experiments are implementation evidence; production acceptance must be checked separately.
The workspace's generated API reference records the hard-delete conflict response. No distributed public skill change: the Memos, CLI and scene bundles do not consume this workspace API page, and their command shapes, action guides and task procedures are unchanged. The batching implementation is internal.