02-protocol-event-truth.md 2.4 KB

Review 2 — Protocol and event truth

Date: 2026-08-18 Round: HTH Host serial transaction ownership, Safe/Resume, event ordering, release evidence closure Round 4

No ACK

Current Prod2U UART has no ACK. FULLY_WRITTEN && err == nil is DISPATCHED + UNCONFIRMED. The daemon and Python SDK must not emit or accept CONFIRMED.

Event ID monotonicity

Every SubscribeEvents stream's non-zero event_id is strictly increasing. Gap for a slow subscriber is not a global event. The next real event carries:

  • dropped_count
  • last_contiguous_event_id
  • requested_resume_after_event_id
  • oldest_available_event_id

Resume beyond the ring attaches the same structure to the first replayed real event. Event ID 0 is not used. The stream never emits N+1 then N.

Action Result events

Terminal action outcomes are published as Event.action_result (additive tag 17) with command id, origin, device epoch, port generation, lease, requested/normalized/accepted/dispatched records, dispatch state, confirmation, reject/supersede reason, timestamps, and control revision. Internal command ids are daemon:epoch:seq:origin, not safe:<reason>. Capture/Replay persist these events. Replay assigns a new live event_id and keeps source ids as provenance.

Epoch and commanded vs actual

ContinuousTargets is nil when haveCont=false or baselineReady=false. Go zero values are not published as real 0% targets. Last requested/accepted/dispatched carry action_epoch / port_generation. After an epoch change, the current snapshot does not present old actions as the live commanded state. Without hardware feedback, values remain commanded, not actual (DATA_QUALITY_NOT_SUPPORTED / COMMANDED_NOT_ACTUAL).

Heartbeat truth

Only WriteOutcome == FULLY_WRITTEN && err == nil counts as a successful hardware heartbeat. NOT_STARTED is NOT_DELIVERED (no success event, no automatic reconnect for 0-byte writes). PARTIAL / FULL_WITH_ERROR / UNKNOWN / DISCONNECTED close transport, bump epoch, invalidate the lease, and do not replay the original frame. Snapshot publishes last_successful_hardware_heartbeat, hardware_watchdog_timeout_ms, remaining_watchdog_margin_ms, and heartbeat_delivery_state. systemd Watchdog petting is not a claim that the firmware 30 s watchdog was fed.

Verdict

Protocol/event truth direction: PASS for the items implemented and tested in-tree. Do not treat Review 5 gates (buf, soak, RTL) as decided here.