Skip to main content

MVP Critical Path Analysis - Coditect V5

Date: 2025-10-14 Analysis Type: Critical Path to Full Cloud Deployment Scope: Registration, Login, JWT, IDE Integration, Session Management, FDB Persistence


🎯 Executive Summary

Current Status: 21.9% Complete (28/128 tasks)

Critical Achievement: ✅ FoundationDB Phase 1 & 2 COMPLETE

  • 10 models implemented (943 lines)
  • 11 repositories implemented (1,917 lines)
  • Total: 2,860 lines of production-ready FDB code
  • Completed: 2025-10-14

Critical Blocker (Historical - October 7):

  • Backend API pods CrashLoopBackOff (FDB connection issue)
  • Status: Likely resolved - FDB models/repos completed Oct 14
  • Requires Verification: Test backend deployment with new FDB code

Timeline to MVP:

  • Solo: 4-6 weeks
  • 2-Person Team: 3-4 weeks
  • 4-Person Team: 2-3 weeks

📊 Current State Analysis

What's Complete ✅

Infrastructure (Phase 0 - 100%):

  • GKE cluster operational: codi-poc-e2-cluster (us-central1-a)
  • FoundationDB running: 3-node StatefulSet (10.128.0.8:4500)
  • Domain/SSL: coditect.ai (34.8.51.57, Google-managed cert)
  • Artifact Registry: coditect repository (19.8GB)
  • JWT secret created
  • GCP service accounts configured

FoundationDB Backend (Phase 1 & 2 - 67% each):

  • 10 FDB Models implemented:
    • Tenant, User, AuthSession, workspaceSession (Phase 1)
    • Conversation, Message, Audit, File, Agent, Setting (Phase 2)
  • 11 FDB Repositories implemented:
    • All CRUD operations with multi-tenant isolation
    • 21 secondary indexes for efficient queries
    • JWT token family rotation
    • Soft delete pattern
    • Cross-session intelligence
  • Tests pending (0/14)

V5 Frontend (Complete):

  • React 18 + Vite wrapper deployed
  • 28 pages implemented
  • Header/Footer/layout components
  • Apple-quality design system
  • Production build: 1.2 MB dist/

theia IDE (Complete):

  • Eclipse theia 1.65 deployed
  • Custom "Coditect AI Agents" branding
  • Running at https://coditect.ai/

Cleanup (Complete):

  • Legacy services removed ($20-40/month savings)
  • Service routing documented

Critical Gaps ⚠️

Authentication (Phase 1 - 0/6 tasks):

  • No JWT authentication on theia endpoints → SECURITY RISK
  • No session context injection
  • No WebSocket authentication
  • theia accessible without login

File Persistence (Phase 2 - 0/8 tasks):

  • FDB running in memory-2 mode → DATA LOSS ON RESTART
  • Files not saved to FDB
  • No file system provider
  • Chat history not persisted

Multi-Tenancy (Phase 3 - 0/6 tasks):

  • No per-user workspace pods
  • All users share same container
  • No resource isolation
  • No dynamic routing

API Integration (Phase 3 - 0/27 tasks):

  • No auth handlers (register, login, refresh, logout)
  • No session handlers (7 endpoints)
  • No conversation handlers (4 endpoints)
  • No file handlers (5 endpoints)
  • No JWT middleware
  • No tenant isolation middleware

🔥 Critical Path to MVP

Dependency Chain

Phase 0 (Infrastructure) ✅ COMPLETE

Phase 1A: FDB Models & Repos ✅ COMPLETE (Oct 14)

Phase 1B: Backend API Deployment 🔴 BLOCKED (needs verification)

Phase 2: Authentication & JWT 🔴 CRITICAL (0/6)

Phase 3: FDB File Persistence 🔴 CRITICAL (0/8)

Phase 4: API Handlers 🟡 HIGH (0/18)

Phase 5: Multi-Tenancy 🟡 HIGH (0/6)

Phase 6: Production Hardening 🟢 MEDIUM (0/5)

