feat(daemon): alarms by name + RequestControlState + WatchHealth (Phase A complete)

A2 — alarms: optional 'name:' on alarm config (a LOCAL key — SEMI only
defines numeric ALID + freetext ALTX; field appended last so existing
{id, text, category} brace-inits compile unchanged), parsed by the loader,
checked by the validator, shipped in equipment.yaml. SetAlarm/ClearAlarm
RPCs resolve config name OR stringified ALID via a constructor snapshot.

A3 — control state + health: RequestControlState fires operator events on
the io thread (read_sync) and reports what the E30 table actually did —
ACCEPT iff the equipment landed in the requested state, CANNOT_DO_NOW naming
the actual state otherwise (the shipped table has no operator path to
EquipmentOffline; the test pins that honesty). ATTEMPT_ONLINE is rejected as
transient. WatchHealth streams an immediate snapshot then pushes on link/
control-state changes via service observers (add_link_observer +
add_control_state_observer — the HandlerSlot work paying off), spool depth
sampled at the 500ms poll; ends on cancel or engine stop.

Tests: daemon suite 61 -> 101 assertions (alarm lifecycle by name/id/unknown,
WatchHealth initial + change push, all four RequestControlState semantics);
loader test for the alarm name (present + absent fallback); core 467/3055.
Interop now 15 checks incl. gRPC SetAlarm -> host receives S5F1 ALCD=0x84
ALID=1, and RequestControlState(HOST_OFFLINE) -> GetControlState confirms.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-06-10 19:47:31 +02:00
parent 83593bb508
commit 1da56f973f
9 changed files with 326 additions and 15 deletions
+5
View File
@@ -39,6 +39,11 @@ struct Alarm {
// Lower 7 bits of ALCD: severity bitmap (see AlarmSeverity). Bit 7
// marks set vs cleared and is applied at emit time.
uint8_t severity_category;
// Optional local key for name-based APIs (the gRPC daemon, future Python
// client). NOT on the wire — SEMI defines only numeric ALID + freetext
// ALTX. Last field so existing {id, text, category} brace-inits compile
// unchanged; empty = unnamed (address it by id).
std::string name;
bool has(AlarmSeverity bit) const { return has_severity(severity_category, bit); }
bool is_safety() const {