Architecture: How should generated code be stored and versioned? The old a...
Documentation for Sessions
🏗️ Architecture: How should generated code be stored and versioned? The old a...
Date: 2026-03-08
Time: 01:04:23 UTC
Session: gspace1-188.5
Agent: backend
Confidence: 88%
Status: ✅ Documented
📋 Decision Context
Question:
How should generated code be stored and versioned? The old approach wrote files to /tmp/ on the backend server (ephemeral, no history, no rollback). What git backend and branching model?
Task: S188: GitLab-backed code storage with full gitflow
🎯 Decision Made
Chosen:
GitLab REST API v4 as primary code storage. Full gitflow: main (production) / develop (staging) / feature/* (per-generation/edit). UniverseGitService in backend-vitto-api calls GitLab directly via HttpService — no git binary needed on server. Each universe gets a GitLab repo: gograb-{spaceSlug}/universe-{universeSlug}. Universe.gitConfig stores repo path, active branch, last commit SHA. Deploy reads from main branch via GitLab API → uploads to Cloudflare Pages.
Options Considered:
- Local git CLI + push to remote (requires git binary)
- GitLab REST API with full gitflow (chosen)
- GitHub API (no existing infrastructure)
- Simple file versioning in MongoDB (no real git)
💭 Reasoning
Three options evaluated: (1) Local git CLI (StudioGitService already existed with execFileSync) — requires git binary on server, files in /tmp/, not production-ready. (2) GitLab REST API — no binary dependency, full REST, already have GitLabProviderService (1343 lines) with org/repo/branch/commit/merge/pipeline/webhook support, GITLAB_API_TOKEN already in .env.local. (3) GitHub API — would need new service, no existing infrastructure. GitLab chosen because: unlimited licensed users on Premium plan, built-in CI/CD (10k compute minutes/month), Groups/Projects map naturally to spaces/universes, existing integration already proven. Full gitflow (not simplified) chosen because: without branching, even testing is impossible — user generates, modifies via Vitto, needs to see diff, rollback if breaks, deploy only what's on main. Drafts = feature branches. Production = main. Staging = develop.
📁 Files Involved
APIs/backend-vitto-api/src/app/studio/universe-git.service.tsAPIs/backend-vitto-api/src/app/studio/studio-git.controller.tsAPIs/backend-vitto-api/src/app/studio/studio.module.tsAPIs/backend-vitto-api/src/app/module-generation/phases/module-gen-phase.executor.ts
🔗 Related
- Decision ID:
dev_1772931863084_kh5bsct - Session: 188
- Workspace: gspace1
Auto-generated by MCP Smart Consolidation