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

+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"