MVP LAUNCH 🚀

🚨 Priority 1: CRITICAL (Must Fix Immediately)

Task 1: Verify Backend API Deployment Status

Time: 1 hour Blocker: October 7 deployment showed CrashLoopBackOff

Actions:

# Check current backend pod status
kubectl get pods -n coditect-app -l app=coditect-api-v5

# If pods crashing, get logs
kubectl logs -n coditect-app -l app=coditect-api-v5 --previous

# Test FDB connection from backend
kubectl exec -n coditect-app <POD_NAME> -- \
curl http://localhost:8080/api/v5/health

# Verify FDB storage engine
kubectl exec -n coditect-app foundationdb-0 -- \
fdbcli --exec "status"
# Expected: Storage engine should be "ssd-2" not "memory-2"

If Pods Still Crashing:

  • Fix FDB connection string in backend
  • Rebuild backend image with new FDB models/repos
  • Redeploy to GKE

Success Criteria:

  • Backend pods running (3/3 Ready)
  • /api/v5/health returns 200
  • FDB connection working

Task 2: Fix FoundationDB Storage Engine

Time: 30 minutes Priority: 🔴 CRITICAL Impact: Data lost on pod restart

Current Issue:

kubectl exec -n coditect-app foundationdb-0 -- fdbcli --exec "status"
# Output: Storage engine: memory-2 ← NOT PERSISTED

Fix:

# Backup data
kubectl exec -it -n coditect-app foundationdb-0 -- \
fdbbackup start -d file:///var/fdb/backups/backup-$(date +%Y%m%d)

# Reconfigure to SSD
kubectl exec -it -n coditect-app foundationdb-0 -- fdbcli
fdbcli> configure ssd
fdbcli> status
# Expected: Storage engine: ssd-2

# Test persistence
fdbcli> writemode on
fdbcli> set test-key test-value
fdbcli> get test-key # Should return: test-value

# Restart pod
kubectl delete pod foundationdb-0 -n coditect-app

# Wait and verify data persisted
kubectl wait --for=condition=ready pod/foundationdb-0 -n coditect-app --timeout=5m
kubectl exec -it -n coditect-app foundationdb-0 -- fdbcli
fdbcli> get test-key # Should still return: test-value

Success Criteria:

  • FDB running with ssd-2 storage engine
  • Data persists after pod restart
  • Backup created successfully

Files:

  • docs/reference/tasklist-full-integration.md - Task 2.1

Task 3: Implement JWT Authentication Middleware

Time: 1-2 days Priority: 🔴 CRITICAL Impact: theia currently has no authentication

What to Build:

  1. Rust JWT Middleware (backend/src/middleware/theia_auth.rs):

    • Extract JWT from Authorization header or query param
    • Verify JWT signature and expiration
    • Extract user_id, tenant_id, session_id from claims
    • Inject UserContext into request
  2. Update NGINX (nginx-combined.conf):

    • Pass Authorization header to backend
    • Pass to theia with /theia/?token=<JWT>
  3. V5 Frontend (src/components/theia-embed.tsx):

    • Pass JWT token to theia iframe
    • Handle token refresh

Implementation Guide:

  • See docs/reference/tasklist-full-integration.md - Task 1.1 (lines 140-346)
  • Complete Rust code provided
  • NGINX config provided
  • React component provided

Success Criteria:

  • Requests with valid JWT succeed
  • Requests with invalid/expired JWT return 401
  • Requests without JWT return 401
  • UserContext available in all handlers

Task 4: Implement WebSocket Authentication

Time: 1-2 days Priority: 🔴 CRITICAL Impact: terminal and LSP connections unauthenticated

What to Build:

  1. WebSocket Auth (backend/src/websocket/auth.rs):

    • Extract JWT from WebSocket upgrade request
    • Verify JWT before accepting connection
    • Tag connection with user context
  2. Frontend WebSocket Client:

    • Pass JWT token in WebSocket URL: wss://coditect.ai/ws?token=<JWT>

