Skip to main content

project-cloud-ide-docs-v4-imports-and-integration-analysis


title: V4 Imports and Integration Analysis type: reference component_type: reference version: 1.0.0 created: '2025-12-27' updated: '2025-12-27' status: active tags:

  • ai-ml
  • authentication
  • deployment
  • security
  • testing
  • api
  • architecture
  • automation summary: 'V4 Imports and Integration Analysis Date: 2025-10-06 Purpose: Analyze v4 dependencies and plan v4β†’v5 consolidation for MVP/beta Critical Components for V5 MVP Status Integration Path --------------------- βœ… Built & functional Compile locally, deploy...' moe_confidence: 0.950 moe_classified: 2025-12-31

V4 Imports and Integration Analysis

Date: 2025-10-06 Purpose: Analyze v4 dependencies and plan v4β†’v5 consolidation for MVP/beta


🎯 Executive Summary​

Critical Components for V5 MVP​

ComponentStatusPriorityIntegration Path
CODI2 Binaryβœ… Built & functionalCRITICALCompile locally, deploy to GKE pods
API v2 (Rust/Axum)βœ… Production readyHIGHAuth/user management integration
workspace Podsβœ… GKE deployedHIGHSession management per user
Frontend (React)βœ… RunningHIGHMerge with theia IDE UI
FoundationDBβœ… GKE clusterCRITICALMulti-tenant data layer
WebSocket Gatewayβœ… ImplementedHIGHReal-time IDE communication

πŸ“¦ Rust Dependencies Analysis​

1. CODI2 (File Monitor & Audit Logger)​

Location: coditect-v4/codi2/

Critical Dependencies:

[dependencies]
# Core
tokio = { version = "1.0", features = ["macros", "rt-multi-thread", "fs", "sync", "time", "signal", "io-util", "process"] }
foundationdb = { version = "0.9", features = ["fdb-7_1"] }

# File monitoring
notify = "6.1"
sha2 = "0.10"
blake3 = "1.5"

# WebSocket/HTTP (for syncing to central server)
axum = { version = "0.7", features = ["ws", "macros"] }
tokio-tungstenite = { version = "0.24", features = ["native-tls"] }

# Serialization
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"

Build Requirements:

# System dependencies
apt-get install -y clang libclang-dev cmake wget ca-certificates

# FoundationDB client library
wget https://github.com/apple/foundationdb/releases/download/7.1.61/foundationdb-clients_7.1.61-1_amd64.deb
dpkg -i foundationdb-clients_7.1.61-1_amd64.deb

Binary Output:

  • Compiled size: ~16MB
  • Deployment target: GKE user pods (1 per user)
  • Purpose: File system monitoring + audit logging to FDB

Integration Tasks:

  • Set up local Rust build environment
  • Compile CODI2 binary
  • Test with t2 FoundationDB connection
  • Create Dockerfile with CODI2
  • Deploy to GKE test pod

2. API v2 (Authentication & User Management)​

Location: src/v4-api-v2/

Critical Dependencies:

[dependencies]
# Web framework
actix-web = "4.4"
actix-cors = "0.6"
actix-ws = "0.2"

# Auth
jsonwebtoken = "9.1"
argon2 = "0.5" # Password hashing

# Database
foundationdb = { version = "0.9", features = ["fdb-7_1"] }

# Kubernetes integration
k8s-openapi = { version = "0.20", features = ["v1_28"] }
kube = { version = "0.87", features = ["runtime", "derive"] }

Key Features:

  • JWT-based authentication
  • User/tenant management
  • workspace provisioning
  • Pod auto-deployment (GKE)

Integration Tasks:

  • Extract auth module from v4
  • Integrate with theia authentication
  • Connect to t2 FoundationDB
  • Test user registration flow
  • Test JWT validation

3. workspace Pod (Per-User Container)​

Location: src/v4-workspace-pod/Dockerfile

Architecture:

