Files
motovaultpro/docs/redesign/DEPENDENCY-GRAPH.md
Eric Gullickson 046c66fc7d Redesign
2025-11-01 21:27:42 -05:00

12 KiB

Dependency Graph - Phase Execution Order

Visual Phase Dependencies

START
  │
  ├─────────────────────────────────────────────┐
  │                                             │
  ▼                                             ▼
┌─────────────────────────┐          ┌─────────────────────────┐
│   PHASE 4: Config       │          │   PHASE 9: Docs         │
│   Agent: config-agent   │          │   Agent: docs-agent     │
│   Duration: 20-30 min   │          │   Duration: 30-40 min   │
└────────────┬────────────┘          └─────────────────────────┘
             │                                  (Parallel - no deps)
             │ Blocks: infra-agent, backend-agent
             │
             ├────────────────────┬─────────────────────┐
             │                    │                     │
             ▼                    ▼                     ▼
┌─────────────────────┐ ┌─────────────────────┐ ┌─────────────────────┐
│  PHASE 1: Docker    │ │ PHASE 2: Remove     │ │ PHASE 3: Storage    │
│  Agent: infra-agent │ │ Tenant              │ │ Agent:storage-agent │
│  Duration: 25-30min │ │ Agent:backend-agent │ │ Duration: 30-40min  │
└──────────┬──────────┘ └──────────┬──────────┘ └─────────────────────┘
           │                       │                   (Parallel)
           │                       │
           │ Blocks platform-agent │
           │                       │
           ├───────────┐           ├───────────┐
           │           │           │           │
           ▼           ▼           ▼           ▼
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│  PHASE 5:       │ │  PHASE 8:        │ │  PHASE 6:       │
│  Network        │ │  Platform        │ │  Backend        │
│  Agent: infra   │ │  Agent: platform │ │  Agent: backend │
│  Duration:15min │ │  Duration:35-45m │ │  Duration:20min │
└────────┬────────┘ └──────────────────┘ └────────┬────────┘
         │                                         │
         │                                         │ Blocks frontend-agent
         ▼                                         │
┌─────────────────┐                                │
│  PHASE 7:       │                                │
│  Database       │                                │
│  Agent: infra   │                                │
│  Duration:15min │                                │
└─────────────────┘                                │
                                                   ▼
                                        ┌─────────────────────┐
                                        │  PHASE 10: Frontend │
                                        │  Agent: frontend    │
                                        │  Duration: 25-35min │
                                        └──────────┬──────────┘
                                                   │
                                                   │
                            All phases must complete before testing
                                                   │
                                                   ▼
                                        ┌─────────────────────┐
                                        │  PHASE 11: Testing  │
                                        │  Agent: test-agent  │
                                        │  Duration: 20-30min │
                                        └─────────────────────┘
                                                   │
                                                   ▼
                                                 END

Phase Dependency Matrix

Phase Agent Depends On Blocks Can Run Parallel With
4 config-agent None 1, 2 9
9 docs-agent None None 4, 1, 2, 3, 5, 6, 7, 8, 10
1 infra-agent 4 5, 7, 8 2, 3, 9
2 backend-agent 4 6, 10 1, 3, 9
3 storage-agent None None 1, 2, 4, 9, 5, 6, 7, 8
5 infra-agent 1 7 2, 3, 6, 8, 9
6 backend-agent 2 10 1, 3, 5, 7, 8, 9
7 infra-agent 5 None 2, 3, 6, 8, 9
8 platform-agent 1 None 2, 3, 5, 6, 7, 9
10 frontend-agent 6 11 9 (tail end)
11 test-agent ALL None None

Critical Path Analysis

Longest Path (Sequential)

Phase 4 (30m) → Phase 2 (20m) → Phase 6 (20m) → Phase 10 (30m) → Phase 11 (25m)
Total: 125 minutes (2 hours 5 minutes)

Parallel Optimization

With 8 agents working in parallel:

Wave 1: Max(Phase 4: 30m, Phase 9: 40m) = 40 minutes
Wave 2: Max(Phase 1: 30m, Phase 2: 20m, Phase 3: 40m) = 40 minutes
Wave 3: Max(Phase 5: 15m, Phase 6: 20m, Phase 7: 15m, Phase 8: 45m) = 45 minutes
Wave 4: Phase 10: 30 minutes
Wave 5: Phase 11: 25 minutes
Total: 180 minutes (3 hours)

Note: Critical path runs through: Phase 9 → Phase 3 → Phase 8 → Phase 10 → Phase 11

Agent Execution Waves

Wave 1: Foundation (Parallel)

Start Time: T+0 Duration: 40 minutes

Agent Phase Duration Start End
config-agent 4 30 min T+0 T+30
docs-agent 9 40 min T+0 T+40

Completion Signal: Both agents update EXECUTION-STATE.json status to "completed"


Wave 2: Core Infrastructure (Parallel)

Start Time: T+30 (after config-agent completes) Duration: 40 minutes

Agent Phase Duration Start End
infra-agent 1 30 min T+30 T+60
backend-agent 2 20 min T+30 T+50
storage-agent 3 40 min T+30 T+70

