fix(micromate): a write plan copies its steps -- nothing can be added after validation
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
49f8f49ac1
commit
cbda4b80df
2 files changed
+43
-9
No files matched your search
@@ -56,6 +56,8 @@ class WritePlan:
|
||||
steps: Tuple[WriteStep, ...]
|
||||
|
||||
def __post_init__(self) -> None:
|
||||
# Copy: a caller's list must not be able to add a step after validation.
|
||||
object.__setattr__(self, "steps", tuple(self.steps))
|
||||
for s in self.steps:
|
||||
if s.sub in CROSS_SERIES_COLLISIONS:
|
||||
raise OpcodeRefused(
|
||||
@@ -117,6 +119,11 @@ def plan_setup_push(prefs: bytes, trigger: bytes, setup: bytes, name: str) -> Wr
|
||||
No field editing here (phase 5). Each block goes back with its length echo
|
||||
[0:3] zeroed; the unit recomputes the CRCs, so 0x68 and 0x71 drop the CRC
|
||||
slot and 0x82 sends it zeroed -- exactly THOR's frames.
|
||||
|
||||
The name goes out exactly as given. `MicromateClient.get_active_setup()`
|
||||
strips whitespace, so a setup name with leading or trailing spaces would
|
||||
not round-trip through it; phase 5 decides whether to take the unstripped
|
||||
name from the 0x41 read.
|
||||
"""
|
||||
_checked(prefs, _PREFS_LEN, "preferences (0x08)")
|
||||
_checked(trigger, _TRIGGER_LEN, "trigger (0x2E)")
|
||||
|
||||
Reference in new issue
Block a user