+113
−15
Loading
Four defects in one fifteen-line block; they are one change because each edit
sits inside the previous one.
Scope. The 422 branch lived in the shared _request, so a location-retrieval
rule applied to every SRM call. An SRM 422 during a zone read became a CAMARA
422 SERVICE_NOT_APPLICABLE where it had previously been a 503 -- and neither
the EAM nor the QoD vendored spec documents a 422 at all, so OEG could emit a
status its own contract excludes. _request now translates only when a caller
passes a `problems` table; retrieve_location is the only one that does.
Signal. The mapping keyed on problem["code"]. SRM answers RFC 7807
(REQ-SRM-10), which defines type/title/status/detail/instance and no `code`,
and the vocabulary it matched appears nowhere in the architecture bundle. Every
422 therefore fell through to the fallback, making the four specific CAMARA
codes unreachable in production. Now keyed on `type`, RFC 7807's
machine-readable problem identifier -- no extension member needed -- against
the vocabulary in srm/interface-contract.md E.2. An unknown type still
degrades to SERVICE_NOT_APPLICABLE, so SRM can add one without waiting on OEG.
Trust boundary. The outward `message` was SRM's `detail`, which is internal
diagnostic prose ("adapter oai-nef-01 timed out on subscriber 262011234567890")
and crosses to the app provider. Messages now come from the vendored CAMARA
spec; `detail` is logged instead.
Robustness. response.json() sat inside a try that catches only httpx errors, so
a 422 carrying an HTML error page, an empty body, or a JSON array escaped as
JSONDecodeError/AttributeError and surfaced as 500 -- blaming OEG for a
downstream fault. An unreadable body now falls through to the >= 400 branch and
becomes 503. That is deliberately distinct from an unrecognized type: there SRM
refused, here we cannot confirm the response even came from SRM.
test_eam_contract's _request doubles gain the new parameter. The unit suite
passed without that; mypy caught it.
Co-Authored-By:
Claude Opus 5 <noreply@anthropic.com>