Skip to main content

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

StepTaskStatusDependenciesTime
0.1Verify FoundationDB cluster✅ DONENone-
0.2Verify FDB schema (tenant/user/session)✅ DONENone-
0.3Create JWT secret in Kubernetes⏳ TODONone15min
0.4Create GCP service account⏳ TODONone15min
0.5Grant Vertex AI permissions⏳ TODO0.415min

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)

StepTaskDependenciesTimePriority
1.1Create JWT middleware with FDB lookup0.1, 0.2, 0.34h🔴 CRITICAL
1.2Implement session storage on login0.1, 0.22h🔴 CRITICAL
1.3Update Auth endpoints (login/register)1.1, 1.23h🔴 CRITICAL
1.4Add session expiration logic1.1, 1.22h🟡 HIGH
1.5Create session cleanup CronJob1.41h🟡 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)

StepTaskDependenciesTimePriority
2.1Create WebSocket sidecar containerNone3h🔴 CRITICAL
2.2Update workspace pod template2.12h🔴 CRITICAL
2.3Test localhost communication2.21h🔴 CRITICAL
2.4Deploy to test namespace2.31h🟡 HIGH
2.5Update frontend WebSocket client2.42h🟡 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

StepTaskDependenciesTimePriority
3.1Create CODI2-enabled workspace pod templateNone2h🟡 HIGH
3.2Build pod provisioning service1.3, 3.14h🔴 CRITICAL
3.3Integrate with registration flow1.3, 3.22h🔴 CRITICAL
3.4Add pod info to FDB session1.2, 3.31h🔴 CRITICAL
3.5Test pod lifecycle (create/delete)3.42h🟡 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)

StepTaskDependenciesTimePriority
4.1Build theia base containerNone3h🔴 CRITICAL
4.2Create V4 wrapper (Header/Footer/layout)None4h🟡 HIGH
4.3Build theia with V4 wrapper4.1, 4.22h🔴 CRITICAL
4.4Create Kubernetes deployment4.32h🔴 CRITICAL
4.5Update ingress for /ide route4.41h🟡 HIGH
4.6Connect theia to auth system1.3, 4.53h🔴 CRITICAL
4.7Connect theia to user pods2.5, 3.4, 4.63h🔴 CRITICAL
4.8Implement session management1.2, 4.74h🔴 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)

StepTaskDependenciesTimePriority
5.1Create Cloud Storage bucket0.415min🟡 HIGH
5.2Build Coditect Server container0.1, 0.56h🟡 HIGH
5.3Deploy to GKE5.21h🟡 HIGH
5.4Index V4 documentation5.33h🟢 MEDIUM
5.5Create agent coordination endpoints5.34h🟢 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

StepTaskDependenciesTimePriority
6.1Test full user flow (register → pod → theia)1-53h🔴 CRITICAL
6.2Test multi-session switching4.82h🔴 CRITICAL
6.3Test WebSocket real-time features2.5, 4.72h🔴 CRITICAL
6.4Test knowledge base retrieval5.41h🟡 HIGH
6.5Load testing (100 concurrent users)6.13h🟡 HIGH
6.6Fix bugs and performance issues6.54h🔴 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)

StepTaskDependenciesTimePriority
7.1Deploy V5 as separate service (v5-ide)6.61h🔴 CRITICAL
7.2Configure canary ingress (10% traffic)7.11h🔴 CRITICAL
7.3Monitor metrics (24 hours)7.2-🔴 CRITICAL
7.4Increase to 50% traffic7.315min🟡 HIGH
7.5Monitor metrics (48 hours)7.4-🔴 CRITICAL
7.6Increase to 100% traffic7.515min🔴 CRITICAL
7.7Decommission V4 frontend7.61h🟢 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

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)


Day 1 (Foundation):

  1. ✅ Phase 0: Pre-requisites (45min)
  2. ✅ Phase 1: Auth (4h) + Phase 2: WebSocket (3h) [PARALLEL]
  3. ✅ 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.