⚡ Remove per-target re-validation redundancy in BOS deletion execution #13

Merged
longtao.wu merged 1 commits from fix/project-deletion-redundant-bos-revalidation into dev 2026-09-23 02:26:14 +08:00
Owner

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

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](https://claude.com/claude-code)
longtao.wu added 1 commit 2026-09-23 02:26:09 +08:00
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>
longtao.wu merged commit 4e4c1b02d2 into dev 2026-09-23 02:26:14 +08:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: longtao.wu/droboticflow#13
No description provided.