Release v0.34.0 — Series-4 parity, and most of Blastware's report from the event file alone #59
No files matched your search
@@ -179,8 +179,8 @@ via a thread-safe `_LiveCache` (plain Python dict + `threading.Lock`):
|
||||
| `POST` | `/device/call_home` | Reads, patches specified fields, writes back to device |
|
||||
| `GET` | `/device/settings` | Recording settings in the shared model, either series; serial required; never cached |
|
||||
| `POST` | `/device/hangup` | Releases a held Series-4 line now; `{"hung_up": bool}` |
|
||||
| `GET` | `/device/events?serial=` | Lists a unit's events, either series, each with an opaque `event_id` (`serial:key:timestamp`). A MiniMate list reads headers only (no bulk download) |
|
||||
| `POST` | `/device/events/download?serial=&event_id=` | Downloads one event, checks it, and stores it in SFM's database; returns `db_event_id` (file at `GET /db/events/{db_event_id}/blastware_file`). A stale `event_id` (unit erased or wrapped since the list) or one from another unit gets **409**, with no download. Re-downloading refreshes the stored row (same `db_event_id`, `inserted: false`). The unit is busy for the whole download; other requests to it get 423 |
|
||||
| `GET` | `/device/events?serial=` | Lists a unit's events, either series, each with an opaque `event_id` (`serial:key:timestamp`). A MiniMate list reads headers only (no bulk download), on the normal timeout, and gives `record_type: null` (its event record does not say waveform or histogram; not decoded yet). A lost reply fails the list rather than shortening it |
|
||||
| `POST` | `/device/events/download?serial=&event_id=` | Downloads one event, checks it, and stores it in SFM's database; returns `db_event_id` (file at `GET /db/events/{db_event_id}/blastware_file`). A stale `event_id` (unit erased or wrapped since the list) gets **409** without downloading, for both series; an `event_id` from another unit gets **422**, before any I/O. An event already stored — by an earlier download, or by THOR's watcher — returns its existing row and changes nothing (same `db_event_id`, `inserted: false`, `detail.already_stored: true`). The unit is busy for the whole download; other requests to it get 423 |
|
||||
|
||||
**Cache bypass** — All cached endpoints accept `?force=true` to skip the cache and
|
||||
force a fresh read from the device.
|
||||
|
||||
@@ -112,6 +112,15 @@ class Series4Session:
|
||||
`last_traffic` is any exchange, keep-alives included: the keep-alive
|
||||
schedule measures it. If keep-alives counted as use, the line would never
|
||||
go idle.
|
||||
|
||||
Invariant -- which errors keep the line. An operation raises a
|
||||
`DeviceError` only for a verdict reached over a healthy link: the event is
|
||||
not there, the id is stale, the record cannot be named. `_exchange` keeps
|
||||
the line for those. Anything the library raises means the link is
|
||||
suspect, and `_exchange` hangs up. `DecodeMismatch` is a library error,
|
||||
so it hangs up too -- conservative, since the link may be fine. Operations
|
||||
added in later phases must keep to this: never wrap a link failure in a
|
||||
`DeviceError` inside an op, or the line stays open on a broken link.
|
||||
"""
|
||||
|
||||
def __init__(self, address: UnitAddress, serial: str,
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in new issue
Block a user