refactor(sfm): run_change takes a ChangeKind -- start/stop unchanged, call-home next (phase 4)
run_change named its change and its target state from a start/stop bool. A ChangeKind (action, want, became) now says what the change is called and which state read back means it took; monitoring_change(start) gives exactly today's names, call_home_change(enabled) the new ones. An optional snapshot hook records what the unit holds after the change in the result and the audit row (never the verdict; one that raises is recorded as its error). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
This commit is contained in:
1 parent
5b37ea22cc
commit
1dd5bfa464
4 files changed
+136
-11
No files matched your search
@@ -26,7 +26,7 @@ from .errors import (
|
||||
AuditIncomplete, CallHomeInProgress, ChangeUnconfirmed, DeviceError, EventNotFound,
|
||||
MalformedReply, StaleEvent, WrongUnit, translate,
|
||||
)
|
||||
from .change import CALL_HOME_MESSAGE, run_change
|
||||
from .change import CALL_HOME_MESSAGE, monitoring_change, run_change
|
||||
from .events import iso_of, make_event_id, stamp_of
|
||||
from .models import ChangeResult, DownloadedEvent, EventList, EventRef, UnitAddress, UnitInfo, UnitSettings, UnitStatus
|
||||
from .series import normalise_serial
|
||||
@@ -357,7 +357,8 @@ def s4_change_monitoring(client: Any, serial: str, *, start: bool, dry_run: bool
|
||||
return {"subs": [f"0x{a.sub:02X}" for a in acks], "data": [bytes(a.data).hex() for a in acks]}
|
||||
|
||||
return run_change(
|
||||
serial=serial, series=4, start=start, dry_run=dry_run, even_if_already=even_if_already,
|
||||
kind=monitoring_change(start), serial=serial, series=4, dry_run=dry_run,
|
||||
even_if_already=even_if_already,
|
||||
audit=audit, address=address, caller=caller, sleep=sleep,
|
||||
verify_timeout_s=verify_timeout_s, verify_interval_s=verify_interval_s,
|
||||
read_serial=lambda: client.serial(refresh=True),
|
||||
|
||||
Reference in new issue
Block a user