Personal Drive/RAG without a company (#55) #56

Merged
westfarn merged 2 commits from fix/drive-connection-null-company-id into master 2026-08-02 03:44:42 -07:00
Owner

Summary

  • Closes #55 (related #46)
  • Personal Google Drive / OneDrive works for users without a company (personal RAG)
  • Company Drive still requires company + manager
  • Schema: nullable DriveConnection.company, personal DocumentWorkspace.user, ownership check constraints + conditional uniques
  • Runtime: ensure_personal_workspace, personal sync → personal WS, chat/document APIs fall back to personal WS when company_id is null
  • Supersedes the interim "reject with no_company" approach (wrong for personal connect)

Test plan

  • OAuth: personal Drive callback with user.company=NULL succeeds (company_id=NULL on connection)
  • OAuth: company Drive still returns no_company / forbidden appropriately
  • Chat tenant scope creates personal workspace for solo users
  • Drive sync + document view suites (91 related tests)
  • Manual: solo entitled user connects Google Drive → success, sync lands in personal workspace
  • Manual: company manager company Drive still works
  • Migrate prod/staging with 0029_personal_drive_rag_without_company
## Summary - Closes [#55](https://git.aimloperations.com/ai_ml_operations/chat_backend/issues/55) (related [#46](https://git.aimloperations.com/ai_ml_operations/chat_backend/issues/46)) - **Personal** Google Drive / OneDrive works for users **without** a company (personal RAG) - **Company** Drive still requires company + manager - Schema: nullable `DriveConnection.company`, personal `DocumentWorkspace.user`, ownership check constraints + conditional uniques - Runtime: `ensure_personal_workspace`, personal sync → personal WS, chat/document APIs fall back to personal WS when `company_id` is null - Supersedes the interim "reject with `no_company`" approach (wrong for personal connect) ## Test plan - [x] OAuth: personal Drive callback with `user.company=NULL` succeeds (`company_id=NULL` on connection) - [x] OAuth: company Drive still returns `no_company` / `forbidden` appropriately - [x] Chat tenant scope creates personal workspace for solo users - [x] Drive sync + document view suites (`91` related tests) - [ ] Manual: solo entitled user connects Google Drive → success, sync lands in personal workspace - [ ] Manual: company manager company Drive still works - [ ] Migrate prod/staging with `0029_personal_drive_rag_without_company`
westfarn added 1 commit 2026-08-02 03:35:39 -07:00
Reject Drive link when user has no company (#55).
CI / test (pull_request) Successful in 10s
Unit Tests / test (pull_request) Successful in 11s
311e19abe6
Avoid NotNullViolation on DriveConnection.company_id by returning a
no_company OAuth error before token exchange / upsert.
westfarn added 1 commit 2026-08-02 03:41:02 -07:00
Support personal Drive/RAG without a company (#55).
CI / test (pull_request) Successful in 10s
Unit Tests / test (pull_request) Successful in 10s
0d6bf2b024
Personal Drive connections and document workspaces are user-owned and
no longer require company_id. Company Drive still requires a company
manager. Chat/document scope falls back to a personal workspace for
solo users instead of rejecting with company_missing.
westfarn changed title from Fix DriveConnection null company_id on Google Drive link (#55) to Personal Drive/RAG without a company (#55) 2026-08-02 03:41:06 -07:00
westfarn merged commit 7025dab857 into master 2026-08-02 03:44:42 -07:00
westfarn deleted branch fix/drive-connection-null-company-id 2026-08-02 03:44:42 -07:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ai_ml_operations/chat_backend#56