Description
Closes two recurring documentation gaps surfaced in #zen-retros that each burned multiple turns to re-derive from code in recent sessions:
apps/apollo/src/lib/connected_accounts/CONNECTED_ACCOUNTS.md — new "Identity & Lookup" section before "Account Type":
- Table mapping the four identity fields (
id UUID vs nanoId ca_* vs userId owner vs clientUniqueUserId correlation), with the entity_id / user_id API parameter aliases.
shouldUseEntityId = !connectedAccountId branching at findConnectedAccounts.ts:203 — when connected_account_id is provided the SQL filters on nanoId + projectId only; userId is NOT in the WHERE.
- Post-fetch ownership check at
getOrFindConnectedAccount.ts:120-180 is gated on handleEntityIdMismatch (bound to projectConfig.is2FAEnabled in tool_auth_builder.ts:99 and recipe_auth_builder.ts:97). 2FA-off projects skip BOTH the ownership check AND the SHARED ACL gate at lines 153-180.
packages/db/docs/DB_MIGRATIONS_GUIDE.md — new "Best Practices → Schema Changes" bullet:
- Liquibase migrations MUST double-quote camelCase column names in every SQL identifier reference (
ADD/DROP/RENAME COLUMN, index column lists, WHERE clauses, functional indexes).
- Cites
v9_add_manually_manage_connections_chat_sessions ("manuallyManageConnections") and v21_add_tool_router_session_schema ("isToolRouterConfig") as canonical examples.
How did I test this PR
- Verified
shouldUseEntityId = !connectedAccountId is at findConnectedAccounts.ts:203 and the post-fetch check at getOrFindConnectedAccount.ts:120-140.
- Verified
handleEntityIdMismatch: projectConfig.is2FAEnabled at tool_auth_builder.ts:99 and recipe_auth_builder.ts:97.
- Verified the cited canonical Liquibase migrations contain the exact quoted-camelCase column strings.
- Docs-only change — no code paths modified, no tests affected.
Origin: cron-weekly-retro-ai-improvements / zen-cron-f7c9b8477802
Triggered by: karan@composio.dev | Source: cron-weekly-retro-ai-improvements
Session: https://zen-api-production-4c98.up.railway.app/dashboard/#/chat/zen-cron-f7c9b8477802