From 116a162aaf396ad79e5e3d8cf00005072dda00b3 Mon Sep 17 00:00:00 2001 From: eust-w Date: Wed, 23 Sep 2026 02:25:56 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=20Remove=20per-target=20re-validation?= =?UTF-8?q?=20redundancy=20in=20BOS=20deletion=20execution?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- internal/api/project_deletion.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/internal/api/project_deletion.go b/internal/api/project_deletion.go index 094e1d68..e31033cc 100644 --- a/internal/api/project_deletion.go +++ b/internal/api/project_deletion.go @@ -452,9 +452,14 @@ func (s *server) deleteProjectTarget(ctx context.Context, plan domain.ProjectDel } return nil case "bos": - if err := s.validateDeletionReferences(ctx, plan); err != nil { - return err - } + // validateDeletionReferences is already re-run once by + // executeProjectDeletion immediately before it starts processing + // non-runtime targets (the runtimeDone gate) — that is the right + // point to catch a run created between plan-build and execution + // referencing this path. Re-running the whole org-wide validation + // again here, per bos target, made a project with a few thousand + // BOS targets take hours (each call re-fetches and re-scans every + // other run in the organization). browser, conn, cleanup, err := s.resolveObjectStorageBrowser(ctx, t.ConnectionID) if err != nil { return err -- 2.47.2