Skip to content

fix(data delete): resolve the table name case-insensitively; fail closed (#1027)#230

Open
LukasWodka wants to merge 1 commit into
developfrom
fix/1027-data-delete-case-resolve
Open

fix(data delete): resolve the table name case-insensitively; fail closed (#1027)#230
LukasWodka wants to merge 1 commit into
developfrom
fix/1027-data-delete-case-resolve

Conversation

@LukasWodka

@LukasWodka LukasWodka commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

What

tracebloc data delete <name> resolved the table name case-sensitively, so a mis-cased name was a silent no-op (exit 0, nothing deleted) — backend#1027.

Fix

  • New resolveDeleteTarget — lists the client's datasets (same listDatasetsFn seam data ingest uses) and matches strings.EqualFold, returning the stored spelling. Fails closed (unlike ingest's guard, which fails open because the in-cluster duplicate check backstops it — a destructive delete has no backstop).
  • On match: the real spelling flows into PlanTeardown, PodSpecOptions.Table, the confirmation prompt, and error messages — never the raw flag.
  • On no match: exit 5 with the request + a hint listing the datasets that do exist (or "no ingested datasets"). Never a silent exit-0 no-op.
  • Listing failure → fail closed (exit 4, "refusing to delete" + the underlying error).
  • --dry-run reflects the resolution (real name, or a not-found stop).

Test

New data_delete_test.go mirrors the ingest guard tests: mis-cased resolves + tears down the real name; nonexistent → exit 5 + available names; empty client → exit 5; listing error → exit 4 fail-closed. Confirmation / --yes untouched. go build/test/vet/gofmt clean.

Refs backend#1008.

🤖 Generated with Claude Code


Note

Medium Risk
Changes destructive delete targeting and exit semantics; behavior is safer (confirmed targets, no silent no-ops) but operators/scripts must handle new exit code 5 and stricter exit 4 when listing fails.

Overview
Fixes backend#1027, where tracebloc data delete could exit 0 without deleting anything when the user’s table name didn’t match the cluster’s case-sensitive spelling.

data delete now lists datasets on the client (same listDatasetsFn / EqualFold behavior as data ingest’s destination guard), resolves the stored spelling, and uses that name for the teardown plan, confirmation prompt, and teardown execution—not the raw CLI argument.

Fail-closed behavior for a destructive command: if the dataset list can’t be read → exit 4 (refuse to delete blind); if no name matches → exit 5 with a hint of datasets that do exist (or that the client has none). Command help documents the new exit 5.

Adds data_delete_test.go covering mis-cased resolution, exact match, not-found, empty client, and listing failure.

Reviewed by Cursor Bugbot for commit b86e1b2. Bugbot is set up for automated code reviews on this repo. Configure here.

…sed (#1027)

A mis-cased name was a silent no-op. Resolve via listDatasetsFn + EqualFold to the stored spelling (fed into teardown), exit 5 not-found, exit 4 on listing failure. Refs #1008.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant