fix(device_access): a start's read-back waits out the sensor check, then wakes the MiniMate with retries
Second start through SFM, BE9441 2026-10-26 23:54:41: acked 0x69, and Brian saw 'starting, performing sensor check, recording' -- but the read-back's single SESSION_RESET + POLL went out 2.3 s after the ack, inside the ~30 s sensor check, and was never answered or re-sent (504 after 120 s, audit ca7b5b42). Brian: every unit is set to sensor-check before monitoring, ~30 s, then 'Recording...'. - MiniMateProtocol.wake(attempt_s, deadline_s): SESSION_RESET + POLL re-sent every attempt_s until the unit answers, then the POLL data step; a named timeout at the deadline. Reads only. MiniMateClient.wake() wraps it. - The Series-3 change: after a START, the first read waits S3_SENSOR_CHECK_S (30 s) before asking; every read then wakes with retries (every 5 s, up to 60 s). A stop is unchanged -- its read-back was confirmed three times tonight. Tests: a unit deaf for 4 probes is asked a 5th time and answers; a unit that never answers ends in the named timeout after ~6 probes; a start's first read waits the sensor check, a stop's does not; every read is preceded by a wake. 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
9886422212
commit
ca5c401c6f
6 files changed
+166
-9
No files matched your search
@@ -328,7 +328,7 @@ from device_access_fakes import FakeMiniMateClient # no
|
||||
TCP3 = UnitAddress(host="10.0.0.6", tcp_port=12345, port=None, baud=None)
|
||||
|
||||
|
||||
def access3(fake, audit="default"):
|
||||
def access3(fake, audit="default", sleep=lambda s: None):
|
||||
seen = []
|
||||
|
||||
def factory(a, **kw):
|
||||
@@ -336,7 +336,7 @@ def access3(fake, audit="default"):
|
||||
return fake
|
||||
da = DeviceAccess(s3_client_factory=factory, start_reaper=False,
|
||||
audit=Audit() if audit == "default" else audit,
|
||||
sleep=lambda s: None, verify_timeout_s=6.0, verify_interval_s=2.0)
|
||||
sleep=sleep, verify_timeout_s=6.0, verify_interval_s=2.0)
|
||||
da.factory_calls = seen
|
||||
return da
|
||||
|
||||
@@ -784,4 +784,16 @@ def test_series3_wakes_the_unit_before_every_state_read():
|
||||
assert r.outcome == "sent" and r.verified == "ok"
|
||||
after = fake.calls[fake.calls.index("start_monitoring") + 1:]
|
||||
reads = [i for i, c in enumerate(after) if c == "get_monitor_status"]
|
||||
assert reads and all(after[i - 1] == "poll" for i in reads)
|
||||
assert reads and all(after[i - 1] == "wake" for i in reads)
|
||||
|
||||
|
||||
def test_series3_a_start_waits_out_the_sensor_check_before_its_first_read():
|
||||
# Brian (2026-10-26): every unit runs a ~30 s sensor check before
|
||||
# "Recording..."; a stop's read-back needs no such wait.
|
||||
from sfm.device_access.s3 import S3_SENSOR_CHECK_S
|
||||
for start, waited in ((True, True), (False, False)):
|
||||
slept = []
|
||||
fake = FakeMiniMateClient(monitor_states=[not start, start])
|
||||
da = access3(fake, sleep=slept.append)
|
||||
(da.start_monitoring if start else da.stop_monitoring)(TCP3, "BE18193")
|
||||
assert (S3_SENSOR_CHECK_S in slept) is waited
|
||||
Reference in new issue
Block a user