Skip to content

lakebox: bugfixes — start help text, create default-clobber, keyHash trailing-newline, plus UX#5460

Open
akshaysingla-db wants to merge 1 commit into
databricks:demo-lakeboxfrom
akshaysingla-db:akshay/lakebox-bugfix-bundle
Open

lakebox: bugfixes — start help text, create default-clobber, keyHash trailing-newline, plus UX#5460
akshaysingla-db wants to merge 1 commit into
databricks:demo-lakeboxfrom
akshaysingla-db:akshay/lakebox-bugfix-bundle

Conversation

@akshaysingla-db
Copy link
Copy Markdown
Collaborator

Summary

Three correctness fixes and several small UX cleanups, surfaced by a final ship-readiness audit. Bundled because each is small and they all sit on the same register → ssh path that gets exercised together.

BLOCKERs (real bugs)

1. start.go documented timeout was half the actual timeout

Long: said "blocks until the sandbox reaches Running (or up to 5 minutes)" while startWaitTimeout = 10 * time.Minute. Fix the text.

2. create.go clobbered the saved default on any transient API error

Previous code:

if _, err := api.get(currentDefault); err != nil {
    shouldSetDefault = true   // any error
}

A 500, network blip, or rate-limit silently overwrote the user's chosen default. Every sibling (delete, default, ssh) already uses errors.Is(err, apierr.ErrNotFound)create now matches.

3. keyHash included a trailing newline in its sha256 input

.pub files end with \n. Locally-generated keys are fine because ssh-keygen -C "lakebox" always adds a comment that gets stripped before the \n is reached. But a user-supplied key without -C would produce a hash that doesn't match the server's, making verifyKeyRegistered falsely report "key not registered". Fix: strings.TrimSpace the input first. Two new test cases pin the behavior for \n and surrounding whitespace.

UX fixes

  • status.go exposed fqdnapi.go documents FQDN as the manager's internal routing host, not user-actionable. Dropped from non-JSON output (still in -o json for completeness).
  • status.go 404 message — wrapped as "failed to get lakebox X: ..." while delete/default/ssh returned the friendlier "no lakebox named X — databricks lakebox list shows available IDs". Now consistent.
  • ui.go warn() switched to yellow — was cyan, indistinguishable from the success ✓ marker.
  • delete.go clean cancel — returning errors.New("aborted") surfaced as Error: aborted + non-zero exit. Now prints Cancelled. and returns nil.
  • Consistent sentence-case across all warn() messages.

Test plan

  • go test ./cmd/lakebox/... passes (including 2 new keyHash cases for trailing-newline and leading/trailing whitespace)
  • go build ./... clean
  • gofmt -l cmd/lakebox/ clean

Out of scope

Acceptance test scaffold for cmd/lakebox/ (the bigger gap surfaced by the same audit) is its own PR — these are zero today and adding them is a separate larger change.

This pull request and its description were written by Isaac.

…sh trailing-newline, plus UX

Three correctness fixes (BLOCKERs from a final ship-readiness audit) and
several smaller UX cleanups, bundled because each is small and they all
sit on the same `register → ssh` path that gets exercised together.

BLOCKERs:

1. `start.go` `Long:` said "blocks until the sandbox reaches Running
   (or up to 5 minutes)" while the actual `startWaitTimeout` constant
   is 10 minutes. Documented bound mismatched the enforced bound — fix
   the text.

2. `create.go` was using `if _, err := api.get(currentDefault); err != nil`
   to decide whether to overwrite the saved default. Any non-404 error
   (transient 5xx, network blip, rate limit) silently clobbered the
   user's default. Every sibling (`delete`, `default`, `ssh`) already
   uses `errors.Is(err, apierr.ErrNotFound)` for this — `create` now
   matches.

3. `keyHash` included a trailing newline in its sha256 input for `.pub`
   files without an OpenSSH comment. Locally-generated keys are fine
   (`ssh-keygen -C "lakebox"` always adds a comment), but a user-supplied
   key without `-C` would produce a hash that doesn't match the server's,
   making `verifyKeyRegistered` falsely report "key not registered". Fix:
   `strings.TrimSpace` the input first. New test cases pin the behavior
   for `\n` and surrounding whitespace.

UX fixes:

- `status.go` displayed an `fqdn` field even though `api.go` documents
  FQDN as the manager's internal routing host — drop from non-JSON
  output (still present in `-o json` for completeness).
- `status.go` wrapped 404 errors as "failed to get lakebox X: ..." while
  `delete`, `default`, and `ssh` all return the friendlier "no lakebox
  named X — `databricks lakebox list` shows available IDs". Add the
  same branch.
- `ui.go` `warn()` used cyan, the same color as `ok()` and the spinner
  ✓ marker — so a warning was visually indistinguishable from success.
  Switch to yellow (already in the palette via `cmdio.Yellow`).
- `delete.go` returned `errors.New("aborted")` on user-cancel, which
  surfaced as `Error: aborted` with a non-zero exit. Print "Cancelled."
  and return nil instead.
- Inconsistent capitalization across `warn()` messages (some sentence
  case, some lowercase) — standardize on sentence case to match the
  rest of the repo.

Co-authored-by: Isaac
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 7, 2026

Waiting for approval

Based on git history, these people are best suited to review:

  • @pietern -- recent work in cmd/lakebox/

Eligible reviewers: @andrewnester, @anton-107, @denik, @renaudhartert-db, @shreyas-goenka, @simonfaltum

Suggestions based on git history. See OWNERS for ownership rules.

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