Architecture: How should we resolve parallel role vocabularies (VittoUserT...
Documentation for Sessions
ποΈ Architecture: How should we resolve parallel role vocabularies (VittoUserT...
Date: 2026-03-19
Time: 21:04:26 UTC
Session: gspace1-242.2
Agent: backend
Confidence: 90%
Status: β
Documented
π Decision Context
Question:
How should we resolve parallel role vocabularies (VittoUserType, VittoLayer, JWT roles vs PlatformRole) without breaking Mongo documents or active Vitto/chat flows?
Task: S242 MCP knowledge capture after role-system cleanup handoff
π― Decision Made
Chosen:
Single source of truth: role-derivation.ts (PlatformRole + derivePermissions). Map legacy JWT roles at boundaries (platformRoleFromLegacyRoles); persist platformRole on User; replace Vitto UI tiers with PlatformRole-derived features; rename VittoLayer to VittoConfigAccess for task config; extend Mongo enums (executive, userType) rather than destructive migration.
Options Considered:
- Full breaking rename of all stored role fields
- Status quo with ad-hoc string checks per service
π Reasoning
Root cause: S220 introduced PlatformRole but adoption was partial, causing managerβadmin inflation, dead space_builder JWT branch, wrong builder context strings, and schema drift. Alternatives of full DB-only PlatformRole or deleting vitto-chat.service without consumers were rejected per handoff (keep RegistrationUserType / hierarchy enums). Prevention: grep for new parallel role types; document Mongo backfills in runbook; align schema comments to L0βL4.
π Files Involved
libs/libs-foundational/core-models/src/lib/utils/role-derivation.tsAPIs/backend-api/src/app/backend-auth/backend-auth.service.tsAPIs/backend-ai-api/src/app/chat/chat.controller.tsAPIs/backend-vitto-api/src/app/types/vitto.types.tslibs/libs-ai/vitto-chat/src/lib/types/chat.types.tslibs/libs-ai/gograb-ai-lib/src/lib/components/vitto-hub/vitto-hub.component.tsdocs/superpowers/plans/2026-03-19-role-system-mongodb-runbook.md
π Related
- Decision ID:
dev_1773954266624_5l9yrbh - Session: 242
- Workspace: gspace1
Auto-generated by MCP Smart Consolidation