feat(s3): change a MiniMate's settings by serial on the shared codec

Series3Adapter.settings reads the 1A block assembled into its 2,090
logical bytes and decodes it with micromate.setup_fields (a monitoring
unit's device-info answer is refused with 'stop monitoring first').
change_settings runs the shared change core: read the four settings
blocks, patch the settings block's fields, send Blastware's sequence
through push_config_raw with the event index, trigger and waveform blocks
as read, re-read.  Refused before sending: monitoring, a value the unit
does not allow, a stale preview.  push_config_raw's pre-check now raises
ImageRefused, so a refused image is audited as nothing sent.

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 21:46:50 -05:00
1 parent c082f72d62
commit 66bb29b9d4
5 files changed
+346 -36

No files matched your search

+12 -12
View File
@@ -11,7 +11,7 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import minimateplus.protocol as mmp_proto # noqa: E402
from device_access_fakes import FakeMiniMateClient # noqa: E402
from sfm.device_access.errors import ( # noqa: E402
ConnectFailed, MalformedReply, NoAnswer, WrongUnit,
ConnectFailed, MalformedReply, NoAnswer, UnitStateUnknown, WrongUnit,
)
from sfm.device_access.models import UnitAddress # noqa: E402
from sfm.device_access.s3 import Series3Adapter # noqa: E402
@@ -51,20 +51,20 @@ def test_status_maps_monitor_status():
assert fake.calls == ["poll", "get_monitor_status"]
def test_settings_maps_the_compliance_config():
s = adapter(FakeMiniMateClient()).settings(TCP, "BE18193")
assert s.record_mode == "Continuous"
assert (s.sample_rate, s.record_time_s, s.histogram_interval_s) == (1024, 3.0, 300)
assert s.geo_trigger_ips == 0.5
assert s.setup_name == "BRIDGE-A"
assert s.notes == {"Project": "Bridge job", "Client": "Acme", "User Name": "BH", "Seis Loc": "Loc 1"}
assert s.detail["record_mode_code"] == 0x01
def test_settings_reads_the_logical_block():
# Phase 5: the settings come from the 1A read assembled into its 2,090 bytes and
# decoded by micromate.setup_fields (tests/test_device_access_s3_settings.py has
# the rest); the fake's block is BE9441's of 2026-10-26.
fake = FakeMiniMateClient()
s = adapter(fake).settings(TCP, "BE18193")
assert (s.record_mode, s.sample_rate, s.setup_name) == ("Histogram", 4096, "Standard Recording Setup.set")
assert fake.calls.index("connect") < fake.calls.index("read_compliance_content")
def test_settings_without_a_compliance_read_is_a_malformed_reply_and_not_retried():
def test_settings_of_a_monitoring_unit_is_refused_and_not_retried():
# One fake only: a retry would ask the factory for a second and fail.
with pytest.raises(MalformedReply, match="settings"):
adapter(FakeMiniMateClient(compliance=None)).settings(TCP, "BE18193")
with pytest.raises(UnitStateUnknown, match="settings"):
adapter(FakeMiniMateClient(monitoring_settings=True)).settings(TCP, "BE18193")
def test_a_cold_unit_over_tcp_gets_one_retry():