Optimal Execution Order - Dependency Analysis
Date: 2025-10-06 Purpose: Determine optimal task execution order based on hard dependencies
🔗 Dependency Graph
FOUNDATION LAYER (No dependencies - start immediately)
├── 1. FoundationDB Schema & Models ← ALREADY DONE ✅
├── 2. JWT Secret Management
└── 3. GCP Service Account Setup
AUTHENTICATION LAYER (Depends on Foundation)
├── 4. JWT Generation + Validation Middleware (needs: 1, 2)
├── 5. Session Storage in FDB (needs: 1)
└── 6. Auth Endpoints (Login/Register) (needs: 1, 4, 5)
POD INFRASTRUCTURE (Depends on Foundation)
├── 7. workspace Pod Template with CODI2 (needs: 1)
├── 8. Pod Provisioning Service (needs: 1, 3)
└── 9. WebSocket Sidecar Pattern (needs: 7)
THEIA INTEGRATION (Depends on Auth + Pod)
├── 10. theia Container Build (needs: none - can start early)
├── 11. V4 Wrapper (Header/Footer) (needs: 10)
├── 12. theia Deployment to GKE (needs: 10, 4, 5, 6, 8, 9)
└── 13. Session Management in theia (needs: 5, 12)
KNOWLEDGE BASE (Can be parallel with theia)
├── 14. Cloud Storage Bucket (needs: 3)
├── 15. Vertex AI Embeddings Setup (needs: 3)
├── 16. Coditect Server Build (needs: 1, 14, 15)
└── 17. Documentation Indexing (needs: 16)
FINAL INTEGRATION
├── 18. End-to-End Testing (needs: all above)
├── 19. Blue-Green Deployment (needs: 18)
└── 20. Traffic Migration (needs: 19)
📋 Optimal Execution Order
PHASE 0: Pre-requisites (Day 1) ✅ MOSTLY DONE
Status: Foundation layer exists, just needs validation
| Step | Task | Status | Dependencies | Time |
|---|---|---|---|---|
| 0.1 | Verify FoundationDB cluster | ✅ DONE | None | - |
| 0.2 | Verify FDB schema (tenant/user/session) | ✅ DONE | None | - |
| 0.3 | Create JWT secret in Kubernetes | ⏳ TODO | None | 15min |
| 0.4 | Create GCP service account | ⏳ TODO | None | 15min |
| 0.5 | Grant Vertex AI permissions | ⏳ TODO | 0.4 | 15min |
Commands:
# 0.3 - Create JWT secret
kubectl create secret generic jwt-secret \
--from-literal=secret=$(openssl rand -base64 32) \
-n coditect-app
# 0.4 - Create service account
gcloud iam service-accounts create coditect-server \
--display-name="Coditect Server" \
--project=serene-voltage-464305-n2
# 0.5 - Grant permissions
gcloud projects add-iam-policy-binding serene-voltage-464305-n2 \
--member="serviceAccount:coditect-server@serene-voltage-464305-n2.iam.gserviceaccount.com" \
--role="roles/aiplatform.user"
PHASE 1: Authentication Foundation (Days 1-2)
Goal: Get JWT + FDB session management working Blockers: None (depends only on Phase 0)
| Step | Task | Dependencies | Time | Priority |
|---|---|---|---|---|
| 1.1 | Create JWT middleware with FDB lookup | 0.1, 0.2, 0.3 | 4h | 🔴 CRITICAL |
| 1.2 | Implement session storage on login | 0.1, 0.2 | 2h | 🔴 CRITICAL |
| 1.3 | Update Auth endpoints (login/register) | 1.1, 1.2 | 3h | 🔴 CRITICAL |
| 1.4 | Add session expiration logic | 1.1, 1.2 | 2h | 🟡 HIGH |
| 1.5 | Create session cleanup CronJob | 1.4 | 1h | 🟡 HIGH |
Why First: Auth is the foundation for everything else. Without working JWT + sessions, pods can't be provisioned securely.
Deliverable: JWT validation with FDB session storage working end-to-end
PHASE 2: WebSocket Fix (Days 2-3)
Goal: Fix WebSocket pod communication using sidecar pattern Blockers: None (can start immediately in parallel with Phase 1)
| Step | Task | Dependencies | Time | Priority |
|---|---|---|---|---|
| 2.1 | Create WebSocket sidecar container | None | 3h | 🔴 CRITICAL |
| 2.2 | Update workspace pod template | 2.1 | 2h | 🔴 CRITICAL |
| 2.3 | Test localhost communication | 2.2 | 1h | 🔴 CRITICAL |
| 2.4 | Deploy to test namespace | 2.3 | 1h | 🟡 HIGH |
| 2.5 | Update frontend WebSocket client | 2.4 | 2h | 🟡 HIGH |
Why Second: Enables real-time communication, needed for theia IDE
Deliverable: WebSocket connections working between frontend and workspace pods
PHASE 3: Pod Provisioning (Days 3-4)
Goal: Auto-provision user workspace pods on registration Blockers: Needs Phase 1 (auth/sessions) to be complete
| Step | Task | Dependencies | Time | Priority |
|---|---|---|---|---|
| 3.1 | Create CODI2-enabled workspace pod template | None | 2h | 🟡 HIGH |
| 3.2 | Build pod provisioning service | 1.3, 3.1 | 4h | 🔴 CRITICAL |
| 3.3 | Integrate with registration flow | 1.3, 3.2 | 2h | 🔴 CRITICAL |
| 3.4 | Add pod info to FDB session | 1.2, 3.3 | 1h | 🔴 CRITICAL |
| 3.5 | Test pod lifecycle (create/delete) | 3.4 | 2h | 🟡 HIGH |
Why Third: Pods need auth to know which user they belong to
Deliverable: User registers → Pod auto-created with CODI2
PHASE 4: theia Build & Deploy (Days 4-6)
Goal: Deploy theia IDE wrapped in V4 layout Blockers: Needs Phase 1, 2, 3 (auth, websocket, pods)
| Step | Task | Dependencies | Time | Priority |
|---|---|---|---|---|
| 4.1 | Build theia base container | None | 3h | 🔴 CRITICAL |
| 4.2 | Create V4 wrapper (Header/Footer/layout) | None | 4h | 🟡 HIGH |
| 4.3 | Build theia with V4 wrapper | 4.1, 4.2 | 2h | 🔴 CRITICAL |
| 4.4 | Create Kubernetes deployment | 4.3 | 2h | 🔴 CRITICAL |
| 4.5 | Update ingress for /ide route | 4.4 | 1h | 🟡 HIGH |
| 4.6 | Connect theia to auth system | 1.3, 4.5 | 3h | 🔴 CRITICAL |
| 4.7 | Connect theia to user pods | 2.5, 3.4, 4.6 | 3h | 🔴 CRITICAL |
| 4.8 | Implement session management | 1.2, 4.7 | 4h | 🔴 CRITICAL |
Why Fourth: theia is the main UI, needs all infrastructure ready
Deliverable: theia IDE accessible at https://coditect.ai/ide with user pods
PHASE 5: Knowledge Base (Days 5-7) - PARALLEL WITH PHASE 4
Goal: Deploy Coditect Server with Knowledge Base as a Service Blockers: Needs Phase 0 (GCP service account)
| Step | Task | Dependencies | Time | Priority |
|---|---|---|---|---|
| 5.1 | Create Cloud Storage bucket | 0.4 | 15min | 🟡 HIGH |
| 5.2 | Build Coditect Server container | 0.1, 0.5 | 6h | 🟡 HIGH |
| 5.3 | Deploy to GKE | 5.2 | 1h | 🟡 HIGH |
| 5.4 | Index V4 documentation | 5.3 | 3h | 🟢 MEDIUM |
| 5.5 | Create agent coordination endpoints | 5.3 | 4h | 🟢 MEDIUM |
Why Parallel: Knowledge base doesn't block theia, can be done in parallel
Deliverable: Coditect Server deployed with indexed documentation
PHASE 6: Integration & Testing (Days 7-8)
Goal: End-to-end testing and bug fixes Blockers: Needs all previous phases
| Step | Task | Dependencies | Time | Priority |
|---|---|---|---|---|
| 6.1 | Test full user flow (register → pod → theia) | 1-5 | 3h | 🔴 CRITICAL |
| 6.2 | Test multi-session switching | 4.8 | 2h | 🔴 CRITICAL |
| 6.3 | Test WebSocket real-time features | 2.5, 4.7 | 2h | 🔴 CRITICAL |
| 6.4 | Test knowledge base retrieval | 5.4 | 1h | 🟡 HIGH |
| 6.5 | Load testing (100 concurrent users) | 6.1 | 3h | 🟡 HIGH |
| 6.6 | Fix bugs and performance issues | 6.5 | 4h | 🔴 CRITICAL |
Deliverable: Stable V5 system ready for deployment
PHASE 7: Blue-Green Deployment (Days 8-10)
Goal: Deploy V5 alongside V4, gradual traffic migration Blockers: Needs Phase 6 (testing complete)
| Step | Task | Dependencies | Time | Priority |
|---|---|---|---|---|
| 7.1 | Deploy V5 as separate service (v5-ide) | 6.6 | 1h | 🔴 CRITICAL |
| 7.2 | Configure canary ingress (10% traffic) | 7.1 | 1h | 🔴 CRITICAL |
| 7.3 | Monitor metrics (24 hours) | 7.2 | - | 🔴 CRITICAL |
| 7.4 | Increase to 50% traffic | 7.3 | 15min | 🟡 HIGH |
| 7.5 | Monitor metrics (48 hours) | 7.4 | - | 🔴 CRITICAL |
| 7.6 | Increase to 100% traffic | 7.5 | 15min | 🔴 CRITICAL |
| 7.7 | Decommission V4 frontend | 7.6 | 1h | 🟢 MEDIUM |
Deliverable: V5 serving 100% production traffic
⚡ Parallel Execution Opportunities
Day 1-2
Can Run in Parallel:
- Phase 0 (pre-requisites) - 1 person
- Phase 1 (auth) - 1 person
- Phase 2 (WebSocket) - 1 person
- Phase 4.1-4.2 (theia base build) - 1 person
Day 3-4
Can Run in Parallel:
- Phase 3 (pod provisioning) - 1 person
- Phase 4.3-4.5 (theia deploy) - 1 person
- Phase 5.1-5.2 (knowledge base build) - 1 person
Day 5-6
Can Run in Parallel:
- Phase 4.6-4.8 (theia integration) - 1 person
- Phase 5.3-5.5 (knowledge base deploy) - 1 person
Day 7-8
Sequential (needs testing):
- Phase 6 (integration testing) - all hands
Day 8-10
Sequential (gradual rollout):
- Phase 7 (blue-green deployment) - all hands
🚀 Recommended Execution Plan
Option A: 2-Person Team (10 days)
Person 1 (Backend/Infra):
- Day 1-2: Phase 0, Phase 1 (auth)
- Day 3-4: Phase 3 (pod provisioning)
- Day 5-6: Phase 4.6-4.8 (theia backend integration)
- Day 7-8: Phase 6 (testing)
- Day 8-10: Phase 7 (deployment)
Person 2 (Frontend/Services):
- Day 1-2: Phase 2 (WebSocket), Phase 4.1-4.2 (theia base)
- Day 3-4: Phase 4.3-4.5 (theia frontend)
- Day 5-6: Phase 5 (knowledge base)
- Day 7-8: Phase 6 (testing)
- Day 8-10: Phase 7 (deployment)
Total: 10 days with 2 people
Option B: 4-Person Team (6 days)
Person 1 (Auth):
- Day 1-2: Phase 0, Phase 1 (auth)
- Day 3-6: Support testing and deployment
Person 2 (WebSocket/Pods):
- Day 1-2: Phase 2 (WebSocket)
- Day 3-4: Phase 3 (pod provisioning)
- Day 5-6: Support testing
Person 3 (theia):
- Day 1-2: Phase 4.1-4.2 (theia base)
- Day 3-4: Phase 4.3-4.5 (theia deploy)
- Day 5-6: Phase 4.6-4.8 (theia integration)
Person 4 (Knowledge Base):
- Day 1-2: Phase 5.1-5.2 (build)
- Day 3-4: Phase 5.3-5.5 (deploy & index)
- Day 5-6: Support testing
All Together:
- Day 5-6: Phase 6 (integration testing)
- Day 6: Phase 7 (deployment)
Total: 6 days with 4 people
Option C: Solo Developer (20 days)
Week 1 (Days 1-5):
- Day 1: Phase 0 (pre-requisites)
- Day 2: Phase 1 (auth)
- Day 3: Phase 2 (WebSocket)
- Day 4: Phase 3 (pod provisioning)
- Day 5: Phase 4.1-4.3 (theia base build)
Week 2 (Days 6-10):
- Day 6: Phase 4.4-4.5 (theia deploy)
- Day 7: Phase 4.6-4.7 (theia auth integration)
- Day 8: Phase 4.8 (session management)
- Day 9: Phase 5.1-5.3 (knowledge base build & deploy)
- Day 10: Phase 5.4-5.5 (indexing & agents)
Week 3 (Days 11-15):
- Day 11-12: Phase 6 (integration testing)
- Day 13-15: Phase 7 (blue-green deployment)
Week 4 (Days 16-20):
- Buffer for bug fixes and optimization
Total: 15-20 days solo
📊 Critical Path Analysis
Longest Dependency Chain (Critical Path):
Phase 0 (Day 1: 45min)
↓
Phase 1 (Day 1-2: 11h)
↓
Phase 3 (Day 3-4: 11h)
↓
Phase 4.6-4.8 (Day 5-6: 10h)
↓
Phase 6 (Day 7-8: 15h)
↓
Phase 7 (Day 8-10: monitoring + rollout)
Critical Path Duration: ~7-8 days minimum (with perfect execution)
Parallelizable Work (Off Critical Path):
- Phase 2 (WebSocket) - 9h (can be parallel with Phase 1)
- Phase 4.1-4.5 (theia base) - 12h (can be parallel with Phase 1-3)
- Phase 5 (Knowledge Base) - 14h (can be parallel with Phase 4)
Total Work: ~72 hours (~9 days for 1 person, ~5 days for 2 people)
✅ Recommended Order (Fastest)
Day 1 (Foundation):
- ✅ Phase 0: Pre-requisites (45min)
- ✅ Phase 1: Auth (4h) + Phase 2: WebSocket (3h) [PARALLEL]
- ✅ Phase 4.1: Build theia base (3h) [PARALLEL]
Day 2 (Auth + Base): 4. ✅ Phase 1 cont.: Session management (5h) 5. ✅ Phase 2 cont.: WebSocket deploy & test (6h) [PARALLEL] 6. ✅ Phase 4.2: V4 wrapper (4h) [PARALLEL]
Day 3 (Pods): 7. ✅ Phase 3: Pod provisioning (11h) 8. ✅ Phase 4.3: theia with wrapper (2h) [PARALLEL]
Day 4 (theia Deploy): 9. ✅ Phase 4.4-4.5: Deploy theia (3h) 10. ✅ Phase 5.1-5.2: Build knowledge base (6h) [PARALLEL]
Day 5 (Integration): 11. ✅ Phase 4.6-4.8: theia integration (10h) 12. ✅ Phase 5.3-5.5: Deploy & index knowledge (8h) [PARALLEL]
Day 6 (Testing): 13. ✅ Phase 6: Integration testing & bug fixes (15h)
Day 7-9 (Deployment): 14. ✅ Phase 7: Blue-green rollout (10% → 50% → 100%)
Total: 7-9 days (fastest possible)
🎯 Summary
Fastest Path: 7-9 days (with 2-4 people, good parallelization) Solo Path: 15-20 days (sequential, with buffer) Critical Blockers: Phase 1 (Auth) → Phase 3 (Pods) → Phase 4 (theia)
Key Insight: Auth + Sessions (Phase 1) is the bottleneck - everything depends on it. Focus resources there first.