Architecture: Where should the phone→user channel identity mapping live? v...

Documentation for Sessions

🏗️ Architecture: Where should the phone→user channel identity mapping live? v...

Date: 2026-02-20
Time: 20:06:32 UTC
Session: gspace1-129.6
Agent: backend
Confidence: 95%
Status: ✅ Documented


📋 Decision Context

Question:

Where should the phone→user channel identity mapping live? vitto-mind or backend-api?

Task: Session 129: Move channel identity to backend-api (correct data ownership)


🎯 Decision Made

Chosen:

backend-api (gograb-space database) as source of truth. UserChannelIdentity schema in @libs-api/backend-core, endpoint in backend-api UsersController, vitto delegates via BackendApiClientService REST calls.

Options Considered:


💭 Reasoning

Initial implementation incorrectly placed ChannelUserLinkDoc in vitto-mind, creating a parallel user database. User identity MUST be owned by backend-api — it's the auth system, owns User/PlatformUser schemas, and all services can query it. Vitto storing its own phone→user mapping creates: (1) data segregation — web panel can't see channel links, (2) auth bypass — Vitto doing its own identity resolution, (3) consistency drift — if user changes account in backend-api, vitto-mind doesn't know. Corrected to: UserChannelIdentity schema in backend-core (shared), registered in backend-api's UsersModule, REST endpoints at /api/users/resolve-channel and /api/users/link-channel. Vitto's ChannelUserService now delegates to backend-api via BackendApiClientService with graceful fallback to anonymous mode if backend-api unreachable.


📁 Files Involved


🔗 Related


Auto-generated by MCP Smart Consolidation