# ISIS v2 Terrain Heightmap Pack Cost Estimation and Budget Guardrails

Generated: 2026-08-02T18:14:05.341Z Checklist: `MXA-0374` (ISIS2-00572) Asset
Family: `terrain-heightmap-pack` Phase: Phase 4 | Milestone: M3 Launch
(2026-07-27 to 2026-10-30)

## Objective

Deliver deterministic per-run cost/runtime estimation and threshold-based budget
guardrails for terrain-heightmap-pack workflow execution, with enforcement and
observability integrated into workflow run APIs and provider compatibility
diagnostics.

## Workflow Coverage

| Workflow                                   | Cost Utils | Jobs Strategy | Workflows Surface | Sizing Policy                              |
| ------------------------------------------ | ---------- | ------------- | ----------------- | ------------------------------------------ |
| terrain-heightmap-pack-baseline            | true       | true          | false             | terrain-heightmap-pack-flux-standard       |
| terrain-heightmap-pack-image-conditioned   | true       | true          | false             | terrain-heightmap-pack-flux-standard       |
| terrain-heightmap-pack-control-conditioned | true       | true          | true              | terrain-heightmap-pack-control-conditioned |
| terrain-heightmap-pack-consistency-locked  | true       | true          | true              | terrain-heightmap-pack-consistency-locked  |

## Guardrail Environment-Key Coverage

| Env Key                                                                    | Cost Utils | Jobs Strategy |
| -------------------------------------------------------------------------- | ---------- | ------------- |
| ISIS_TERRAIN_HEIGHTMAP_PACK_BUDGET_GUARDRAIL_ENABLED                       | true       | true          |
| ISIS_TERRAIN_HEIGHTMAP_PACK_BUDGET_SOFT_LIMIT_USD                          | true       | true          |
| ISIS_TERRAIN_HEIGHTMAP_PACK_BUDGET_HARD_LIMIT_USD                          | true       | true          |
| ISIS_TERRAIN_HEIGHTMAP_PACK_RUNTIME_SOFT_LIMIT_SECONDS                     | true       | true          |
| ISIS_TERRAIN_HEIGHTMAP_PACK_RUNTIME_HARD_LIMIT_SECONDS                     | true       | true          |
| ISIS_TERRAIN_HEIGHTMAP_PACK_BUDGET_RETRY_AFTER_SECONDS                     | true       | true          |
| ISIS_TERRAIN_HEIGHTMAP_PACK_COST_RATE_FLUX_USD_PER_SECOND                  | true       | true          |
| ISIS_TERRAIN_HEIGHTMAP_PACK_COST_RATE_CHARACTER_CONSISTENCY_USD_PER_SECOND | true       | true          |

## Implementation Signals

- Cost utility methods:
  - estimateTerrainHeightmapPackRunCost: present
  - evaluateTerrainHeightmapPackBudgetGuardrail: present
  - applyTerrainHeightmapPackBudgetGuardrailHeaders: present
- Workflows route signals:
  - budgetGuardrailErrorClassImported: true
  - budgetGuardrailHeadersApplied: true
  - budgetGuardrailErrorCodeExposed: true
  - estimatedCostInWorkflowResponse: true
  - budgetMetadataStoredOnJob: true
- Jobs route signals:
  - costEstimationProfilesExposed: true
  - budgetGuardrailsExposed: true
  - terrainHeightmapPackPolicyConstantPresent: true
- Test coverage signals:
  - costUtilsSpecAssertions: 4
  - workflowsSpecBudgetGuardrailAssertionPresent: true
  - jobsSpecCompatibilityAssertionPresent: true

## Verification

- `pnpm --filter @isis/generation-api exec vitest run src/routes/terrain-heightmap-pack-budget-utils.spec.ts src/routes/workflows.spec.ts src/routes/jobs.spec.ts`

## Acceptance Criteria

- `terrain-heightmap-pack` workflow variants return deterministic estimated
  runtime/cost signals before dispatch.
- Budget guardrail thresholds enforce hard-fail rejection when estimated
  runtime/cost envelopes exceed configured limits.
- Workflow run responses and headers expose estimation and guardrail diagnostics
  for operator visibility and downstream tooling.
- Provider compatibility diagnostics expose terrain-heightmap-pack cost
  estimation profiles and budget guardrail policy metadata.

## References

- `docs/domains/isis/remediation-v2/ISIS_REMEDIATION_V2_TICKETS.json`
- `docs/domains/isis/remediation-v2/ISIS_V2_TERRAIN_HEIGHTMAP_PACK_REQUIREMENTS_BRIEF.json`
- `docs/domains/isis/remediation-v2/ISIS_V2_TERRAIN_HEIGHTMAP_PACK_RUNPOD_ENDPOINT_CLASS_SIZING_POLICIES.json`
- `apps/isis/generation-api/src/routes/workflows.ts`
- `apps/isis/generation-api/src/routes/workflows.spec.ts`
- `apps/isis/generation-api/src/routes/jobs.ts`
- `apps/isis/generation-api/src/routes/jobs.spec.ts`
- `apps/isis/generation-api/src/routes/terrain-heightmap-pack-budget-utils.ts`
- `apps/isis/generation-api/src/routes/terrain-heightmap-pack-budget-utils.spec.ts`
- `ISIS_TODOS_2.md`
