fix(workspace): stop the TUI sending people to a picker that lists nothing
What
Two small fixes to the same dead end, on the surface the reported case actually used.
A workspace created from altimate-code is always privacy: "private", and the backend hides a private workspace's binding from everyone else. So when a teammate clones the repo:
- the binding lookup 404s as if the project were unlinked,
- the workspace list shows 0 (correct — they own none),
- and the create they are then offered cannot succeed either:
repo_remoteis unique per tenant across active bindings (uq_datamate_project_bindings_repo_remote_active), so the binding they are not allowed to see still refuses them with a 409 whose workspace name is redacted.
HIDDEN_BINDING_MESSAGE exists for precisely this and says the useful thing: ask the owner to share it, or to unlink the project. The link command already uses it.
1. The TUI quick-create row never called isHiddenBindingConflict. It was the one conflict handler of four in workspace.tsx that didn't — the other three (lines 432, 918, 1115) all branch on it. It fell through to "already linked to another workspace — use the palette's 'Link this project to a workspace' to change", pointing at a picker scoped to workspaces the caller cannot see, which lists none of them. That is the loop with no exit that HIDDEN_BINDING_MESSAGE was written to end.
2. Nobody told the creator. QUICK_WORKSPACE_PRIVATE_NOTE was printed only by cli/cmd/link.ts. createAndBindInline — the quick-create row — said nothing about privacy, so the one person who could open the workspace up had no reason to. It now rides on the confirmation dialog, gated on the Created verb: the other two verbs (Linked, Re-linked) bind an existing workspace whose privacy was chosen elsewhere, and the note would be wrong there. The degraded path (a dialog-teardown race falls back to a toast) carries it too, since that toast is then the user's only signal.
The constant moves to api-client.ts beside HIDDEN_BINDING_MESSAGE — both surfaces have to say it and neither can import the other.
What this deliberately does not change
Private-by-default stays. It is the intended behaviour: the creator gets to try the workspace out before sharing it, and sharing already works from the workspace page in the web app (WorkspaceSharing, rendered on the workspace overview). What was missing was telling either person so.
Still absent, and out of scope here: a request-access flow and an owner notification. Today the teammate's only route is out-of-band — they now at least know exactly what to ask for and from whom.
Verification
bun run typecheck (tsgo --noEmit) — clean.
bun test test/altimate/workspace/create-then-rebind.test.ts — 15 pass, 0 fail. Four new tests, one per rule, each shown to fail when its guard is reverted:
| Mutation | Test that fails |
|---|---|
drop isHiddenBindingConflict at the quick-create toast | the quick-create row says the same thing |
use HIDDEN_BINDING_MESSAGE for every 409 | a NAMED 409 is still a real race |
privacy = "" (never show the note) | a create tells the creator the workspace is private |
| show the note on every verb | binding to an EXISTING workspace does not |
oxlint on the four changed files: 0 errors (repo baseline for these files is 16 warnings, now 17 — one more as never api stub in the test file, matching the two already there). check-tracker-leaks.ts exits 0.
Broader suites were run and their failures confirmed pre-existing on origin/main, not caused by this change:
test/altimate/workspace/— 797 pass, 1 fail (flushPendingSyncs waits for a sync a short-lived process would abandon, a 5s timeout that fails identically on a cleanorigin/maincheckout in the same directory run, and passes when that file runs alone).test/cli— flaky onorigin/maintoo: 1 fail then 0 fail on a re-run of the same unmodified tree.
Not verified end-to-end against a live two-user tenant; the backend half of the behaviour is pinned by test_409_redacts_name_when_caller_cannot_see_workspace in altimate-backend, which passes and is exactly this scenario.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Tneq4MLNoRLsX7htV6fGZC
Summary by cubic
Fixes the TUI's workspace quick-create flow so it no longer sends users into a dead end when a private workspace's binding is hidden from them.
- The quick-create row now detects hidden binding conflicts and shows the "ask the owner to share it or unlink the project" guidance instead of pointing at a picker listing no visible workspaces.
- The creator of a workspace now sees a note that it is private and how to share it, shown on the confirmation dialog (and fallback toast), gated to creates only since binds attach to an existing workspace.
- Moves
QUICK_WORKSPACE_PRIVATE_NOTEtoapi-client.tsbesideHIDDEN_BINDING_MESSAGEso both the CLI and the TUI can use it.
Summary by CodeRabbit
- New Features
- Quick-created private workspaces now include a notice that they’re visible only to their creator and must be shared through the Altimate web app for teammates to use.
- Bug Fixes
- Workspace conflict messages now distinguish hidden workspaces from named existing workspaces.
- If confirmation fails after a workspace is created, the fallback message includes the private-workspace notice.