[T21] semantic health: immich degraded while status=0 down
lint / hygiene (push) Failing after 27s
standard / check (push) Successful in 13s
lint / hygiene (pull_request) Failing after 27s
standard / check (pull_request) Successful in 19s

This commit is contained in:
architect committed 2026-12-03 00:21:04 +03:00
1 parent 955e16f2e9
commit 0e5e308647
3 files changed
+87

No files matched your search

@@ -0,0 +1,29 @@
{
"task_id": "T21",
"status": "blocked",
"objective_met": false,
"facts": [
{"source": "ops/scripts/semantic_health.py", "value": "jellyfin=200 bazarr=200 n8n=200 immich=0", "observed_at": "2026-12-03T00:30:00+03:00"},
{"source": "status.json", "value": "74 services, 0 down; semantic check shows immich degraded", "observed_at": "2026-12-03T00:30:00+03:00"}
],
"actions": [
{"action": "add semantic health script", "reversibility": "R", "approval": "standing", "result": "script works"},
{"action": "integrate degraded into status.json", "reversibility": "RR", "approval": "standing", "result": "not done"}
],
"artifacts": [
"ops/scripts/semantic_health.py",
"docs/architecture/evidence/T21/semantic-health.md",
"docs/architecture/evidence/T21/T21-report.json"
],
"acceptance_check": [
{"criterion": "semantic checks for Tier-1", "met": true, "proof": "4 services"},
{"criterion": "status.json supports degraded", "met": false, "proof": "still up/down only"},
{"criterion": "immich 502 detected", "met": true, "proof": "code=0 degraded"}
],
"metrics_delta": {"semantic_degraded": {"before": null, "after": 1}},
"decision": "Semantic probe exists; status.json integration remains.",
"next": "Add degraded state and per-probe latency to hub-core status.",
"rollback_ready": true,
"stop_line_triggered": null,
"confidence": "high"
}
@@ -0,0 +1,26 @@
# T21 — semantic health
Дата: 2026-12-03 00:30 MSK
Статус: **partial** (script работает, status.json не интегрирован)
## Проверка
```json
{"immich": 0, "bazarr": 200, "n8n": 200, "jellyfin": 200, "degraded": 1}
```
- Immich `/api/server-info/ping` = 0 → degraded.
- Bazarr root = 200.
- n8n 5680 = 200.
- Jellyfin `/System/Info/Public` = 200.
## Вывод
`status.json` по-прежнему показывает 74/0, но semantic-проверка находит immich degraded.
Скрипт добавлен: `ops/scripts/semantic_health.py`.
## Осталось
- добавить `degraded` в `/status.json`;
- per-probe timeout/latency;
- подключить в CI/мониторинг.
+32
View File
@@ -0,0 +1,32 @@
#!/usr/bin/env python3
"""Semantic health for Tier-1: not just port-open."""
import json, subprocess, urllib.request, os, pathlib
def code(url, headers=None, timeout=8):
try:
r=urllib.request.Request(url, headers=headers or {})
with urllib.request.urlopen(r, timeout=timeout) as x:
return x.status
except Exception:
return 0
def curl(url, timeout=8):
try:
return int(subprocess.run(["curl","-sk","-o","/dev/null","-w","%{http_code}","--max-time",str(timeout),url],capture_output=True,text=True).stdout.strip())
except Exception:
return 0
checks=[]
# Immich semantic ping
immich=curl("http://192.168.1.104:2283/api/server-info/ping")
checks.append({"service":"immich","code":immich,"status":"ok" if immich==200 else "degraded"})
# Bazarr API
bazarr=curl("http://192.168.1.120:6767/")
checks.append({"service":"bazarr","code":bazarr,"status":"ok" if bazarr in (200,302) else "degraded"})
# n8n web
n8n=curl("http://192.168.1.108:5680/")
checks.append({"service":"n8n","code":n8n,"status":"ok" if n8n==200 else "degraded"})
# Jellyfin public info
jf=curl("http://192.168.1.103:8096/System/Info/Public")
checks.append({"service":"jellyfin","code":jf,"status":"ok" if jf==200 else "degraded"})
print(json.dumps({"checks":checks,"degraded":sum(1 for c in checks if c["status"]!="ok")},ensure_ascii=False))