Files
git.stella-ops.org/docs/features/checked/policy/risk-budget-management.md
2026-02-14 09:11:48 +02:00

34 lines
2.6 KiB
Markdown

# Risk Budget Management
## Module
Policy
## Status
IMPLEMENTED
## Description
Per-service risk budget management with budget ledger (RP consumed per release, remaining, trendline), constraint enforcement, threshold notifications, and earned capacity replenishment.
## Implementation Details
- **BudgetEndpoints**: `src/Policy/StellaOps.Policy.Engine/Endpoints/BudgetEndpoints.cs` -- CRUD API for budget definitions and status queries
- **RiskBudgetEndpoints**: `src/Policy/StellaOps.Policy.Engine/Endpoints/RiskBudgetEndpoints.cs` -- risk budget evaluation, consumption tracking, and status
- **LedgerExportService**: `src/Policy/StellaOps.Policy.Engine/Ledger/LedgerExportService.cs` -- budget ledger tracking RP consumed per release, remaining capacity, trendline
- **LedgerModels**: `src/Policy/StellaOps.Policy.Engine/Ledger/LedgerModels.cs` -- data models for ledger entries (release ID, RP consumed, timestamp, actor)
- **LedgerExportStore**: `src/Policy/StellaOps.Policy.Engine/Ledger/LedgerExportStore.cs` -- persistence for ledger export
- **UnknownBudgetService**: `src/Policy/__Libraries/StellaOps.Policy.Unknowns/Services/UnknownBudgetService.cs` -- budget management for unknowns
- **UnknownsBudgetEnforcer**: `src/Policy/__Libraries/StellaOps.Policy.Unknowns/Services/UnknownsBudgetEnforcer.cs` -- constraint enforcement (Green/Yellow/Red/Exhausted thresholds)
- **PolicyGateEvaluator budget integration**: `src/Policy/StellaOps.Policy.Engine/Gates/PolicyGateEvaluator.cs` -- budget status (Yellow/Red/Exhausted) escalates gate levels
- **RiskSimulationService**: `src/Policy/StellaOps.Policy.Engine/Simulation/RiskSimulationService.cs` -- simulates budget impact of policy changes
## E2E Test Plan
- [ ] Create budget with critical=10, high=20, medium=50 limits; verify budget status is Green
- [ ] Consume 15 critical RP; verify budget status transitions to Yellow for critical
- [ ] Consume 8 more critical RP (total 23 > limit 10); verify budget status transitions to Red/Exhausted
- [ ] Verify ledger records each consumption with release ID, RP amount, timestamp, and actor
- [ ] Query budget trendline; verify declining remaining capacity across releases
- [ ] Trigger threshold notification at Yellow; verify notification includes budget name, threshold, and current consumption
- [ ] Verify earned capacity replenishment: resolve findings to restore budget capacity
- [ ] Export ledger; verify all entries are included with compliance-ready format
- [ ] Verify budget constraint enforcement blocks release when Exhausted
- [ ] Verify gate level escalation when budget is in Red status