feat(sfm): POST /device/settings/change; retire the legacy config write

DeviceAccess.change_settings refuses before any I/O a request with no
changes, a live change without its preview's revision, or no audit log,
then dispatches the series' change (never retried).  The route returns
the preview (fields old -> new, warnings, blocked, revision) or the
result (fields old/new/now), statuses as the other changes, and marks
the cached by-host config dirty after a live change.

/device/config and /device/config/project now answer 410 with a pointer.
Deleted with them: MiniMateClient.apply_config / set_project_info and
the raw-offset _encode_compliance_config (#46 found it wrong), the
lab script poc_set_project.py and experiments.py's EXP6, both of which
wrote a live unit through it.  Git keeps them.

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:51:20 -05:00
1 parent 66bb29b9d4
commit e8eabee4a2
10 files changed
+316 -749

No files matched your search

+2 -27
View File
@@ -96,30 +96,5 @@ def test_a_reply_without_the_settings_block_reads_as_unknown():
(None, None, None, None)
# The write side (review finding, 2026-10-29). _encode_compliance_config patches
# the RAW bytes at offsets measured at 1024 sps (April 2026), where an escape sits
# between the mode and the anchor. At other rates the mode is one byte later, so
# a mode change rewrote the byte in front of it. A payload that would not read
# back as asked is refused before anything is sent.
from minimateplus.client import _encode_compliance_config # noqa: E402
def _block(i):
return _settings_replies()[i].ljust(2126, b"\x00") # a whole block's length
@pytest.mark.parametrize("i, change", [
(0, {"recording_mode": 0}), # 10-25 Continuous / 4096: mode sits at -7, not -8
(1, {"sample_rate": 4096}), # 10-26 Histogram+Continuous / 2048: escaped mode shifts the rate
])
def test_a_change_that_would_not_read_back_is_refused(i, change):
with pytest.raises(ValueError, match="read back"):
_encode_compliance_config(_block(i), **change)
def test_a_change_that_reads_back_as_asked_is_built():
out = _encode_compliance_config(_block(0), record_time=7.0)
cc = _decode(out)
assert (cc.recording_mode, cc.sample_rate, cc.histogram_interval_sec, cc.record_time) == \
(1, 4096, 5, 7.0)
# The write side moved to the shared settings codec in phase 5 (2026-11-03):
# tests/test_setup_fields.py reproduces every Blastware write byte for byte.