ποΈ db(database): add workspace_id columns to existing tables#15446
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
π‘ Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9f8ff9a036
βΉοΈ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with π.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Codecov Reportβ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## canary #15446 +/- ##
===========================================
- Coverage 89.70% 70.88% -18.82%
===========================================
Files 862 3223 +2361
Lines 105731 319681 +213950
Branches 10246 29088 +18842
===========================================
+ Hits 94841 226593 +131752
- Misses 10714 92912 +82198
Partials 176 176
Flags with carried forward coverage won't be shown. Click here to find out more.
π New features to boost your workflow:
|
9f8ff9a to
923db11
Compare
Add a nullable `workspace_id text` column to user-owned business tables (agents, sessions, topics, messages, files, tasks, RAG/eval, RBAC, devices, connectors, etc.) so records can later be scoped to a workspace. Workspace tables themselves already landed on canary via 0105_add_usage_agent_share_workspace. Also folds in the additive device schema from #15356: the structured `working_dirs` jsonb column + `WorkingDirEntry` type (recent_cwds kept, now @deprecated). Scope is deliberately column-only β the lowest-risk slice: - migration 0106 is pure `ADD COLUMN IF NOT EXISTS` (metadata-only, ~ms locks per table, online-safe, no app code change since columns are all NULL). - FKs, btree indexes, and the per-userβworkspace-scoped unique-constraint conversions are intentionally deferred to follow-up PRs so each can use the production-safe execution path Drizzle can't express (NOT VALID + VALIDATE, CREATE INDEX CONCURRENTLY, atomic unique swap). Scoping notes: - devices / user_connectors / user_connector_tools: scoped (user-owned resources). - push_tokens: left user/device-level β an Expo token is one per app install and receives a person's notifications across all their workspaces. - agent_shares: no workspace_id β scoped transitively via agent_id β agents. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
923db11 to
b8ca57c
Compare
workspace_id columns to existing tables
Adding workspace_id made it a required key in the Drizzle-inferred row types ($inferSelect), breaking call sites that build those shapes by hand: - rbac.getUserRoles: include workspace_id in the explicit select projection - session action: add workspaceId to the constructed chat-group literal - test mocks (apiKey / generation / generationBatch / generationTopic): add workspaceId: null Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The two `expect(createdTopic).toEqual({ ...full literal })` snapshots broke
on every new column (here: workspace_id). Switch them to toMatchObject so the
returned row may carry extra columns without churning the expected literal.
The dbTopicβcreatedTopic strict comparisons are left as toEqual.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
# π LobeHub Release (20260610) **Release Date:** June 10, 2026 **Since v2.2.2:** 131 merged PRs Β· 13 contributors > This weekly release strengthens agent collaboration across cloud, desktop, CLI, and workspace flows, with steadier runtime behavior and a broader foundation for workspace-scoped data. --- ## β¨ Highlights - **Agent execution across devices** β Unifies per-device working directories, project skill discovery, and sub-agent suspend/resume behavior across server, QStash, and device RPC flows. (#15543, #15566, #15481, #15620, #15591) - **Connector and sandbox platform** β Expands connector permissions, custom OAuth MCP connector onboarding, sandbox provider support, and user-uploaded file sync into cloud sandbox runs. (#15463, #15546, #15184, #15550) - **Desktop and CLI reliability** β Fixes desktop cold-start, auto-update, Windows build, CLI skill discovery, and `lh connect` agent dispatch paths. (#15547, #15525, #15527, #15562, #15632, #15634) - **Pages and sharing** β Refreshes topic sharing, improves Page Editor layout behavior, and routes Page Agent tool execution through the server-side editor path. (#15581, #15556, #15588, #15023, #15610) - **Model availability and provider updates** β Adds user-scoped LobeHub model availability, Claude Fable 5, Qwen thinking preservation, and MiniMax M3 updates. (#15590, #15639, #13494, #15376) --- ## ποΈ Core Product & Architecture ### Agent Runtime & Heterogeneous Agents - Improves sub-agent lifecycle handling, including async suspend/resume, queue-mode QStash resume delivery, and blocking nested sub-agent calls. (#15481, #15620, #15575) - Stabilizes heterogeneous agent ingestion and streaming with raw stream dumps, per-turn usage, image forwarding on regenerate, and duplicate-text fixes. (#15602, #15577, #15592, #15585) - Adds execution-device and working-directory controls across device RPC, legacy defaults, and remote-spawned Claude Code sessions. (#15543, #15566, #15591, #15572) - Improves runtime diagnostics and compatibility, including Gemini multimodal output capture, abort stream semantics, and trace quality analysis. (#15535, #13677, #15508) --- ## π± Platforms, Integrations & UX ### Connectors, Sandbox & Tools - Ships API-level connector tool permissions, custom OAuth MCP connector onboarding, and connector-first runtime execution. (#15463, #15546) - Adds sandbox provider support, cloud sandbox file sync, and safer external URL file input handling with SSRF validation. (#15184, #15550, #12657) - Improves tool visibility and execution with pinned app-fixed tools, ANSI output rendering, gateway-tunneled MCP calls, and automatic headless tool runs. (#15509, #15516, #15469, #15492) ### Desktop, CLI & Web UX - Restores desktop startup and reload behavior, preserves IPC error causes, and keeps the tab bar new-tab action visible across routes. (#15547, #15597, #15638) - Fixes desktop update and build stability for browser quit guards, macOS update signing, and Windows Visual Studio detection. (#15525, #15527, #15562) - Shows the plan-limit upgrade UI on desktop builds. (#15628) - Adds the Agent Run delivery checker and fixes CLI device dispatch plus skill list/search output. (#15489, #15634, #15632) - Refreshes onboarding, auth source preservation, topic UI states, referral/Fable campaign copy, and chat-input control bar behavior. (#15629, #15544, #15573, #15614, #15616, #15617, #15622, #15643) --- ## π Security, Reliability & Rollout Notes - External URL file input now includes SSRF validation for safer Google file handling. (#12657) - Database workspace-scope migrations are part of this release; self-hosted operators should run the normal migration path before serving the updated app. (#15446, #15465, #15468, #15472) - The release branch was re-cut from `canary` and includes the latest `main` release-version commit so `v2.2.2` is the verified compare base. --- ## π₯ Contributors @ONLY-yours, @sxjeru, @hardy-one, @xujingli, @hezhijie0327, @Coooolfan, @arvinxx, @tjx666, @Innei, @rivertwilight, @rdmclin2, @cy948, @AmAzing129 **Full Changelog**: v2.2.2...release/weekly-20260610-recut-3
π» Change Type
π Description of Change
Adds a nullable
workspace_id textcolumn to user-owned business tables (agents, sessions, topics, messages, files, tasks, RAG/eval, RBAC, devices, connectors, etc.) so records can later be scoped to a workspace. The workspace tables themselves already landed oncanaryvia #15439 (0105_add_usage_agent_share_workspace).Also folds in the additive device schema from #15356: the structured
working_dirsjsonb column +WorkingDirEntrytype (recent_cwdskept, now@deprecated).Scope is deliberately column-only β the lowest-risk slice of the workspace DB work. FK constraints, btree indexes, and the per-user β workspace-scoped unique-constraint conversions are intentionally deferred to follow-up PRs, because each needs a production-safe execution path Drizzle's migration runner can't express (it wraps everything in one transaction):
ADD COLUMN β¦ text(nullable)AccessExclusivelock per table, online-safe β this PRADD FOREIGN KEY β workspacesNOT VALID+VALIDATECREATE INDEX β¦ workspace_idCREATE INDEX CONCURRENTLY(can't run in a txn)Migration
0106_add_workspace_id_columnsis pureALTER TABLE β¦ ADD COLUMN IF NOT EXISTS(71 statements: 70workspace_id+ 1working_dirs), idempotent. No application code changes β every column is NULL/[], so existing queries are unaffected.Scoping decisions for recently-added tables
After rebasing, I audited every table with a
user_idbut noworkspace_id:api_keys/agent_bot_providers):devices,user_connectors,user_connector_tools.push_tokensβ an Expo push token is one per physical app install and receives a person's notifications across all their workspaces; there is no per-workspace token.agent_shares(nouser_id; scoped transitively viaagent_idβagents.workspace_id), auth/identity infra (accounts,nextauth_*,oidc_*,two_factor), personal memory (user_memories*), andnotifications(user-level by existing design).π§ͺ How to Test
drizzle-kit generatereportsNo schema changes, nothing to migrateβ schema TS, snapshot, journal, and SQL are fully consistent. Diff vscanaryis pure additions (the only deletion is #15356 adding the@deprecatednote aboverecent_cwds).π Additional Information
Planned follow-ups (each its own PR, executed with the safe path above, lower-risk first):
workspace_idforeign keys (NOT VALID+VALIDATE)workspace_idbtree indexes (CREATE INDEX CONCURRENTLY, serial)Supersedes the column/table half of the WIP in #15414, and the schema layer of #15356 (its model/tRPC/UI consumers in #15353 remain).
π€ Generated with Claude Code