Files
0pt/docs/slo.md
T
admin a88ad04867
Security Scan (SIAX Cloud) / security (push) Successful in 21s
CI (SIAX Cloud) / security (push) Successful in 21s
CI (SIAX Cloud) / quality (push) Successful in 41s
CI (SIAX Cloud) / security (pull_request) Successful in 22s
Security Scan (SIAX Cloud) / security (pull_request) Successful in 21s
CI (SIAX Cloud) / quality (pull_request) Successful in 41s
fix(health): report real per-dependency status instead of hardcoded ok:true
BACKLOG P0-3: /api/health only ever checked *presence* of DATABASE_URL/
REDIS_URL and always returned ok:true regardless of whether anything was
reachable -- ARCHITECTURE.md's own words, "an uptime monitor watching HTTP
200 would show green for a dying instance".

lib/health-checks.ts adds real dependency probes:
  - db: a live `select 1` round trip (not just DATABASE_URL presence)
  - engine: a real HTTP call to the FastAPI engine's own GET /health
  - stripe: Stripe's documented lightweight balance.retrieve() liveness call
  - queue: honestly reports "not_integrated" when REDIS_URL is set but
    unused -- no Redis client is wired anywhere in this repo, so reporting
    "ok" would fabricate a check that doesn't exist

/api/health stays a liveness check (always 200 while the process can
respond; the body's `ok` field is the honest signal). New GET /api/ready
fails closed with 503 when the load-bearing dependency (db) isn't both
configured and reachable -- the "no /ready route" gap.

contracts/openapi.yaml, docs/architecture/ARCHITECTURE.md, and docs/slo.md
updated to match. 17 new unit tests (dependency-injected fakes, no real
network/DB) + 5 route-level tests.
2026-08-11 13:49:23 +02:00

50 lines
2.0 KiB
Markdown

# SLO — 0pt
> Gäller när tjänsten är i produktion på flottan (Coolify). Nuläget (2026-08-10):
> live på Vercel, ingen DB — se särskilda noteringar. Ägare: Simon Axelsson.
## Tillgänglighet
| SLO | Mål | Nuläge (2026-08-10) |
|---|---|---|
| `/api/health` (liveness) | 99,9 % | ✅ 200; `ok` speglar nu en riktig per-dependency-probe (fixat BACKLOG P0-3) |
| `/api/ready` (readiness) | 99,5 % | ✅ ny (BACKLOG P0-3) — 503 när `db` inte är konfigurerad+nåbar |
| Orderflöde `/api/orders` | 99,5 % | ⚠️ fungerar utan DB (in-memory), data försvinner vid restart |
| Capability-API `/api/0pt/*` | 99,5 % | ⚠️ live 200 anonymt (lucka S1) — målbild: 401 utan token |
| Engine (FastAPI, när deployad) | 99,0 % | ej deployad (EJ VERIFIERAT) |
## Latens (p95)
| Operation | Mål |
|---|---|
| `/api/health` | < 200 ms |
| `/api/estimates` | < 500 ms |
| `0pt.query_source` (enkla källor) | < 2 s |
| Iceberg-write (tung) | ej mätbart sync — asynkront via N0D-jobb |
## Data & proveniens
- **Proveniens per fält:** 100 % av levererade fält bär `bridge_provenance`
(källa, färskhet, konfidens, level). Målbild; i dag är leverans in-memory.
- **Inga fabricerade värden:** 100 % — hård garanti (never-fabricate-tester finns).
- **Retention/deletion-after-job:** mål 100 % av jobb — **inte implementerat**
(BACKLOG P2-2).
## Säkerhet (baskrav)
- 0 kända hårdkodade hemligheter i repo (skannat 2026-08-10: 0 träffar).
- Auth fail-closed i kod; **live-verifierad 401 krävs före produktionslöfte**
(lucka S1 öppen).
- Ingen betald SaaS-plattform som driftkrav (AR-4) — Stripe är kundval, env-guardad.
## Rapportering
- Mätning sker manuellt vid incidenter tills observabilitet är inkopplad
(BACKLOG P2-4). Mål: automatiska hälsokontroller via nightly.yml + Coolify.
## Undantag
Bypass-stacken (`services/scrapers/*`) är medvetet behållen per kontoägarens
daterade beslut (Simon Axelsson, 2026-08-11 — se SECURITY.md) och omfattas
inte av ovanstående SLO; dess körtid är ej mätbar i 0pt-SLO:er.