# Multi-stage build
FROM rust:1.87-slim AS codi2-builder
# Build CODI2 binary

FROM ubuntu:22.04
# Install FoundationDB client
# Install core dev tools (git, vim, tmux)
# Copy CODI2 binary
# Create user workspace

Pod Features:

  • Isolated per user
  • CODI2 monitoring built-in
  • FoundationDB client
  • Persistent volume at /workspace

Integration Tasks:

  • Build workspace pod image
  • Test with CODI2 monitoring
  • Connect to t2 FDB cluster
  • Create GKE deployment template
  • Test session management integration

🌐 Frontend Dependencies Analysis​

Location: src/frontend-original/

Package.json (likely contains):

{
"dependencies": {
"react": "^18.x",
"react-router-dom": "^6.x",
"axios": "^1.x",
"@monaco-editor/react": "^4.x",
"xterm": "^5.x",
"socket.io-client": "^4.x"
}
}

Key Components to Merge:

  1. Authentication UI (Login/Register forms)
  2. User Management (Profile, settings)
  3. WebSocket Connection (Real-time updates)
  4. File Browser (If better than theia's)

Integration Tasks:

  • Analyze v4 React components
  • Extract reusable UI components
  • Port auth forms to theia widgets
  • Integrate WebSocket client
  • Test with t2 theia IDE

πŸ—„οΈ FoundationDB Schema Analysis​

Current V4 Models (from ADRs):

Core Tables​

// User Management
tenant_id/user:{user_id} β†’ User
tenant_id/license:{license_id} β†’ License
tenant_id/workspace:{workspace_id} β†’ workspace

// Session Management
tenant_id/session:{session_id} β†’ Session
tenant_id/session_file:{session_id}:{file_path} β†’ FileState

// Audit Logging
tenant_id/audit:{timestamp}:{event_id} β†’ AuditEvent
tenant_id/file_change:{file_path}:{timestamp} β†’ FileChange

Multi-Tenant Pattern​

Key Format: tenant_id/namespace/identifier
Example: abc123/user/usr-001
abc123/workspace/wks-xyz
abc123/audit/2025-10-06T12:00:00Z/evt-123

Integration Tasks:

  • Study v4 FDB key schema (ADR-002, ADR-003)
  • Create FDB service adapter for t2
  • Implement tenant isolation
  • Port session storage logic
  • Port audit logging patterns

πŸ” Authentication & Authorization Flow​

V4 Current Flow (from src/v4-api-v2):

1. User Registration
β”œβ”€> POST /api/v2/auth/register
β”œβ”€> Validate email/password
β”œβ”€> Hash password (Argon2)
β”œβ”€> Store in FDB: tenant_id/user:{user_id}
β”œβ”€> Create workspace pod (Kubernetes)
└─> Return JWT token

2. User Login
β”œβ”€> POST /api/v2/auth/login
β”œβ”€> Verify password hash
β”œβ”€> Generate JWT (jsonwebtoken)
β”œβ”€> Store session in FDB
└─> Return token + user data

3. WebSocket Auth
β”œβ”€> Client connects with JWT in query
β”œβ”€> Server validates JWT
β”œβ”€> Attach session to WebSocket
└─> Enable real-time communication

4. Pod Provisioning (on registration)
β”œβ”€> Create Kubernetes namespace: user-{user_id}
β”œβ”€> Deploy workspace pod from template
β”œβ”€> Attach PersistentVolume (50GB)
β”œβ”€> Inject CODI2 config
β”œβ”€> Start CODI2 monitoring
└─> Store pod info in FDB

Integration Tasks:

  • Extract auth handlers from v4 API
  • Integrate with theia backend
  • Test JWT flow end-to-end
  • Implement WebSocket auth
  • Test pod auto-provisioning

☸️ GKE E2 Pod Integration​

Current V4 Setup (from CLAUDE.md):

# GKE Cluster
Cluster: codi-poc-e2-cluster
Zone: us-central1-a
Namespace: coditect-app

# Services Running
- coditect-frontend (React app)
- coditect-api-v2 (Rust API)
- foundationdb (StatefulSet, 3 nodes)
- fdb-proxy (HAProxy for load balancing)

# User workspace Pods (per user)
- Namespace: user-{user_id}
- Image: gcr.io/.../workspace-pod:v1
- Volume: 50GB PersistentVolume
- Monitoring: CODI2 binary inside pod

Pod Auto-Provisioning Logic (Rust code):

// From src/v4-api-v2/src/main.rs
use kube::{Client, Api};
use k8s_openapi::api::core::v1::{Pod, Namespace, PersistentVolumeClaim};

async fn provision_user_pod(user_id: &str) -> Result<()> {
let client = Client::try_default().await?;

// 1. Create namespace
let ns_api: Api<Namespace> = Api::all(client.clone());
ns_api.create(&PostParams::default(), &namespace_spec).await?;

// 2. Create PVC
let pvc_api: Api<PersistentVolumeClaim> = Api::namespaced(client.clone(), ns_name);
pvc_api.create(&PostParams::default(), &pvc_spec).await?;

// 3. Deploy pod
let pod_api: Api<Pod> = Api::namespaced(client.clone(), ns_name);
pod_api.create(&PostParams::default(), &pod_spec).await?;

Ok(())
}

Integration Tasks:

  • Extract pod provisioning code
  • Test with t2 GKE cluster
  • Update pod template for theia
  • Integrate with session management
  • Test full user registration β†’ pod creation flow

πŸ”„ Session Management Integration​

V4 Session Architecture:

// Session stored in FDB
interface Session {
sessionId: string;
userId: string;
tenantId: string;
workspaceId: string;
podNamespace: string;
podName: string;
createdAt: string;
lastAccessAt: string;
status: 'active' | 'suspended' | 'terminated';
}

// Session-to-Pod mapping
tenant_id/session:{session_id} β†’ {
userId: "usr-123",
podNamespace: "user-usr-123",
podName: "workspace",
websocketConnected: true,
files: ["file1.ts", "file2.rs"],
agents: ["code-gen", "code-review"]
}

Integration Tasks:

  • Port session model to t2
  • Connect sessions to theia tabs
  • Map session to user pod
  • Implement session lifecycle
  • Test multi-session isolation

πŸš€ V4 β†’ V5 Migration Roadmap​

Phase 1: Local CODI2 Build (Week 1)​

Goal: Compile CODI2 binary locally

  1. Setup Rust Environment

    # Install Rust
    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

    # Install system deps
    sudo apt-get install clang libclang-dev cmake

    # Install FDB client
    wget https://github.com/apple/foundationdb/releases/download/7.1.61/foundationdb-clients_7.1.61-1_amd64.deb
    sudo dpkg -i foundationdb-clients_7.1.61-1_amd64.deb
  2. Build CODI2

    cd coditect-v4/codi2
    cargo build --release

    # Test binary
    ./target/release/codi2 --version
    ./target/release/codi2 test
  3. Test with T2 FDB

    export FDB_CLUSTER_FILE=/workspace/PROJECTS/t2/docs/v4-config/fdb.cluster
    ./target/release/codi2 test

Deliverables:

  • CODI2 binary compiled
  • Connected to t2 FDB
  • Basic monitoring tested

Phase 2: Authentication Integration (Week 2)​

Goal: Merge v4 auth with theia

  1. Extract Auth Code

    # Copy auth handlers
    cp -r src/v4-api-v2/src/handlers/auth src/services/auth

    # Extract models
    cp -r src/v4-api-v2/src/models/user src/types/
  2. Create theia Auth Service

    // src/services/auth-service.ts
    @injectable()
    export class AuthService {
    constructor(
    @inject(FDBService) private fdb: FDBService
    ) {}

    async register(email: string, password: string): Promise<User> {
    // Port v4 registration logic
    }

    async login(email: string, password: string): Promise<JWT> {
    // Port v4 login logic
    }
    }
  3. Create Auth UI Widgets

    // src/browser/auth-widget/login-widget.tsx
    export class LoginWidget extends ReactWidget {
    // Port v4 login form
    }

Deliverables:

  • Auth service in theia
  • Login/Register UI
  • JWT generation working
  • FDB user storage tested

Phase 3: workspace Pod Deployment (Week 3)​

Goal: Auto-provision GKE pods for users

  1. Build workspace Pod Image

    cd src/v4-workspace-pod
    docker build -t gcr.io/PROJECT_ID/t2-workspace-pod:v1 .
    docker push gcr.io/PROJECT_ID/t2-workspace-pod:v1
  2. Create Pod Provisioning Service

    // src/services/pod-provisioning-service.ts
    @injectable()
    export class PodProvisioningService {
    async createUserPod(userId: string): Promise<PodInfo> {
    // Port v4 Kubernetes logic
    const namespace = `user-${userId}`;
    await this.createNamespace(namespace);
    await this.createPVC(namespace, '50Gi');
    await this.deployPod(namespace, userId);
    return podInfo;
    }
    }
  3. Integrate with Registration

    // On user registration
    const user = await authService.register(email, password);
    const pod = await podProvisioningService.createUserPod(user.id);
    await sessionService.linkUserToPod(user.id, pod);

Deliverables:

  • workspace pod image built
  • Pod provisioning service
  • User β†’ Pod linking
  • CODI2 monitoring in pod

Phase 4: Session Management (Week 4)​

Goal: Multi-session isolation per user

  1. Port Session Model

    // src/types/session.ts (from v4)
    interface Session {
    sessionId: string;
    userId: string;
    tenantId: string;
    workspaceId: string;
    podInfo: PodInfo;
    files: FileState[];
    agents: AgentState[];
    }
  2. Create Session Service

    // src/services/session-service.ts
    @injectable()
    export class SessionService {
    async createSession(userId: string): Promise<Session> {
    const sessionId = uuidv4();
    const session = { sessionId, userId, ... };
    await this.fdb.set(`${tenantId}/session/${sessionId}`, session);
    return session;
    }

    async switchSession(sessionId: string): Promise<void> {
    // Load session state from FDB
    // Update theia UI
    // Reconnect to user pod
    }
    }
  3. Integrate with theia Tabs

    // Map theia tab β†’ Session
    const sessionTab = new SessionWidget(sessionId);
    shell.addWidget(sessionTab, { area: 'main' });

Deliverables:

  • Session service implemented
  • Session ↔ theia tab mapping
  • Session persistence to FDB
  • Multi-session switching

Phase 5: Frontend Consolidation (Week 5)​

Goal: Merge v4 React UI with theia

  1. Analyze v4 Components

    # Identify reusable components
    cd src/frontend-original
    ls -la src/components/
  2. Port to theia Widgets

    // Example: User profile widget
    // src/browser/user-profile-widget/user-profile-widget.tsx
    export class UserProfileWidget extends ReactWidget {
    // Port v4 user profile UI
    }
  3. WebSocket Integration

    // Port v4 WebSocket client
    // src/services/websocket-service.ts
    @injectable()
    export class WebSocketService {
    connect(jwt: string): void {
    this.socket = io('ws://api.t2.com', {
    auth: { token: jwt }
    });
    }
    }

Deliverables:

  • Key v4 components ported
  • WebSocket service integrated
  • UI consistency with theia
  • Real-time updates working

Phase 6: E2E Testing & Deployment (Week 6)​

Goal: Full user flow working

Test Scenarios:

  1. User Registration Flow

    Register β†’ Create User in FDB β†’ Provision Pod β†’ Create Session β†’ Login to IDE
  2. Multi-Session Flow

    Login β†’ Create Session 1 β†’ Create Session 2 β†’ Switch Sessions β†’ Verify Isolation
  3. File Monitoring Flow

    Edit File β†’ CODI2 Detects β†’ Log to FDB β†’ Real-time Update to UI
  4. Agent Execution Flow

    Run Agent β†’ Execute in User Pod β†’ Stream Output β†’ Store Results in FDB

Deployment Tasks:

  • Build all Docker images
  • Deploy to GKE staging cluster
  • Run E2E test suite
  • Performance testing
  • Production deployment

πŸ“‹ Complete Task Checklist​

Infrastructure Setup​

  • Install Rust toolchain locally
  • Install FoundationDB client
  • Set up GCP credentials
  • Configure kubectl for GKE
  • Verify Docker daemon

CODI2 Compilation​

  • Build CODI2 binary
  • Test FDB connection
  • Test file monitoring
  • Test WebSocket sync
  • Create Dockerfile with CODI2

Authentication​

  • Extract v4 auth code
  • Port to theia service
  • Create login/register UI
  • Implement JWT validation
  • Test end-to-end auth flow

Pod Provisioning​

  • Build workspace pod image
  • Extract Kubernetes code from v4
  • Create pod provisioning service
  • Test namespace creation
  • Test PVC creation
  • Test pod deployment

Session Management​

  • Port session model from v4
  • Create session service
  • Integrate with theia tabs
  • Test session persistence
  • Test session switching

Frontend Integration​

  • Analyze v4 React components
  • Port key components to theia
  • Integrate WebSocket client
  • Test real-time updates
  • UI consistency testing

Database Integration​

  • Study v4 FDB schema (ADRs)
  • Port to t2 FDB service
  • Implement tenant isolation
  • Test multi-tenant queries
  • Verify data persistence

E2E Testing​

  • Registration β†’ Pod creation
  • Login β†’ Session creation
  • Multi-session isolation
  • File monitoring β†’ Audit logs
  • Agent execution in pod

Deployment​

  • Build production images
  • Deploy to staging GKE
  • Run test suite
  • Performance tuning
  • Production rollout

πŸ”— Key V4 Files to Reference​

Documentation​

  • coditect-v4/CLAUDE.md - V4 operational guide
  • docs/v4-reference/adrs/adr-002-v4-storage-architecture.md - FDB patterns
  • docs/v4-reference/adrs/ADR-003-v4-multi-tenant-architecture.md - Tenant isolation
  • docs/v4-reference/v4-readme.md - V4 project overview

Source Code​

  • coditect-v4/codi2/ - File monitor source
  • src/v4-api-v2/src/handlers/auth/ - Auth implementation
  • src/v4-api-v2/src/models/ - Data models
  • src/v4-workspace-pod/Dockerfile - Pod definition
  • src/frontend-original/ - React UI

Configuration​

  • docs/v4-config/fdb.cluster - FDB connection string
  • src/v4-workspace-pod/codi2-config.toml - CODI2 config

🎯 Success Criteria for V5 MVP​

MVP Complete When:

  1. βœ… User can register and login
  2. βœ… GKE pod auto-provisioned on registration
  3. βœ… CODI2 monitoring active in user pod
  4. βœ… Multi-session tabs working in theia
  5. βœ… File changes logged to FDB audit trail
  6. βœ… Agent execution in isolated user pod
  7. βœ… Real-time WebSocket updates
  8. βœ… All data persisted to FoundationDB
  9. βœ… Secure JWT authentication throughout
  10. βœ… Beta users can access via coditect.ai

Next Steps:

  1. Update project-tasks/project-plan-with-checkboxes.md with Phase 3.11 tasks
  2. Create docs/v5-migration-plan.md with detailed timeline
  3. Set up local Rust build environment
  4. Begin CODI2 compilation

Questions to Resolve:

  1. Which GCP project for v5 deployment? (serene-voltage-464305-n2 or new?)
  2. FDB cluster location? (Use v4 cluster or deploy new for t2?)
  3. Container registry? (gcr.io or Artifact Registry?)
  4. Domain? (coditect.ai or new subdomain?)