Skip to content

feat(workspace): mb workspace list/get/create/destroy#33

Draft
escherize wants to merge 2 commits into
mainfrom
bcm/ghy-4050-workspace-commands
Draft

feat(workspace): mb workspace list/get/create/destroy#33
escherize wants to merge 2 commits into
mainfrom
bcm/ghy-4050-workspace-commands

Conversation

@escherize

Copy link
Copy Markdown
Contributor

Refs GHY-4050 (Linear).

CLI half of Option B's workspace lifecycle: mb workspace wraps the existing EE /api/ee/workspace-manager surface so a local agent can create, inspect, and destroy a disposable workspace from the terminal. The parent does all the heavy lifting (warehouse isolation DDL); the CLI is deliberately thin wrappers plus safety rails.

Why the shape it has

  • Commands gate on capabilities: { minVersion: 62, tokenFeature: "workspaces" } — workspace-manager exists on master only (absent from release-x.61.x, verified against the metabase repo), and the route is premium-gated on :workspaces.
  • create takes --name + --database-ids flags rather than a JSON body: the server contract is a closed two-field map, and the sequence doc's UX (mb workspace create --database-ids 1,2) is flag-shaped.
  • destroy prompts (or --yes), supports --ignore-pending (the server's escape hatch when a database is stuck mid-provision), and surfaces orphaned_resources — it's the billing-stop lever, so the result must say what was left behind.
  • Deferred within GHY-4050: connect and create-writes-ws-<name>-profile — blocked on the parent returning {name, url, apiKey} (GHY-4058) and the POST /:id/credentials endpoint (GHY-4052).

Summary

  • src/domain/workspace.tsWorkspace / WorkspaceCompact / workspaceView; provisioning status pinned as the closed enum from the backend malli schema.
  • src/commands/workspace/{index,list,get,create,destroy}.ts — thin wrappers; ws alias.
  • parseIdCsv in src/commands/parse-id.ts (comma-separated id lists) + unit tests.
  • e2e: token-gated lifecycle (create → list → get → destroy against the seeded warehouse, enabling database-enable-workspaces per test), ungated arg-validation, sub-v62 capability-gate block. README + manifest updated.
  • fix(e2e): compose passed ${METASTORE_DEV_SERVER_URL:-}, injecting an empty string that Metabase's dev-mode token check treats as configured (hostless URL, token check always failed). Bare list-syntax env entries fix it; the staging fallback now validates the dev token and the token-gated suites actually run.

Test plan

  • Validated against a live EE head server with the workspaces feature: full lifecycle e2e including real isolation DDL (schema + user created and dropped in the postgres warehouse). Assertions were corrected against observed server behavior (list hydrates databases; 404 message is route-level).
  • bun run test (833), full bun run test:e2e (371 passed / 3 skipped), tsc, oxlint, oxfmt all green.

escherize added 2 commits July 6, 2026 13:42
Thin wrappers over /api/ee/workspace-manager (EE, v62+, workspaces
premium feature). create provisions warehouse isolation blocking;
destroy confirms, supports --ignore-pending, and surfaces
orphaned_resources. Lifecycle e2e self-skips until the server carries
the workspaces token feature.

connect + profile-write land with the parent credentials endpoint.

Refs GHY-4050
${VAR:-} injected an empty METASTORE_DEV_SERVER_URL; Metabase's
dev-mode token check treats empty as configured and builds a hostless
URL, so token validation always failed. Bare list-syntax entries only
pass through when the shell defines them, letting the staging
token-check fallback work.
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 016919ef-3c11-4c98-9d5a-e3c5aa4a810b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bcm/ghy-4050-workspace-commands

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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