fix(settings): final-review fixes -- revision, resulting limits, logical writes

From the whole-branch review of phase 5:
- The preview's revision now covers the changes asked for, so a live
  change must be exactly what was previewed (any API caller, not only the
  page).  It covers what the preview showed -- the settings block (and a
  Micromate's setup name) -- not the blocks a write only echoes, which are
  re-read at send and sent as read (a MiniMate's trigger block byte 5
  differs by session, #46).
- The units' limits hold on the block that would result: a range, rate or
  mode change alone can no longer leave a held trigger, alarm or record
  time over them.
- Every MiniMate block read is logical, so push_config_raw no longer
  unescapes again (a job number of 4098, 10 02, was refused at Send); the
  preview runs the write's own block check, so a block it would refuse is
  shown as blocked.
- A MiniMate's monitoring refusal says a stop makes it call in (spec).

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-03 22:10:49 -05:00
1 parent 385716d8e1
commit 08d0a6c0d4
9 files changed
+209 -43

No files matched your search

+24 -8
View File
@@ -321,10 +321,14 @@ def check_changes(content: bytes, series: int, changes: Dict[str, Any]) -> Dict[
raise SettingsValueError(f"{field} is {len(v)} characters; the unit holds {NOTE_MAX}")
out[field] = v
# What depends on this unit's block, with the NEW mode / rate / range if they change too.
# What depends on this unit's block, with the NEW mode / rate / range if they change
# too -- checked on the block that would RESULT, so a one-field change (the range,
# the rate, the mode) cannot leave a value the unit already holds over its limit
# (final review, 2026-11-03).
c = content
if "record_time_s" in out:
t = out["record_time_s"]
if any(f in out for f in ("record_time_s", "sample_rate", "record_mode")):
t = out.get("record_time_s", _shown(_f32(c, _RECORD_TIME)))
held = "" if "record_time_s" in out else f" (the unit holds {t:g} s; change the record time too)"
if series == 4:
top: Optional[float] = S4_MAX_RECORD_S
else:
@@ -334,18 +338,23 @@ def check_changes(content: bytes, series: int, changes: Dict[str, Any]) -> Dict[
raise SettingsValueError(f"this unit's sample rate ({rate}) has no record-time limit "
"in the manual -- set the sample rate too")
if not RECORD_MIN_S <= t <= top:
raise SettingsValueError(f"record_time_s must be {RECORD_MIN_S}-{top:g} s here, not {t}")
if any(f in out for f in _LEVELS):
raise SettingsValueError(f"record_time_s must be {RECORD_MIN_S}-{top:g} s here, not {t}{held}")
if any(f in out for f in (*_LEVELS, "geo_range")):
units = _unit_string(c)
if any(u != "in" for u in units):
raise SettingsValueError(f"this unit's geophone channels read {units}, not in/s -- only "
"in/s is measured, so SFM will not change a level")
"in/s is measured, so SFM will not change a level or the range")
full = _full_scale(c, series, out.get("geo_range"))
if full is None:
raise SettingsValueError("this unit's geophone range byte is not a value ever measured")
held_levels = {"geo_trigger_ips": _CH_TRIGGER, "geo_alarm_ips": _CH_ALARM}
for f in _LEVELS:
if f in out and out[f] > full:
raise SettingsValueError(f"{f} {out[f]} in/s is above the range's full scale ({full} in/s)")
if f not in _SERIES_FIELDS[series]:
continue
v = out.get(f, _shown(_f32(c, _ch(0) + held_levels[f])))
if v > full:
held = "" if f in out else " (the unit holds it)"
raise SettingsValueError(f"{f} {v} in/s is above the range's full scale ({full} in/s){held}")
return out
@@ -420,3 +429,10 @@ def settings_state(before: bytes, written: bytes, now: bytes, *, series: int) ->
def revision(blocks: List[bytes]) -> str:
"""A short fingerprint of the blocks a preview read; a live change must match it."""
return hashlib.sha256(b"".join(bytes(b) for b in blocks)).hexdigest()[:16]
def changes_bytes(changes: Dict[str, Any]) -> bytes:
"""The normalised changes, canonically: part of a preview's revision, so a live
change must ask for exactly what was previewed (final review, 2026-11-03)."""
import json
return json.dumps(changes, sort_keys=True, separators=(",", ":")).encode("ascii")
+11 -5
View File
@@ -915,6 +915,8 @@ class MiniMateClient:
compliance_data: bytes,
trigger_data: bytes,
waveform_data: bytes,
*,
escaped: bool = False,
) -> None:
"""
Push a complete config update to the device using the confirmed write
@@ -942,6 +944,10 @@ class MiniMateClient:
trigger_data: Raw bytes for SUB 82 write (44-byte trigger config).
waveform_data: Raw bytes for SUB 69 write.
`escaped`: False (the default) -- the blocks are logical, as every block
read returns them since phase 5; True for blocks that still hold the
parser's kept escape bytes.
Raises:
RuntimeError: if the client is not connected.
ProtocolError: if any write step fails (timeout, bad ack SUB).
@@ -960,29 +966,29 @@ class MiniMateClient:
(SUB_TRIGGER_CONFIG_WRITE, trigger_data),
(SUB_WAVEFORM_DATA_WRITE, waveform_data)):
try:
write_image(sub, data)
write_image(sub, data, escaped=escaped)
except ValueError as exc: # refused before any frame: the caller audits "nothing sent"
raise ImageRefused(str(exc)) from exc
# 68 → 73
log.info("push_config_raw: write event index (SUB 68)")
proto.write_event_index(event_index_data)
proto.write_event_index(event_index_data, escaped=escaped)
log.info("push_config_raw: confirm B (SUB 73)")
proto.write_confirm(SUB_WRITE_CONFIRM_B)
# 71×3 → 72 (handled internally by write_compliance_config_raw)
log.info("push_config_raw: write compliance config (SUB 71 ×3 + confirm 72)")
proto.write_compliance_config_raw(compliance_data)
proto.write_compliance_config_raw(compliance_data, escaped=escaped)
# 82 → 83
log.info("push_config_raw: write trigger config (SUB 82)")
proto.write_trigger_config(trigger_data)
proto.write_trigger_config(trigger_data, escaped=escaped)
log.info("push_config_raw: trigger confirm (SUB 83)")
proto.write_confirm(SUB_TRIGGER_CONFIRM)
# 69 → 74 → 72
log.info("push_config_raw: write waveform data (SUB 69)")
proto.write_waveform_data(waveform_data)
proto.write_waveform_data(waveform_data, escaped=escaped)
log.info("push_config_raw: confirm C (SUB 74)")
proto.write_confirm(SUB_WRITE_CONFIRM_C)
log.info("push_config_raw: confirm A (SUB 72)")
+18 -12
View File
@@ -142,9 +142,14 @@ _WRITE_TAIL = {SUB_EVENT_INDEX_WRITE: b"\x02\x00", SUB_TRIGGER_CONFIG_WRITE: b"\
SUB_CALL_HOME_WRITE: b"\x00\x00"}
def write_image(sub: int, data: bytes) -> bytes:
def write_image(sub: int, data: bytes, *, escaped: bool = True) -> bytes:
"""The whole block a write sends: `data` unescaped, N + 2 bytes.
`escaped=False`: `data` is already logical (every block read since phase 5 --
read_event_index, read_compliance_content, read_trigger_config,
read_waveform_data_raw -- returns unescaped bytes), so it is NOT unescaped
again: a logical `10 02` (job number 4098) would otherwise collapse.
A config block starts with its own length N (uint16 BE) and is written as N
bytes plus two -- on every Blastware write on record. `data` may be the
block as a read returned it (N bytes, or N + 2) and may still hold the
@@ -152,7 +157,7 @@ def write_image(sub: int, data: bytes) -> bytes:
Anything else is refused before a byte is sent: a block one byte longer than
its header says is what an edit beside a kept escape byte leaves behind.
"""
image = unescape_reply(bytes(data))
image = unescape_reply(bytes(data)) if escaped else bytes(data)
if len(image) < 2:
raise ValueError(f"write SUB 0x{sub:02X}: {len(image)} bytes is not a whole block")
n = int.from_bytes(image[:2], "big")
@@ -1132,25 +1137,26 @@ class MiniMateProtocol:
self._send(frame)
return self.recv_write_ack(expected_sub=rsp_sub)
def _write_block(self, sub: int, data: bytes, params: bytes = bytes(10)) -> S3Frame:
def _write_block(self, sub: int, data: bytes, params: bytes = bytes(10), *,
escaped: bool = True) -> S3Frame:
"""Send one config block as a write and return its ack (0xFF - sub)."""
image = write_image(sub, data)
image = write_image(sub, data, escaped=escaped)
frame = build_bw_write_frame(sub, image, params=params)
log.debug("write SUB=0x%02X: %d-byte image", sub, len(image))
self._send(frame)
return self.recv_write_ack(expected_sub=_expected_rsp_sub(sub))
def write_event_index(self, data: bytes) -> S3Frame:
def write_event_index(self, data: bytes, *, escaped: bool = True) -> S3Frame:
"""SUB 68: write the event-index block (as SUB 08 read it). Ack 0x97;
callers follow with write_confirm(SUB_WRITE_CONFIRM_B). See write_image."""
return self._write_block(SUB_EVENT_INDEX_WRITE, data)
return self._write_block(SUB_EVENT_INDEX_WRITE, data, escaped=escaped)
def write_waveform_data(self, data: bytes) -> S3Frame:
def write_waveform_data(self, data: bytes, *, escaped: bool = True) -> S3Frame:
"""SUB 69: write the waveform-data block (as SUB 09 read it). Ack 0x96;
callers follow with write_confirm C then A. See write_image."""
return self._write_block(SUB_WAVEFORM_DATA_WRITE, data)
return self._write_block(SUB_WAVEFORM_DATA_WRITE, data, escaped=escaped)
def write_compliance_config_raw(self, data: bytes) -> None:
def write_compliance_config_raw(self, data: bytes, *, escaped: bool = True) -> None:
"""SUB 71: write the compliance image in addressed chunks, then confirm (72).
Measured: the image is 2,092 bytes (its header N = 2,090, plus 2), sent as
@@ -1161,7 +1167,7 @@ class MiniMateProtocol:
both. (Retracted: "exactly 3 chunks, offset 0x1004, params 00 00 00 10 04"
-- the length 0x0400 and address 0x0400, read with their escape bytes.)
"""
image = write_image(SUB_COMPLIANCE_WRITE, data)
image = write_image(SUB_COMPLIANCE_WRITE, data, escaped=escaped)
rsp_sub = _expected_rsp_sub(SUB_COMPLIANCE_WRITE)
for addr in range(0, len(image), _COMPLIANCE_CHUNK):
params = bytes([0x00, 0x00, (addr >> 8) & 0xFF, addr & 0xFF]) + bytes(6)
@@ -1172,10 +1178,10 @@ class MiniMateProtocol:
self.recv_write_ack(expected_sub=rsp_sub)
self.write_confirm(SUB_WRITE_CONFIRM_A)
def write_trigger_config(self, data: bytes) -> S3Frame:
def write_trigger_config(self, data: bytes, *, escaped: bool = True) -> S3Frame:
"""SUB 82: write the trigger block (as SUB 0x2E read it). Ack 0x7D;
callers follow with write_confirm(SUB_TRIGGER_CONFIRM). See write_image."""
return self._write_block(SUB_TRIGGER_CONFIG_WRITE, data)
return self._write_block(SUB_TRIGGER_CONFIG_WRITE, data, escaped=escaped)
def read_trigger_config(self) -> bytes:
"""SUB 0x2E two-step read: the 26-byte trigger block that SUB 82 writes.
+32 -13
View File
@@ -13,18 +13,19 @@ from minimateplus.event_file_io import _GEO_INT16_FS
from minimateplus.framing import build_bw_write_frame, unescape_reply
from micromate.setup_block import decode_setup
from micromate.setup_fields import (
SettingsValueError, check_changes, editable_fields, encode_setup, field_rows, field_values,
settings_state,
SettingsValueError, changes_bytes, check_changes, editable_fields, encode_setup, field_rows,
field_values, settings_state,
)
from micromate.setup_fields import revision as settings_revision
from minimateplus.protocol import (
SUB_CALL_HOME_CONFIRM, SUB_CALL_HOME_WRITE, SUB_START_MONITORING, SUB_STOP_MONITORING,
SUB_CALL_HOME_CONFIRM, SUB_CALL_HOME_WRITE, SUB_COMPLIANCE_WRITE, SUB_EVENT_INDEX_WRITE,
SUB_START_MONITORING, SUB_STOP_MONITORING, SUB_TRIGGER_CONFIG_WRITE, SUB_WAVEFORM_DATA_WRITE,
ImageRefused, call_home_enabled, call_home_image, is_call_home_block, is_compliance_content,
write_image,
)
from minimateplus.transport import TcpTransport
from .errors import (BadRequest, DeviceError, EventNotFound, MalformedReply, NoAnswer, NotSupported,
from .errors import (BadRequest, ChangeRefused, DeviceError, EventNotFound, MalformedReply, NoAnswer, NotSupported,
SettingsChanged, StaleEvent, UnitStateUnknown, WrongUnit, translate)
from .change import call_home_change, monitoring_change, run_change, settings_change
from .events import iso_of, make_event_id, stamp_of
@@ -59,7 +60,8 @@ S3_CALL_HOME_WHILE_MONITORING = ("did not return its call-home settings -- a Min
# Measured 2026-11-03 (BE9441's 10-26 recording, 5 / 5 reads): while monitoring, a
# MiniMate answers the 1A settings read with its device-info block.
S3_SETTINGS_WHILE_MONITORING = ("did not return its settings -- a MiniMate answers this way "
"while monitoring; stop monitoring first")
"while monitoring; stop monitoring first (a stop makes it call in "
"if call-home is on)")
# Blastware's settings write, in its order (push_config_raw): event index, the
# settings block in addressed chunks, trigger, waveform data, with their confirms.
_S3_SETTINGS_STEPS = ((0x68, "event index (as read)"), (0x73, "confirm B"),
@@ -490,12 +492,25 @@ class Series3Adapter:
normal = check_changes(setup, 3, changes)
except SettingsValueError as exc:
raise BadRequest(f"{exc} -- nothing sent") from exc
rev = settings_revision([blocks["event_index"], setup, blocks["trigger"], blocks["waveform"]])
# What the preview showed: the settings block and the changes. The other
# three blocks are re-read here and sent back as read (the trigger block's
# byte 5 "differs by unit and session", #46).
rev = settings_revision([setup, changes_bytes(normal)])
if not dry_run and revision != rev:
raise SettingsChanged(f"{serial}'s settings changed since the preview -- "
"preview again; nothing sent")
raise SettingsChanged(f"{serial}'s settings, or the changes asked for, are not "
"the ones previewed -- preview again; nothing sent")
image = encode_setup(setup, 3, normal)
st.update(blocks=blocks, setup=setup, image=image, changes=normal, revision=rev)
blocked = []
for sub, block in ((SUB_EVENT_INDEX_WRITE, blocks["event_index"]),
(SUB_COMPLIANCE_WRITE, image),
(SUB_TRIGGER_CONFIG_WRITE, blocks["trigger"]),
(SUB_WAVEFORM_DATA_WRITE, blocks["waveform"])):
try:
write_image(sub, block, escaped=False) # push_config_raw's own check
except ValueError as exc:
blocked.append(f"this unit's {exc} -- SFM has not seen a block like it")
st.update(blocks=blocks, setup=setup, image=image, changes=normal, revision=rev,
blocked=blocked)
reads.append(setup)
return settings_state(setup, image, setup, series=3)
@@ -503,15 +518,19 @@ class Series3Adapter:
b = st["blocks"]
lens = {0x68: len(b["event_index"]), 0x71: len(st["image"]) + 2,
0x82: len(b["trigger"]), 0x69: len(b["waveform"])}
return {"action": "settings write", "blocked": [],
"steps": [{"sub": f"0x{sub:02X}", "what": what, "data_len": lens.get(sub, 0)}
for sub, what in _S3_SETTINGS_STEPS],
if st["blocked"] and not dry_run:
raise ChangeRefused("; ".join(st["blocked"]) + " -- nothing sent")
steps = [] if st["blocked"] else [
{"sub": f"0x{sub:02X}", "what": what, "data_len": lens.get(sub, 0)}
for sub, what in _S3_SETTINGS_STEPS]
return {"action": "settings write", "blocked": list(st["blocked"]), "steps": steps,
"fields": field_rows(st["setup"], st["image"], 3, st["changes"]),
"revision": st["revision"], "warnings": [_S3_TAIL_WARNING]}
def send() -> dict:
b = st["blocks"]
client.push_config_raw(b["event_index"], st["image"], b["trigger"], b["waveform"])
client.push_config_raw(b["event_index"], st["image"], b["trigger"], b["waveform"],
escaped=False) # every block read is logical
return {"subs": [f"0x{0xFF - sub:02X}" for sub, _ in _S3_SETTINGS_STEPS]}
def snapshot() -> dict:
+7 -4
View File
@@ -23,7 +23,8 @@ from micromate.protocol import ProtocolError as _MMProtocolError
from micromate.schedule import parse_schedule, schedule_conflicts
from micromate.setup_block import decode_setup
from micromate.setup_fields import (
SettingsValueError, check_changes, editable_fields, encode_setup, field_rows, settings_state,
SettingsValueError, changes_bytes, check_changes, editable_fields, encode_setup, field_rows,
settings_state,
)
from micromate.setup_fields import revision as settings_revision
from micromate.writes import (
@@ -503,10 +504,12 @@ def s4_change_settings(client: Any, serial: str, *, changes: dict, revision: Opt
normal = check_changes(setup, 4, changes)
except SettingsValueError as exc:
raise BadRequest(f"{exc} -- nothing sent") from exc
rev = settings_revision([name.encode("ascii", "replace"), prefs, trigger, setup])
# What the preview showed: the target name, the setup block, the changes. The
# preferences and trigger blocks are re-read here and sent back as read.
rev = settings_revision([name.encode("ascii", "replace"), setup, changes_bytes(normal)])
if not dry_run and revision != rev:
raise SettingsChanged(f"{serial}'s settings changed since the preview -- preview "
"again; nothing sent")
raise SettingsChanged(f"{serial}'s settings, or the changes asked for, are not the ones "
"previewed -- preview again; nothing sent")
image = encode_setup(setup, 4, normal)
blocked: list = []
warnings = [_EDIT_BUFFER_WARNING]
+2 -1
View File
@@ -233,7 +233,8 @@ class FakeMiniMateClient(_Base):
blocks["compliance"] = s3_device_info_answer()
return blocks
def push_config_raw(self, event_index, compliance, trigger, waveform) -> None:
def push_config_raw(self, event_index, compliance, trigger, waveform, *, escaped=False) -> None:
self.pushed_escaped = escaped
self.pushed = (bytes(event_index), bytes(compliance), bytes(trigger), bytes(waveform))
self._write("push_config_raw")
self.settings_blocks["compliance"] = bytes(compliance)[:2090] # read back as the unit stores it
+77
View File
@@ -154,3 +154,80 @@ def test_push_config_raw_precheck_raises_image_refused():
with pytest.raises(ImageRefused):
c.push_config_raw(b["event_index"], b["compliance"][:2089], b["trigger"], b["waveform"])
assert t.sent == []
# Final review #1: the revision covers the changes previewed, not only the unit.
def test_s3_a_revision_covers_the_changes_previewed():
fake = FakeMiniMateClient()
rev = change(fake, {"job_number": 7}, dry_run=True).plan["revision"]
with pytest.raises(SettingsChanged):
change(fake, {"geo_trigger_ips": 0.05}, revision=rev)
assert fake.writes == []
# Ruling: the trigger block's byte 5 "differs by unit and session" (#46); the three
# echoed blocks are re-read at send and sent as read, so they are not in the revision.
def test_s3_an_echoed_block_moving_does_not_stale_the_preview():
fake = FakeMiniMateClient()
rev = change(fake, {"geo_trigger_ips": 0.05}, dry_run=True).plan["revision"]
trig = bytearray(fake.settings_blocks["trigger"])
trig[5] = 0x03
fake.settings_blocks["trigger"] = bytes(trig)
assert change(fake, {"geo_trigger_ips": 0.05}, revision=rev).verified == "ok"
assert fake.pushed[2] == bytes(trig) # sent as read at send time
# Final review #4 (spec): the refusal says a stop makes the unit call in.
def test_s3_monitoring_refusal_says_a_stop_calls_in():
with pytest.raises(UnitStateUnknown) as e:
change(FakeMiniMateClient(monitoring_settings=True), {"geo_trigger_ips": 0.05}, dry_run=True)
assert "call in" in str(e.value) and "call-home" in str(e.value)
# Final review #3: the blocks are logical bytes; a block holding a literal
# 10 02 / 10 03 / 10 04 (job number 4098 = 0x1002) must be written intact, and a
# block the write would refuse must show in the preview, not only at Send.
def test_s3_a_bad_echoed_block_is_blocked_in_the_preview():
fake = FakeMiniMateClient()
fake.settings_blocks["event_index"] = fake.settings_blocks["event_index"][:-1]
r = change(fake, {"geo_trigger_ips": 0.05}, dry_run=True)
assert r.plan["blocked"] and r.plan["steps"] == []
from sfm.device_access.errors import ChangeRefused
with pytest.raises(ChangeRefused):
change(fake, {"geo_trigger_ips": 0.05}, revision=r.plan["revision"])
assert fake.writes == []
def _acking():
from minimateplus.framing import build_bw_write_frame # noqa: F401 (frames are parsed below)
from test_minimate_write_frames import _payload
class Acks:
def __init__(self):
self.sent, self._buf = [], b""
def write(self, data):
data = bytes(data)
self.sent.append(data)
sub = _payload(data)[2]
body = bytes([0x00, 0x10, 0xFF - sub, 0x00, 0x00]) + bytes(11)
body += bytes([sum(body) & 0xFF])
self._buf += b"\x10\x02" + body.replace(b"\x10", b"\x10\x10") + b"\x03"
def read(self, n):
out, self._buf = self._buf[:n], self._buf[n:]
return out
return Acks()
def test_push_config_raw_writes_a_logical_block_with_a_literal_escape_byte_intact():
from test_minimate_write_frames import _payload
t = _acking()
c = MiniMateClient("unused")
c._proto = mp.MiniMateProtocol(t, recv_timeout=0.5)
b = s3_settings_blocks()
block = encode_setup(b["compliance"], 3, {"job_number": 4098}) # [40:42] = 10 02
assert block[40:42] == b"\x10\x02"
c.push_config_raw(b["event_index"], block, b["trigger"], b["waveform"])
sent = b"".join(_payload(f)[16:] for f in t.sent if _payload(f)[2] == 0x71)
assert sent == block + b"\x00\x00"
+21
View File
@@ -169,3 +169,24 @@ def test_s4_unseen_block_size_is_blocked():
with pytest.raises(ChangeRefused):
change(fake, {"geo_trigger_ips": 0.3}, revision=r.plan["revision"])
assert fake.executed == []
# Final review #1: the revision covers the changes previewed, not only the unit.
def test_s4_a_revision_covers_the_changes_previewed():
fake = FakeMicromateClient()
rev = change(fake, {"job_number": 7}, dry_run=True).plan["revision"]
with pytest.raises(SettingsChanged):
change(fake, {"geo_trigger_ips": 0.3}, revision=rev)
assert fake.executed == []
# Ruling (final review, declined-to-judge): the blocks a push only echoes are
# re-read at send and sent as read, so they are not part of the revision.
def test_s4_an_echoed_block_moving_does_not_stale_the_preview():
fake = FakeMicromateClient()
rev = change(fake, {"geo_trigger_ips": 0.3}, dry_run=True).plan["revision"]
from micromate.setup_block import with_crc
prefs = bytearray(fake.prefs)
prefs[31] ^= 0x01
fake.prefs = with_crc(bytes(prefs))
assert change(fake, {"geo_trigger_ips": 0.3}, revision=rev).verified == "ok"
+17
View File
@@ -288,3 +288,20 @@ def test_editable_fields_describe_both_series():
assert s3["note_1"]["label"] == "Project" and s3["note_1"]["maxlength"] == 41
assert s4["note_1"]["label"] == "Location"
assert s4["record_time_s"]["max"] == 90.0 and s3["record_time_s"]["max"] == 26.0
# Final review #2: the limits hold on the block that would result, not only on the
# fields in the request -- a one-field change must not leave the unit over them.
def test_limits_hold_on_the_resulting_block():
hot = encode_setup(S3_BLOCK, 3, {"geo_trigger_ips": 2.0})
_refused(hot, 3, {"geo_range": "sensitive"}) # trigger 2.0 > 1.25
alarm = bytearray(S3_BLOCK)
struct.pack_into(">f", alarm, 1708 + 38, 2.0)
for k in (1, 2):
struct.pack_into(">f", alarm, 1708 + 48 * k + 38, 2.0)
_refused(bytes(alarm), 3, {"geo_range": "sensitive"}) # alarm 2.0 > 1.25
_refused(S3_BLOCK, 3, {"record_mode": "histogram_continuous"}) # it holds 20 s; combo max 13
slow = encode_setup(S3_BLOCK, 3, {"sample_rate": 1024, "record_time_s": 100.0})
_refused(slow, 3, {"sample_rate": 4096}) # 100 s > 26 at 4096
assert check_changes(S3_BLOCK, 3, {"note_1": "x"}) # nothing limit-related touched
assert check_changes(hot, 3, {"geo_range": "normal"}) # 2.0 <= 10