Architecture: How to enforce single source of truth for space/universe DB ...

Documentation for Sessions

🏗️ Architecture: How to enforce single source of truth for space/universe DB ...

Date: 2026-03-18
Time: 14:04:26 UTC
Session: gspace1-232.2
Agent: backend
Confidence: 95%
Status: ✅ Documented


📋 Decision Context

Question:

How to enforce single source of truth for space/universe DB and collection naming?

Task: Not specified


🎯 Decision Made

Chosen:

Verification script (verify-space-database-naming.ts) + yarn verify:db:naming; canonical resolvers: SpaceDatabaseResolverService.resolveSpaceDatabaseName, buildCollectionName(universeId, collection). Fixed E2E getSpaceModule to use getSpaceDb(); added JSDoc CONTRACT to backend-ai-api space-database.utils.

Options Considered:


💭 Reasoning

Prevents duplicate space DBs (space_chrome-space-1 vs space_chrome-space-1_79fe44376823) and universe_universe_ double-prefix. Script runs without execSync (uses fs/path), checks backend-api, entity-schema, E2E helper, backend-ai-api. Run before merge.


📁 Files Involved


🔗 Related


Auto-generated by MCP Smart Consolidation