Implementation Guide:

  • See docs/reference/tasklist-full-integration.md - Task 1.3 (lines 477-611)
  • Complete Rust WebSocket auth code provided

Success Criteria:

  • WebSocket connections require valid JWT
  • Invalid JWT connections rejected
  • terminal WebSocket authenticated
  • LSP WebSocket authenticated

🔥 Priority 2: HIGH (Next Week)

Task 5: Implement FDB File System Provider

Time: 2-3 days Priority: 🟡 HIGH Impact: Files not saved, lost on restart

What to Build:

  1. theia FileSystemProvider (theia-custom/src/node/fdb-filesystem-provider.ts):

    • Implement read/write/delete operations
    • Store files in FDB with key: /{tenant_id}/session/{session_id}/files/{path}
    • Handle directory operations
    • Implement file watching
  2. FDB Client (theia-custom/src/node/fdb-client.ts):

    • Wrapper around FoundationDB Node.js bindings
    • get(), set(), delete(), getRange() methods

Implementation Guide:

  • See docs/reference/tasklist-full-integration.md - Task 2.2 (lines 939-1226)
  • Complete TypeScript code provided (1,200+ lines)

Success Criteria:

  • Files saved to FDB
  • Files persist after theia restart
  • File explorer works correctly
  • Performance < 50ms for file operations

Task 6: Implement 18 API Handlers

Time: 3-4 days Priority: 🟡 HIGH Impact: No REST API for frontend

What to Build:

  1. Auth Handlers (4 endpoints):

    • POST /api/v5/auth/register
    • POST /api/v5/auth/login
    • POST /api/v5/auth/refresh
    • POST /api/v5/auth/logout
  2. Session Handlers (7 endpoints):

    • POST /api/v5/sessions
    • GET /api/v5/sessions
    • GET /api/v5/sessions/:id
    • PUT /api/v5/sessions/:id
    • DELETE /api/v5/sessions/:id
    • POST /api/v5/sessions/:id/fork
    • GET /api/v5/sessions/related
  3. Conversation Handlers (4 endpoints):

    • POST /api/v5/conversations
    • GET /api/v5/conversations/:id
    • POST /api/v5/conversations/:id/messages
    • GET /api/v5/conversations/:id/messages
  4. User + Settings Handlers (6 endpoints):

    • GET /api/v5/users/me
    • PUT /api/v5/users/me
    • PUT /api/v5/users/me/password
    • GET /api/v5/settings
    • PUT /api/v5/settings/:category/:key
    • DELETE /api/v5/settings/:category/:key

Reference:

  • FDB models: backend/src/db/models.rs (943 lines)
  • FDB repositories: backend/src/db/repositories.rs (1,917 lines)
  • Checklist: docs/reference/fdb-models-implementation-checklist.md - Phase 3 (lines 226-271)

Success Criteria:

  • All endpoints return expected responses
  • Authorization enforced on all endpoints
  • Data persists in FDB
  • Error handling comprehensive

Task 7: Implement 4 Middleware Components

Time: 1 day Priority: 🟡 HIGH Impact: No security, rate limiting, or audit logging

What to Build:

  1. JWT Authentication Middleware: (already covered in Task 3)
  2. Tenant Isolation Middleware: Enforce tenant-level data access
  3. Rate Limiting Middleware: Prevent abuse (100 req/min per user)
  4. Audit Logging Middleware: Log all API calls to FDB

Files:

  • backend/src/middleware/tenant_isolation.rs
  • backend/src/middleware/rate_limit.rs
  • backend/src/middleware/audit_log.rs

Success Criteria:

  • Tenant isolation enforced
  • Rate limiting active
  • All API calls logged to FDB

🟢 Priority 3: MEDIUM (Week 3-4)

Task 8: Implement Per-User workspace Pods

Time: 2-3 days Priority: 🟢 MEDIUM Impact: No multi-tenancy, resource isolation

