fix(sfm): a Micromate in an unknown run state gets no call-home write, and a lost ack keeps its snapshot (phase-4 review)

- s4_change_call_home's read_state now returns an unknown(0xNN) run state as
  it is, so the change core refuses it (UnitStateUnknown, nothing sent), as
  start/stop already does; it checked only for calling_home.
- run_change records the snapshot on the lost-ack path too: after an ack is
  lost, what the unit now holds (and, on Series 4, whether [118:120] moved) is
  what tells whether the write landed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
This commit is contained in:
serversdownandClaude Opus 5.5 committed 2026-11-02 17:23:59 -05:00
1 parent bdd76b8f74
commit 9e03b3f0ab
3 files changed
+30 -4

No files matched your search

+7 -2
View File
@@ -207,13 +207,18 @@ def run_change(*, kind: ChangeKind, serial: str, series: int, dry_run: bool, eve
outcome="failed", verified="not_checked", ack=None,
error=f"no clean ack: {exc}; the unit is now calling home",
states=states([before], after))
lost_detail: Dict[str, Any] = {"error": f"no clean ack: {exc}"}
lost_states = states([before], after)
snap = _take_snapshot(snapshot) # what the unit holds is what tells whether it landed
if snap is not None:
lost_detail["snapshot"] = lost_states["snapshot"] = snap
finish(f"{action} was sent but the acknowledgement was lost ({exc}); the unit "
f"now reads {after}",
outcome="failed", verified="not_checked", ack=None,
error=f"no clean ack: {exc}", sent=SENT_UNKNOWN, states=states([before], after))
error=f"no clean ack: {exc}", sent=SENT_UNKNOWN, states=lost_states)
return ChangeResult(dry_run=False, sent=True, outcome="failed",
verified="not_checked", state_after=after, audit_id=cid,
detail={"error": f"no clean ack: {exc}"}, **base)
detail=lost_detail, **base)
seen = [before]
+3 -2
View File
@@ -403,8 +403,9 @@ def s4_change_call_home(client: Any, serial: str, *, enabled: bool, dry_run: boo
planned: list = []
def read_state() -> str:
if client.read_run_state().name == "calling_home":
return "calling_home"
run = client.read_run_state().name
if run == "calling_home" or run.startswith("unknown"):
return run # the core refuses both; a write waits for a known state
block = client.get_call_home_content()
reads.append(block)
return "enabled" if block[5] & 0x01 else "disabled"