docs(decoders): document the can_decode no-raise obligation#49
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes the final open finding from the 0.9.0 delta audit (
planning/audit/2026-06-12-delta-audit.md) — the Nit that theResponseDecoderprotocol was silent on a contractual point:can_decoderuns inside_dispatch_decoder, before the HTTP call and outside thetry/exceptthat wrapsdecodeintoDecodeError. A third-party decoder whosecan_decoderaises would therefore escape unwrapped, breaking the "all failures arehttpware.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_decodedocstring (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 lintcleanjust test— 509 passed, 100% coverage🤖 Generated with Claude Code