What to Build:

  1. workspace Pod Template (k8s-workspace-pod-template.yaml):

    • Define pod with resource limits
    • Environment variables: USER_ID, TENANT_ID, SESSION_ID, JWT_TOKEN
    • Resources: 2Gi-4Gi memory, 500m-2000m CPU
  2. Pod Provisioning Service (backend/src/services/pod_provisioning.rs):

    • provision_pod() - Create pod on demand
    • delete_pod() - Cleanup on logout
    • Track allocations in FDB
  3. Dynamic Routing (backend/src/middleware/workspace_router.rs):

    • Extract user context from JWT
    • Look up pod allocation in FDB
    • Proxy request to user's pod

Implementation Guide:

  • See docs/reference/tasklist-full-integration.md - Tasks 3.1, 3.2, 3.3 (lines 1820-2327)
  • Complete Rust code provided (1,800+ lines)
  • K8s manifests provided

Success Criteria:

  • Pods provisioned on demand
  • Requests routed to correct user pod
  • Resource isolation working
  • Pod creation < 60 seconds

Task 9: Production Hardening

Time: 5-7 days Priority: 🟢 MEDIUM Impact: Not production-ready

What to Build:

  1. Security Audit (2 days):

    • Audit JWT implementation
    • Audit FDB access controls
    • Run security scanning tools
    • Fix vulnerabilities
  2. Monitoring & Alerting (1-2 days):

    • Set up Prometheus metrics
    • Create Grafana dashboards
    • Configure alerting rules
  3. Backup & DR (1 day):

    • Automated FDB backups
    • Test restore procedure
    • Document DR plan
  4. Performance Testing (1-2 days):

    • Load test with 100 concurrent users
    • Identify bottlenecks
    • Optimize slow paths

Success Criteria:

  • No critical vulnerabilities
  • All metrics collected
  • Automated backups working
  • 95th percentile latency < 200ms

Week 1: Authentication & Deployment Verification

Day 1:

  • Task 1: Verify backend deployment (1 hour)
  • Task 2: Fix FDB storage engine (30 min)
  • Task 3: Start JWT middleware (6 hours)

Day 2-3:

  • Task 3: Complete JWT middleware (2 days)
  • Task 4: Start WebSocket auth (1 day)

Day 4-5:

  • Task 4: Complete WebSocket auth (1 day)
  • End-to-end auth testing

Week 2: File Persistence & API Handlers

Day 1-3:

  • Task 5: FDB file system provider (2-3 days)

Day 4-5:

  • Task 6: Implement API handlers (start)

Week 3: API Handlers & Middleware

Day 1-3:

  • Task 6: Complete API handlers (3-4 days)

Day 4-5:

  • Task 7: Implement middleware (1 day)
  • Integration testing

Week 4: Multi-Tenancy (Optional - can defer)

Day 1-3:

  • Task 8: Per-user workspace pods (2-3 days)

Day 4-5:

  • Integration testing
  • Bug fixes

Week 5-6: Production Hardening

Full Week:

  • Task 9: Security audit, monitoring, backup, perf testing (5-7 days)

🎯 Minimum Viable MVP (2-3 Week Path)

If timeline is critical, implement in this order:

Critical Path (16 days):

  1. Day 1: Verify deployment + Fix FDB storage (Tasks 1-2)
  2. Day 2-3: JWT middleware (Task 3)
  3. Day 4: WebSocket auth (Task 4)
  4. Day 5-7: FDB file system (Task 5)
  5. Day 8-11: API handlers (Task 6)
  6. Day 12: Middleware (Task 7)
  7. Day 13-16: Production hardening essentials:
    • Security audit (2 days)
    • Basic monitoring (1 day)
    • Backup setup (1 day)

Deferred to Post-MVP:

  • Per-user workspace pods (Task 8)
  • Advanced monitoring
  • Performance optimization

📁 Key Documentation References

