Skip to content

docs(decoders): document the can_decode no-raise obligation#49

Merged
lesnik512 merged 1 commit into
mainfrom
docs/can-decode-no-raise-obligation
Jun 13, 2026
Merged

docs(decoders): document the can_decode no-raise obligation#49
lesnik512 merged 1 commit into
mainfrom
docs/can-decode-no-raise-obligation

Conversation

@lesnik512

Copy link
Copy Markdown
Member

Summary

Closes the final open finding from the 0.9.0 delta audit (planning/audit/2026-06-12-delta-audit.md) — the Nit that the ResponseDecoder protocol was silent on a contractual point: can_decode runs inside _dispatch_decoder, before the HTTP call and outside the try/except that wraps decode into DecodeError. A third-party decoder whose can_decode raises would therefore escape unwrapped, breaking the "all failures are httpware.ClientError" contract.

Per the decision to document rather than guard (it's unreachable with the bundled decoders — both treat any probe failure as False), this adds the obligation to:

  • ResponseDecoder.can_decode docstring (src/httpware/decoders/__init__.py) — the authoritative protocol contract.
  • planning/engineering.md §Seam B — the canonical reference, noting it's a documented obligation on implementers, not an enforced guard.

The obligation: a decoder that cannot decide must return False (decline), not raise.

Docs-only; no behavior change.

Test Plan

  • just lint clean
  • just test — 509 passed, 100% coverage
  • No code path changed — docstring + engineering.md only

🤖 Generated with Claude Code

Closes the final delta-audit Nit (planning/audit/2026-06-12-delta-audit.md):
the ResponseDecoder protocol was silent on the fact that can_decode runs in
_dispatch_decoder, outside the DecodeError wrap — so a third-party decoder
whose can_decode raises would escape the ClientError contract.

Documents the obligation (return False to decline, never raise) on the
ResponseDecoder.can_decode docstring and engineering.md Seam B, rather than
adding an enforced guard: it is unreachable with the bundled decoders (both
treat any probe failure as False), so the proportionate fix is the written
contract, not defensive branches for a path nothing currently hits.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@lesnik512 lesnik512 merged commit 6d73b43 into main Jun 13, 2026
5 checks passed
@lesnik512 lesnik512 deleted the docs/can-decode-no-raise-obligation branch June 13, 2026 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant