Skip to content

fix(data): deprecation notices on renamed aliases + clear no-client message (#879)#229

Open
LukasWodka wants to merge 1 commit into
developfrom
fix/879-data-deprecation-and-no-client-msg
Open

fix(data): deprecation notices on renamed aliases + clear no-client message (#879)#229
LukasWodka wants to merge 1 commit into
developfrom
fix/879-data-deprecation-and-no-client-msg

Conversation

@LukasWodka

@LukasWodka LukasWodka commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

What

The two remaining acceptance items for the RFC-0001 data-verb rename (backend#879). The rename (datasetdata, pushingest, rmdelete + aliases) and active-client binding already shipped via cli#128 — this closes the gap.

1 — Deprecation notices on the renamed aliases

data's PersistentPreRunE warns once on stderr when a command is invoked via a deprecated alias:

  • pushuse data ingest · rmuse data delete · bare datasetuse data

Detection reads cobra's exported Command.CalledAs() on the executed command (no reflection into cobra internals). The verb notices point at the full canonical form, so they nudge the group rename too. The already-migrated dataset <canonical-verb> case (e.g. dataset ingest) is intentionally not warned — cobra doesn't expose an ancestor's invoked-as name publicly, and warning the verb already steers to data <verb>. That accepted gap is documented and pinned in the table test.

2 — Clear "no tracebloc client on this machine" message

Under §7.10 (one machine = one client), when the cluster-wide scan finds no tracebloc client (the machine isn't provisioned), discoverRelease now returns:

no tracebloc client found on the cluster your kubeconfig points at — if this machine should have one, run the installer to provision it; otherwise point at the right cluster with --context/--namespace

instead of the bare no tracebloc client found in namespace X. It still wraps ErrNoParentRelease (exit 4); the scanErr (RBAC), the >1 "pick one", and the active-client-runs-elsewhere paths are untouched.

Tests

  • data_deprecation_test.go — table test over every alias/canonical path + the accepted gap; asserts stderr text + count + no stdout leak.
  • clustertarget_test.go — no-client exit-4 + installer message, scan-unavailable keeps original error, multi-client "pick one" regression.
  • go build ./... / go vet / gofmt clean; full suite green.

Refs tracebloc/backend#879.

🤖 Generated with Claude Code


Note

Low Risk
CLI-only UX (stderr deprecation notices and error text); exit codes and errors.Is contracts are preserved and covered by new table/regression tests.

Overview
Closes #879 with two user-facing changes on the data command surface and cluster discovery.

Deprecation warnings for legacy spellings (dataset, push, rm): data's PersistentPreRunE prints a one-line notice on stderr when the executed command was invoked via an alias (CalledAs()), steering users to data, data ingest, or data delete. Canonical invocations stay silent; dataset <canonical-verb> is an intentional no-warning gap, pinned in tests.

Clearer “no client” error when a cluster-wide scan succeeds but finds zero tracebloc clients: discoverRelease now returns §7.10 guidance (run the installer or fix --context/--namespace) instead of a bare namespace miss, while still wrapping ErrNoParentRelease (exit 4). RBAC/scan failures keep the original per-namespace error; multi-client “pick one” behavior is unchanged.

Testability: resolveClusterTarget routes kubeconfig load and clientset creation through loadClusterFn / newClientsetFn so discovery and exit-code behavior can be exercised with fakes.

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

…essage (#879)

Two remaining acceptance items for the RFC-0001 data-verb rename (backend#879);
the rename + active-client binding already shipped via cli#128.

- Deprecation notices: data's PersistentPreRunE warns once on stderr when a
  command is invoked via a deprecated alias — push→"data ingest", rm→"data
  delete", bare dataset→"data". Detection uses cobra's reliable
  Command.CalledAs() on the executed command (no reflection); the verb notices
  point at the full canonical form so they nudge the group rename too. The
  already-migrated `dataset <canonical-verb>` case is intentionally unwarned
  (documented + pinned in the table test).
- Clear no-client message: when the cluster-wide scan finds NO tracebloc client
  (one-machine-one-client, §7.10 — machine not provisioned), discoverRelease now
  returns a "run the installer / point at the right cluster with --context" hint
  instead of the bare namespace error. Still wraps ErrNoParentRelease (exit 4);
  the scanErr, >1 "pick one", and active-client-elsewhere paths are untouched.

Tests: alias-path table test (every alias + canonical + the accepted gap);
no-client exit-4 + scan-unavailable + multi-client regression. build/vet/gofmt
clean; full suite green.

Refs tracebloc/backend#879.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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