Repository navigation
feat(workspaces)!: remember current workspace and database across logins - #326
Conversation
Replace the "default" workspace (first entry of the cached list) with an explicit current workspace saved on this machine. Logout keeps it and the per-workspace current database, so the next login resumes where you left off. Only `workspaces use` and `databases use` switch. `--workspace-id`, `-d/--database`, `databases create` and `databases fork` apply to one command and no longer change the current selection. - `databases use` accepts a catalog alias or name, like `-d` - `workspaces list` / `databases list` column renamed DEFAULT -> CURRENT - skill and README document the rules BREAKING CHANGE: `databases create` and `databases fork` no longer make the new database current. Run `hotdata databases use <id>` or pass `-d <id>`.
| .iter() | ||
| .find(|w| w.public_id == c.public_id) | ||
| .cloned() | ||
| }); |
There was a problem hiding this comment.
nit: Match against entry.current_workspace_id() here instead of entry.current_workspace (not blocking).
Consequence: an upgraded user loses the saved workspace choice on the first login. A legacy config has no current_workspace; the user's choice is workspaces[0], which the old save_default_workspace placed there. save_workspaces ignores workspaces[0] and picks the first fetched workspace instead. auth logout makes the problem worse, because clear_workspaces wipes the list before login can read it.
Fix: in clear_workspaces, copy workspaces.first() into current_workspace when current_workspace is None. In save_workspaces, look up the legacy fallback id from current_workspace_id() in the fetched list. With both changes, the PR's "survives logout/login" promise also covers existing configs.
| - **Flags apply to one command only.** `--workspace-id` / `-w` and `--database` / `-d` (`--database-id` on `ingest`) target that command and leave the current workspace and database unchanged. | ||
| - `hotdata workspaces list` and `hotdata databases list` mark the current one with `*` in the `CURRENT` column. `hotdata databases unset` clears the current database. | ||
|
|
||
| If **`HOTDATA_WORKSPACE`** is set in the environment, the workspace is **locked** to that value: passing a different `--workspace-id` is an error, and **`hotdata workspaces use` fails** (“workspace is locked”). |
There was a problem hiding this comment.
nit: Delete this paragraph (not blocking). Line 52 already has the same HOTDATA_WORKSPACE paragraph, so agents read the lock rule twice.
| Retrieval workloads in Hotdata: **BM25 full-text**, **vector similarity**, and the **indexes** and **embedding providers** that power them. | ||
|
|
||
| **Prerequisites:** Authenticate, set a workspace, and set an active database (`hotdata databases use <id>`) — see the **`hotdata`** skill. Use fully qualified table names: `<catalog>.<schema>.<table>`. | ||
| **Prerequisites:** Authenticate, set a workspace, and set an current database (`hotdata databases use <id>`) — see the **`hotdata`** skill. Use fully qualified table names: `<catalog>.<schema>.<table>`. |
There was a problem hiding this comment.
super nit: Change "an current" to "a current" (not blocking). The same error is on line 51 ("with an current database set"), line 97, and skills/hotdata/SKILL.md ("With an current database set").
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
…nd logout Address review: configs written before current_workspace store the choice in workspaces[0]. save_workspaces now matches it via current_workspace_id, and clear_workspaces copies it into current_workspace before wiping the list. Also drop a duplicated HOTDATA_WORKSPACE paragraph and fix 'an current' typos in the skills.
What
The CLI no longer has a "default" workspace or database. It saves a current workspace and, per workspace, a current database on this machine. They are kept across
auth logout/auth login, so a new session resumes where you left off.Rules
hotdata workspaces useandhotdata databases useswitch.--workspace-id/-wand--database/-dapply to one command only.databases createanddatabases forkno longer switch to the new database. Their output shows theusecommand and a-dexample.Other changes
databases useaccepts a catalog alias or name, like-d.workspaces list/databases list: columnDEFAULTrenamed toCURRENT.current_workspacefield. The cachedworkspaceslist is no longer reordered. Old configs fall back to the first cached workspace.Current workspace and databasesection), workflows and README updated; every create/fork example now includesdatabases use.Breaking
Scripts that run
databases createand then load or query without-dnow get "a database is required". Addhotdata databases use <id>or pass-d <id>.Testing
workspaces use→ create (no switch) →useby catalog → query → fork (no switch) →-d/-wone-offs (no switch) → logout → login (workspace and database restored).