Implementation Guides (Read These!)

  1. tasklist-full-integration.md (2,694 lines)

    • Complete implementation guide with code
    • 29 tasks across 4 phases
    • Rust, TypeScript, NGINX, K8s examples
    • Location: docs/reference/tasklist-full-integration.md
  2. fdb-models-implementation-checklist.md (353 lines)

    • 128 detailed tasks
    • Phase 1 & 2 complete
    • Phase 3 pending (27 tasks)
    • Location: docs/reference/fdb-models-implementation-checklist.md
  3. corrected-execution-order.md (387 lines)

    • 7-phase execution plan
    • Frontend-first approach
    • Dependencies clearly mapped
    • Location: docs/10-execution-plans/corrected-execution-order.md
  4. deployment-step-by-step-tracker.md (465 lines)

    • Historical deployment tracker (Oct 7)
    • Pod crash troubleshooting
    • Status: May be outdated after Oct 14 FDB work
    • Location: docs/10-execution-plans/deployment-step-by-step-tracker.md

Code References

Backend (Rust):

  • Models: backend/src/db/models.rs (943 lines)
  • Repositories: backend/src/db/repositories.rs (1,917 lines)
  • Total: 2,860 lines of FDB code

Frontend (React):

  • theiaEmbed: src/components/theia-embed.tsx
  • Auth Store: src/stores/auth-store.ts
  • Session Service: src/services/session-service.ts

Infrastructure (K8s):

  • Backend Deployment: k8s-deployment.yaml
  • FDB StatefulSet: k8s-foundationdb-statefulset.yaml
  • Ingress: k8s-ingress.yaml

🚀 Parallelization Strategy

2-Person Team

Developer 1 (Backend):

  • Week 1: Tasks 1-4 (Auth + WebSocket)
  • Week 2-3: Task 6 (API handlers)
  • Week 4: Task 7 (Middleware)

Developer 2 (Full-Stack):

  • Week 1: Task 2 (FDB storage) + Task 5 start
  • Week 2: Task 5 complete (File system)
  • Week 3: Task 8 (Multi-tenancy)
  • Week 4: Task 9 (Hardening)

Timeline: 3-4 weeks

4-Person Team

Developer 1 (Backend - Auth):

  • Tasks 1-4 (Auth + WebSocket) - Week 1

Developer 2 (Backend - API):

  • Task 6 (API handlers) - Week 2

Developer 3 (Full-Stack - FDB):

  • Tasks 2, 5 (FDB storage + File system) - Week 1-2

Developer 4 (DevOps/Security):

  • Task 7 (Middleware) - Week 2
  • Task 9 (Hardening) - Week 3

Timeline: 2-3 weeks


✅ Success Metrics

MVP Launch Criteria

Functional:

  • User can register account
  • User can login with JWT
  • theia IDE loads with authentication
  • Files saved to FDB and persist
  • Sessions tracked in FDB
  • WebSocket connections authenticated
  • API endpoints functional

Technical:

  • FDB running with ssd-2 storage
  • Backend pods healthy (3/3)
  • JWT authentication enforced
  • No critical security vulnerabilities
  • Data persists across restarts

Performance:

  • Page load < 3 seconds
  • API response < 200ms (p95)
  • File operations < 50ms
  • Support 10+ concurrent users

Operational:

  • Automated backups configured
  • Basic monitoring in place
  • Runbook documented
  • Rollback procedure tested

Checklists:

  • FDB Models: docs/reference/fdb-models-implementation-checklist.md
  • Full Integration: docs/reference/tasklist-full-integration.md
  • Deployment Tracker: docs/10-execution-plans/deployment-step-by-step-tracker.md

Implementation Summaries:

  • Phase 1: docs/reference/phase-1-implementation-summary.md
  • Phase 2: docs/reference/phase-2-implementation-summary.md

Architecture:

  • System Design: docs/DEFINITIVE-V5-architecture.md
  • Design System: docs/apple-quality-design-system.md
  • Execution Order: docs/10-execution-plans/corrected-execution-order.md

Generated: 2025-10-14 Last Updated: 2025-10-14 Next Review: After Task 1 completion (backend verification) Status: 🔴 CRITICAL - Authentication Required