# Bellona MVP Alpha SLOs And Error Budgets

Status: `180.C.16.12` deterministic policy and release-gate evaluator.

Implementation date: 2026-04-23.

This note defines the MVP alpha SLOs for the control-plane signals that matter
most to Bellona's operator experience and safety posture:

- command acknowledgement latency
- stream start latency
- approval round-trip time
- audit write durability

The goal is not to claim production telemetry exists already. The goal is to
freeze the policy now so later automation in `180.C.28.13` implements these
exact semantics instead of inventing a second set of thresholds.

## Sources Reviewed

Local implementation references:

- `testing/bellona/remote-control/mvp-alpha-slos.ts`
- `testing/bellona/remote-control/performance-budgets.ts`
- `testing/bellona/remote-control/mvp-alpha-release-gate.ts`
- `apps/bellona/remote-gateway/src/command-dispatcher.ts`
- `apps/bellona/remote-gateway/src/approval-service.ts`
- `apps/bellona/remote-gateway/src/audit-log.ts`
- `apps/bellona/control-room/src/stream-preview.ts`
- `apps/bellona/control-room/src/webrtc-loopback.ts`
- `infra/monitoring/iris/prometheus/recording-rules.yaml`
- `infra/monitoring/iris/alerting/alerts.yaml`

Existing implementation patterns analyzed before defining this policy:

- `performance-budgets.ts` for the Stage 16 pattern of encoding objective
  thresholds and release notes as deterministic fixtures first.
- `mvp-alpha-release-gate.ts` for the current MVP alpha evidence-snapshot and
  deterministic-gate composition model.
- The repo's Iris monitoring rules for local precedent on rolling-window error
  budgets and burn-rate alerts.

## SLO Objectives

All four indicators use a rolling 30-day window.

| Indicator                       | SLI success definition                                                                                                                      | Objective | Measurement source                                                                   | Release minimum        |
| ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | --------- | ------------------------------------------------------------------------------------ | ---------------------- |
| Command acknowledgement latency | `command.received` reaches `command.dispatched`, `policy.denied`, or `approval.requested` / operator-visible acknowledgement within `300ms` | `99.5%`   | Gateway/timeline acknowledgement deltas from real command traffic                    | `5,000` 30-day events  |
| Stream start latency            | Stream reaches screenshot-ready or healthy WebRTC-active state within `5000ms`                                                              | `99.0%`   | Control Room stream startup timings aligned with the Stage 16 performance plan       | `1,000` 30-day events  |
| Approval round-trip time        | Approval decision arrives within `45000ms`, leaving headroom before the `60000ms` deny-by-default TTL                                       | `99.0%`   | `remote_gateway.approval.latency_ms`                                                 | `200` 30-day approvals |
| Audit write durability          | Audit append is durably recorded, hash-chain continuity holds, and export validation succeeds                                               | `99.99%`  | Audit append counts + `remote_gateway.audit.write_failure.count` + export validation | `50,000` 30-day writes |

These are alpha objectives, not GA promises. They are intentionally tied to the
measurements Bellona already has or is already planning to collect.

## Error-Budget Math

For every indicator:

- allowed error rate = `1 - SLO target`
- observed error rate = `bad events / total events`
- error-budget remaining = `1 - (observed error rate / allowed error rate)`
- burn rate = `observed error rate / allowed error rate`

Examples:

- command acknowledgement at `99.5%` allows `0.5%` bad events over 30 days
- stream startup at `99.0%` allows `1.0%` slow/failed starts
- approval round-trip at `99.0%` allows `1.0%` expired or late approvals
- audit durability at `99.99%` allows `0.01%` failed or non-durable writes

When error-budget remaining drops below `50%` without an active burn-rate alert,
the release gate marks the indicator as `warning`. That does not automatically
block the release, but it must be called out in the release note and reviewed
explicitly.

## Burn-Rate Alerts

Bellona uses the repo's existing SRE-style multiwindow pattern:

| Alert                     | Windows        | Threshold | Release effect |
| ------------------------- | -------------- | --------- | -------------- |
| `fast-burn`               | `5m` and `1h`  | `14.4`    | Block release  |
| `sustained-burn`          | `30m` and `6h` | `6`       | Block release  |
| `budget-exhaustion-trend` | `6h` and `3d`  | `1`       | Block release  |

Interpretation:

- `fast-burn` means the service is spending budget quickly enough that users are
  already experiencing concentrated degradation.
- `sustained-burn` means the budget is being consumed fast enough across hours
  that releasing more change is irresponsible.
- `budget-exhaustion-trend` means the indicator is degrading faster than the
  long-term SLO can sustain, even if the incident is not yet acute.

## Release-Gate Semantics

`testing/bellona/remote-control/mvp-alpha-slos.ts` exposes:

- `createRemoteControlMvpAlphaSloPolicy()`
- `createPassingRemoteControlMvpAlphaSloEvidenceSnapshot()`
- `evaluateRemoteControlMvpAlphaSloPolicy()`

The evaluator blocks release when any indicator:

- lacks live evidence
- lacks the required burn-rate windows or 30-day window
- lacks the required 30-day sample count
- has negative remaining budget
- triggers any configured burn-rate alert

The evaluator warns, but does not block, when:

- the indicator still has positive budget remaining
- no burn-rate alert is active
- but remaining 30-day budget is below `50%`

`mvp-alpha-release-gate.ts` consumes this evaluator as the
`slo-error-budget-policy` check, so the MVP alpha release candidate cannot pass
without the SLO policy and its attached live evidence snapshot.

## Evidence Required Before Signoff

The deterministic evaluator does not replace live evidence. The alpha release
bundle still needs:

- LAN/cloud command acknowledgement timings from real gateway sessions
- same-LAN and TURN-aware stream startup timings
- approval latency telemetry from operator-driven sessions
- audit append failure counts, hash-chain validation, and successful audit
  export evidence

## Verification

The committed automated gate is:

```bash
pnpm exec vitest run --config vitest.config.ts tests/mvp-alpha-slos.test.ts --reporter=verbose
pnpm nx run-many -p @bellona/remote-control-testing -t lint,typecheck,test,build --skip-nx-cache --verbose
```

The first command proves the objective catalog, default blocked behavior,
passing evidence path, active fast-burn regression, and low-budget warning path.
The second command keeps the reusable SLO policy gate buildable inside the
Bellona remote-control testing package.
