Technician tool v0.7

Imported from the Google Drive folder 004-technician_tool/v0.7.
This commit is contained in:
kkallas committed 2026-09-28 19:11:20 +02:00
1 parent 22bd853ecf
commit dd915b5a74
29 files changed
+8429 -3981

No files matched your search

+20 -6
View File
@@ -43,16 +43,20 @@ APP = ["I (1299) app_init: Project name: kota-sensorboard",
# ------------------------------------------------------------------ rules
def test_rules_load_and_have_no_cycles():
rules = load_rules()
by_id = {r.id: r for r in rules}
for r in rules:
seen, todo = set(), list(r.explained_by)
from kota_tech.diag import kota
graph = {r.id: r.explained_by for r in load_rules()}
for st in ("ERROR", "OUT_OF_RESOURCES", "CONNECTION_ERROR", "RTC_ERROR", "SD_ERROR", "RESETING", "HTTP_SERVER"):
for code in range(7):
if sf := kota.status_finding(st, code):
graph[sf[0]] = sf[5]
for start, explained_by in graph.items():
seen, todo = set(), list(explained_by)
while todo:
rid = todo.pop()
assert rid != r.id, f"explained_by cycle through {r.id}"
assert rid != start, f"explained_by cycle through {start}"
if rid not in seen:
seen.add(rid)
todo += by_id[rid].explained_by
todo += graph.get(rid, ())
# --------------------------------------------------------- real captures
@@ -233,3 +237,13 @@ def test_session_log_format(tmp_path):
for ln in lines:
e.feed(ln)
assert e.boot.tool_reset
def test_live_brownout_loop_is_a_power_problem():
# Real capture (2026-09-28): "E BOD: Brownout detector was triggered" has no
# timestamp and the ROM reports RTC_SW_SYS_RST, not a brown-out reset.
r = replay("live_brownout_loop_A4CB8FC946F8_fw1.0.txt")
top = r.roots[0]
assert top.finding.rule_id == "reboot.brownout" and top.finding.count >= 5
assert "reboot.loop" in {c.rule_id for c in top.consequences}
assert r.verdict.startswith("Problem: Power supply")