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`
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
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
DriveConnection.company, personalDocumentWorkspace.user, ownership check constraints + conditional uniquesensure_personal_workspace, personal sync → personal WS, chat/document APIs fall back to personal WS whencompany_idis nullno_company" approach (wrong for personal connect)Test plan
user.company=NULLsucceeds (company_id=NULLon connection)no_company/forbiddenappropriately91related tests)0029_personal_drive_rag_without_companyFix DriveConnection null company_id on Google Drive link (#55)to Personal Drive/RAG without a company (#55)