fix(data delete): resolve the table name case-insensitively; fail closed (#1027)#230
Open
LukasWodka wants to merge 1 commit into
Open
fix(data delete): resolve the table name case-insensitively; fail closed (#1027)#230LukasWodka wants to merge 1 commit into
LukasWodka wants to merge 1 commit into
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
resolveDeleteTarget— lists the client's datasets (samelistDatasetsFnseamdata ingestuses) and matchesstrings.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).PlanTeardown,PodSpecOptions.Table, the confirmation prompt, and error messages — never the raw flag.--dry-runreflects the resolution (real name, or a not-found stop).Test
New
data_delete_test.gomirrors 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 /--yesuntouched.go build/test/vet/gofmtclean.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 deletecould exit 0 without deleting anything when the user’s table name didn’t match the cluster’s case-sensitive spelling.data deletenow lists datasets on the client (samelistDatasetsFn/EqualFoldbehavior asdata 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.gocovering 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.