docs(sfm): state the held-line invariant, pin the hang-up on a library error, correct the README

- Series4Session's docstring now states which errors keep the line: an
  op raises a DeviceError only for a verdict on a healthy link (not
  found, stale, unnameable), and _exchange keeps the line for those; any
  library error means the link is suspect and hangs up.  DecodeMismatch
  is a library error and hangs up -- conservative.  Later ops must keep
  to it.
- Test: a micromate TimeoutError mid-download, on a fresh DeviceAccess
  (no retry path), is NoAnswer, closes the client once and leaves no held
  line.  It pins existing behaviour; a mutation that keeps the line on
  library errors makes it fail.
- README, event rows corrected in place: another unit's id is 422 (not
  409); a stale id is 409 without downloading, both series; an event
  already stored -- including by THOR's watcher -- returns its row and
  changes nothing (detail.already_stored); MiniMate lists give
  record_type null, on the normal timeout, and fail on a lost reply.

No code behaviour change.

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-10-21 17:41:26 -04:00
1 parent 4e1e6a9d5c
commit 2a70faf7b5
3 files changed
+27 -2

No files matched your search

@@ -76,6 +76,22 @@ def test_a_ring_mid_download_releases_the_line_and_downloads_nothing():
assert fake.closed == 1 and da.held_serial(ADDR) is None
def test_a_library_error_mid_download_hangs_up():
# Only a DeviceError verdict keeps the line; anything the library raises means
# the link is suspect. A fresh DeviceAccess, so the held-line retry cannot apply.
from micromate.protocol import TimeoutError as MicromateTimeout
from sfm.device_access.errors import NoAnswer
fake = FakeMicromateClient()
def quiet(*a, **kw):
raise MicromateTimeout("quiet")
fake.fetch_event = quiet
da = access(s4=[fake])
with pytest.raises(NoAnswer):
da.download_event(ADDR, "UM20147", "UM20147:055d4a81:20250531135901")
assert fake.closed == 1 and da.held_serial(ADDR) is None
def test_a_stale_or_missing_event_keeps_the_line():
# The operation's own verdict (404/409) says nothing is wrong with the link;
# hanging up would cost a call-up for no reason.