Technician tool v0.3

Imported from the Google Drive folder 004-technician_tool/v0.3.
This commit is contained in:
kkallas committed 2026-09-26 17:14:37 +02:00
1 parent e8b72b743d
commit e161941672
13 files changed
+2280 -573

No files matched your search

+23 -1
View File
@@ -59,6 +59,7 @@ MILESTONES = [
("sd_mounted", "SD card mounted", False),
("env_loaded", "ENV.TXT read (InfluxDB settings)", False),
("matter_started", "Matter started", True),
("matter_commissioned", "Paired in Matter", True),
("local_wifi_mode", "Local Wi-Fi mode (SSID from SD card)", True),
("sensors_ready", "All sensors started", False),
("wifi_connected", "Connected to Wi-Fi", False),
@@ -215,6 +216,7 @@ class Report:
boots: list[BootRecord]
lines: int
mid_run: bool # no boot seen yet
technician: list[str] = field(default_factory=list) # guided-check answers
def to_text(self) -> str:
out = [f"VERDICT: {self.verdict}",
@@ -243,6 +245,10 @@ class Report:
out.append("Resolved during this session:")
for f in self.resolved:
out.append(f" - {f.title}" + (f" (by: {f.resolved_by})" if f.resolved_by else ""))
if self.technician:
out.append("")
out.append("Technician checks:")
out += [f" - {t}" for t in self.technician]
return "\n".join(out)
@@ -271,6 +277,7 @@ class DiagnosticsEngine:
self.lines = 0
self._tool_reset_at: float | None = None
self._panic_tail = 0 # RAW lines after a panic line to keep
self.technician: list[str] = []
@property
def boot(self) -> BootRecord:
@@ -369,7 +376,22 @@ class DiagnosticsEngine:
# Reached milestones in the order they happened, then the pending ones.
ms.sort(key=lambda m: (m[2] is None, m[2] or 0))
return Report(verdict, vsev, self.led, self.led_reason, self.firmware, ms, roots,
earlier, resolved, list(self.boots), self.lines, mid_run)
earlier, resolved, list(self.boots), self.lines, mid_run, list(self.technician))
def add_confirmed(self, key: str, severity: Severity, title: str, meaning: str,
actions: tuple[str, ...]) -> Finding:
"""A finding established by a guided check (technician answer + log)."""
f = self.findings.get(key)
if f is None:
f = self.findings[key] = Finding(key, key, severity, title, meaning, tuple(actions))
f.count += 1
f.boot = self.boot.index
f.resolved = False
f.evidence.append("confirmed by the technician during a guided check")
return f
def note_technician(self, text: str) -> None:
self.technician.append(text)
# ------------------------------------------------------------ internals
def _new_boot(self, host_time: float, explicit: bool) -> None: