⚡ Remove per-target re-validation redundancy in BOS deletion execution #13
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix/project-deletion-redundant-bos-revalidation"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Follow-up to #11/#12, caught live while SL-data's actual deletion was executing on Fanyu. deleteProjectTarget's "bos" case re-ran the entire validateDeletionReferences org-wide check for every single BOS target — with ~2,600 BOS targets, that meant repeating an ~10s (Mongo I/O bound) check up to 2,600 times during execution, observed at ~1.5 items/minute (would have taken ~29 hours). executeProjectDeletion already validates once, right before it starts processing non-runtime targets — that's the correct point to catch a race (a new run created between plan-build and execution). Removed the redundant per-target call; the only other caller passes an empty plan so it was already a no-op there.
Tests: go build ./..., go test ./internal/api/... ./internal/store/... (all deletion tests pass, 75 pre-existing unrelated failures unchanged).
🤖 Generated with Claude Code
deleteProjectTarget's "bos" case called validateDeletionReferences again for every single BOS target — with SL-data's ~2,600 BOS targets, that meant re-running the (already expensive, now individually fast but still ~10s including Mongo I/O) org-wide reference check up to 2,600 times during actual deletion execution, not just once during preview. Caught live: SL-data's real deletion run was in the BOS cleanup phase at ~1.5 items/minute, which would have taken roughly 29 hours to finish. executeProjectDeletion already re-runs validateDeletionReferences once, right before it starts processing non-runtime targets (the runtimeDone gate at line ~724) — that is the correct point to catch a run created between plan-build and execution referencing a path about to be deleted. Repeating it per-target adds no additional safety, since nothing about processing one BOS target changes what other runs reference within the same execution pass. The only other caller (supplier_deletion.go:442) passes an empty ProjectDeletionPlan{}, so the removed call was already a no-op there. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>