fix(sfm): start/stop HTTP status is an allow-list -- only verified, skipped or dry-run is 200
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
c3e7e169c0
commit
ac33c8ffa4
2 files changed
+26
-7
No files matched your search
+4
-3
@@ -388,9 +388,10 @@ def _change_response(fn) -> JSONResponse:
|
||||
DeviceError mapping is _via_device_access's -- not repeated here.
|
||||
"""
|
||||
body = _via_device_access(fn)
|
||||
status = 200
|
||||
if body["outcome"] == "failed":
|
||||
status = 409 if body["verified"] == "mismatch" else 502
|
||||
# An allow-list: only a dry run, a skip, or a change read back as made is a 200.
|
||||
ok = (body["outcome"] in ("dry_run", "skipped")
|
||||
or (body["outcome"] == "sent" and body["verified"] == "ok"))
|
||||
status = 200 if ok else (409 if body["verified"] == "mismatch" else 502)
|
||||
return JSONResponse(status_code=status, content=body)
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user