From 63a4bb77bb71f55abae5af1ecbfa688f1ea58880 Mon Sep 17 00:00:00 2001 From: Matthew Meszaros Date: Thu, 12 Nov 2026 17:54:34 +0100 Subject: [PATCH] feat: keep a mailbox removal pass's matched, remaining, removed, dry_run and per-mailbox error fields in warmblyctl's redacted admin output so an operator can see failures and when to stop --- cmd/warmblyctl/remote_output.go | 1 + cmd/warmblyctl/remote_test.go | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/cmd/warmblyctl/remote_output.go b/cmd/warmblyctl/remote_output.go index b0a8e30fe..ff0c473f0 100644 --- a/cmd/warmblyctl/remote_output.go +++ b/cmd/warmblyctl/remote_output.go @@ -24,6 +24,7 @@ func remoteWordSet(words string) map[string]bool { // Unknown fields and free text fail closed, including newly added backend fields. var remoteOutputFields = remoteWordSet(` data pagination summary permissions user organization workers nodes mailboxes +matched remaining removed dry_run error commands results metrics broker partitions topics consumer_group topic events capture generic_error_coverage generic_error_reason sources counts health totals failing_endpoints jobs plans discounts members roles diff --git a/cmd/warmblyctl/remote_test.go b/cmd/warmblyctl/remote_test.go index 1f5bb6107..8160b2226 100644 --- a/cmd/warmblyctl/remote_test.go +++ b/cmd/warmblyctl/remote_test.go @@ -792,3 +792,23 @@ func TestRemoteCatalogMatchesActualAdminRoutesAndGuards(t *testing.T) { } } } + +func TestRemoteOutputKeepsMailboxRemovalProgress(t *testing.T) { + id := "6f1c2d3e-4b5a-4c6d-8e7f-0a1b2c3d4e5f" + out := redactRemoteJSON("", map[string]any{ + "dry_run": false, "matched": float64(3), "removed": float64(1), "failed": float64(1), "remaining": float64(2), + "mailboxes": []any{map[string]any{"id": id, "email": "a@example.com", "removed": false, "error": "provider said no"}}, + }).(map[string]any) + for _, k := range []string{"dry_run", "matched", "removed", "failed", "remaining"} { + if _, ok := out[k]; !ok { + t.Fatalf("%s dropped from %v", k, out) + } + } + row := out["mailboxes"].([]any)[0].(map[string]any) + if row["id"] != id || row["removed"] != false || row["error"] != "[REDACTED]" { + t.Fatalf("mailbox row = %v", row) + } + if v, ok := row["email"]; ok && v != "[REDACTED]" { + t.Fatalf("address leaked: %v", row) + } +}