Waits For: config-agent completion Completion Signal: All three agents complete their first phases


Wave 3: Continued Work (Parallel)

Start Time: Varies by agent Duration: 45 minutes

Agent Phase Duration Start End Waits For
infra-agent 5 15 min T+60 T+75 Phase 1
backend-agent 6 20 min T+50 T+70 Phase 2
platform-agent 8 45 min T+60 T+105 Phase 1

Then:

Agent Phase Duration Start End Waits For
infra-agent 7 15 min T+75 T+90 Phase 5

Completion Signal: All agents finish their assigned phases


Wave 4: Frontend (Sequential)

Start Time: T+70 (after backend-agent Phase 6) Duration: 30 minutes

Agent Phase Duration Start End Waits For
frontend-agent 10 30 min T+70 T+100 Phase 6

Waits For: backend-agent Phase 6 completion Completion Signal: frontend-agent updates status


Wave 5: Validation (Sequential)

Start Time: T+105 (after all agents complete) Duration: 25 minutes

Agent Phase Duration Start End Waits For
test-agent 11 25 min T+105 T+130 ALL phases

Waits For: platform-agent Phase 8 (last to complete) Completion Signal: All tests pass, project simplified


Resource Conflict Analysis

File-Level Conflicts

None Detected - All agents work on different files or in sequence.

Potential Race Conditions

Docker Compose Access:

  • Only infra-agent modifies docker-compose.yml
  • Sequential phases (1, 5, 7) prevent conflicts
  • Risk: Low

Config File Access:

  • Only config-agent modifies config/app/production.yml
  • Single phase (4) prevents conflicts
  • Risk: None

Backend Code Access:

  • backend-agent works on different files in Phase 2 vs. Phase 6
  • storage-agent works on different files (storage/ vs. backend)
  • Risk: None

Lock File Strategy

If conflicts arise (they shouldn't):

# Agent 1 creates lock
touch docs/redesign/locks/docker-compose.yml.lock

# Agent 2 checks for lock
if [ -f docs/redesign/locks/docker-compose.yml.lock ]; then
  wait_for_lock_release
fi

# Agent 1 releases lock
rm docs/redesign/locks/docker-compose.yml.lock

Synchronization Points

Critical Handoffs

  1. config-agent → infra-agent, backend-agent

    • What: Configuration cleanup complete
    • Why: Backend and infra need clean config to work
    • Check: EXECUTION-STATE.json phase 4 status = "completed"
  2. infra-agent Phase 1 → platform-agent Phase 8

    • What: Docker compose updated with new names
    • Why: Platform service needs new container names
    • Check: EXECUTION-STATE.json phase 1 status = "completed"
  3. backend-agent Phase 6 → frontend-agent Phase 10

    • What: Backend API updates complete
    • Why: Frontend needs updated API contracts
    • Check: EXECUTION-STATE.json phase 6 status = "completed"
  4. All Agents → test-agent Phase 11

    • What: All code changes complete
    • Why: Testing validates entire simplification
    • Check: EXECUTION-STATE.json phases 1-10 all "completed"

Bottleneck Analysis

Potential Bottlenecks

  1. platform-agent Phase 8 (45 minutes)

    • Longest single phase
    • Blocks final testing
    • Mitigation: Start as early as possible (after Phase 1)
  2. config-agent Phase 4 (30 minutes)

    • Blocks Wave 2 start
    • Mitigation: First wave priority, simple changes
  3. storage-agent Phase 3 (40 minutes)

    • Not on critical path but moderately long
    • Mitigation: Can run fully parallel

Optimization Opportunities

  1. Start docs-agent immediately - No dependencies, can run entire duration
  2. Prioritize config-agent - Unblocks Wave 2 quickly
  3. Start storage-agent early - Long duration, no dependencies
  4. Stagger infra-agent phases - Phases 1, 5, 7 run sequentially within agent

Decision Points

Proceed to Next Wave

Wave 1 → Wave 2:

IF EXECUTION-STATE.json phase 4 status == "completed"
THEN spawn Wave 2 agents
ELSE wait

Wave 2 → Wave 3:

IF EXECUTION-STATE.json phase 1 status == "completed"
THEN spawn platform-agent
CONTINUE infra-agent to Phase 5
CONTINUE backend-agent to Phase 6

Wave 3 → Wave 4:

IF EXECUTION-STATE.json phase 6 status == "completed"
THEN spawn frontend-agent

Wave 4 → Wave 5:

IF all phases 1-10 status == "completed"
THEN spawn test-agent
ELSE identify failures and halt

Rollback Decision Tree

IF test-agent Phase 11 fails
├─ IF frontend-agent Phase 10 suspected
│  └─ Rollback Phase 10 only
├─ IF backend-agent Phase 2 or 6 suspected
│  └─ Rollback Phases 2 and 6
├─ IF infrastructure suspected
│  └─ Rollback Phases 1, 5, 7
└─ IF all else
   └─ Full rollback to original state

See ROLLBACK-STRATEGY.md for detailed procedures.