# ISIS v2 WS09-009: RunPod Fleet Topology and Economics

## Scope

Implemented full RunPod fleet topology and economics exposure in the generation
API, SDK contracts, and RunPod operator web UI.

## Implemented Artifacts

- RunPod cost attribution extension:
  - `libs/isis/ai-providers/src/providers/comfy/types.ts`
  - `libs/isis/ai-providers/src/providers/comfy/runpod-adapter.ts`
  - `libs/isis/ai-providers/src/providers/comfy/runpod-adapter.test.ts`
- Generation API fleet snapshot surface:
  - `apps/isis/generation-api/src/routes/jobs.ts`
  - `apps/isis/generation-api/src/routes/jobs.spec.ts`
  - `apps/isis/generation-api/src/services/comfyui.service.spec.ts`
  - `apps/isis/generation-api/src/middleware/runpod-budget-guardrail.spec.ts`
- SDK contracts and date parsing:
  - `libs/isis/client/src/types.ts`
  - `libs/isis/client/src/resources/generation.ts`
  - `libs/isis/client/src/index.ts`
- Web operator console exposure:
  - `apps/isis/web/src/pages/RunPodPage.tsx`
  - `apps/isis/web/src/pages/RunPodPage.spec.tsx`
- Operational docs:
  - `docs/infrastructure/runpod-integration.md`
  - `docs/reference/ci-cd.md`

## Fleet Snapshot Model

`GET /api/v1/jobs/runpod/operations` now returns `runpod.fleet` containing:

- `source`: desired-state file path + load/schema/update metadata
- `topology`:
  - current runtime environment
  - endpoint counts (total/managed/active configured)
  - endpoint inventory grouped by desired-state environment
  - endpoint-level stable/canary IDs, worker limits, GPU class, timeouts, and
    endpoint-class mappings
- `economics.projected`:
  - pricing catalog by GPU
  - projected spend totals and breakdowns by environment/family/endpoint
  - monthly values normalized from hourly projections
- `economics.observed`:
  - runtime cost/seconds rollups from endpoint attribution
  - endpoint and family aggregates

## Verification

```bash
pnpm --filter @isis/ai-providers exec vitest run src/providers/comfy/runpod-adapter.test.ts --reporter=dot
pnpm --filter @isis/generation-api exec vitest run src/routes/jobs.spec.ts src/services/comfyui.service.spec.ts src/middleware/runpod-budget-guardrail.spec.ts --reporter=dot
pnpm --filter @isis/web exec vitest run src/pages/RunPodPage.spec.tsx src/pages/JobSubmissionStudio.spec.tsx --reporter=dot
```

## Outcome

WS09-009 is now closed with end-to-end fleet topology and economics
observability, including endpoint-level attribution, projected cost modeling
from desired-state, and operator-facing tables in the RunPod web console.
