Release v0.34.0 — Series-4 parity, and most of Blastware's report from the event file alone #59

Merged
serversdown merged 245 commits from dev into main 2026-11-04 18:19:24 -05:00
3 changed files with 30 additions and 4 deletions
Showing only changes of commit 9e03b3f0ab - Show all commits

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"
+20
View File
@@ -94,3 +94,23 @@ def test_s4_even_if_already_sends_the_no_op_write():
r = change(fake, enabled=True, even_if_already=True)
assert len(fake.executed) == 1
assert any("changes nothing" in w for w in r.plan["warnings"])
def test_s4_unknown_run_state_sends_nothing():
# Final review #3: a run state never measured is refused, as start/stop does.
from sfm.device_access.errors import UnitStateUnknown
fake = FakeMicromateClient(run_states=[0x07])
with pytest.raises(UnitStateUnknown):
change(fake, enabled=False)
assert fake.executed == []
def test_a_lost_ack_still_records_what_the_unit_holds():
# Final review #4: the lost-ack path is where the operator most needs it.
import micromate.protocol as mm_proto
fake = FakeMicromateClient(execute_error=mm_proto.TimeoutError("lost"))
r = change(fake, enabled=False)
assert (r.outcome, r.sent) == ("failed", True)
snap = r.detail["snapshot"]
assert snap["changed_offsets"] == [] and snap["before"] == snap["after"] # the write did not land