Skip to content

[in-progress] feat: Update CBOR protocol #349

Draft
jterapin wants to merge 3 commits into
mainfrom
update-cbor-protocol
Draft

[in-progress] feat: Update CBOR protocol #349
jterapin wants to merge 3 commits into
mainfrom
update-cbor-protocol

Conversation

@jterapin

@jterapin jterapin commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Issue

Follows #348 (generic Protocol plugin, define-only). That PR added the mechanism but nothing consumed it. CBOR was still served by a per-service plugin (Plugins::RpcV2Cbor) with its serialization split across two handler classes and a separate stubber, none of which used the new interface.

Description

Retrofit RPC v2 CBOR onto the generic Protocol plugin, making it the first real consumer and taking the mechanism live:

  • One protocol object. A standalone Client::RpcV2Cbor replaces the old plugin, its two handlers (Handler + ErrorHandler), and the separate CBOR stubber, implementing the 5-method interface (build_request / parse_data / parse_error / stub_data / stub_error).
  • Interface cleanup. Drop the Protocol base class; the interface is now duck-typed and documented on the standalone NoOpProtocol, which also carries the stubbing methods. The generic ParseHandler passes context (not the bare response) so a protocol can reach request headers, operation errors, and the client's errors module.
  • Stubbing through the protocol. Stubbing routes through config.protocol instead of a separate :stubber option; the protocol object doubles as its own stubber.
  • Real registry. A new add_protocols weld hook populates client.protocols at codegen, replacing the test-only registry scaffold from feat: Add generic Protocol plugin and protocol interface #348.

parse_error reproduces the old ErrorHandler's on_done(200..599) gate with an early return, so signaled transport errors (status 0) pass through untouched.

Testing

  • smithy-client: 858 examples, 0 failures, 2 pending
  • smithy unit: 505, 0 failures
  • generated CBOR protocol tests: 113, 0 failures
  • RuboCop clean

Note: AWS protocols still use a String :protocol + a separate :stubber and are migrated in a follow-up PR.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

jterapin added 3 commits July 24, 2026 11:28
Drop the base class in favor of a duck-typed interface documented on
the standalone NoOpProtocol. Parse handlers now get context, so a
protocol can reach request headers and operation errors.
One RpcV2Cbor object replaces the per-service plugin, its two handlers,
and the separate stubber. Stubbing runs through config.protocol (the
object doubles as its own stubber). AWS protocols follow in a separate
PR, so their stubbing stays red on version-4 until then.
@jterapin
jterapin force-pushed the update-cbor-protocol branch from dbcb3a9 to bddc3d2 Compare July 24, 2026 18:29
@jterapin jterapin changed the title TBD feat: Update CBOR protocol Jul 24, 2026
@jterapin jterapin changed the title feat: Update CBOR protocol [in-progress] feat: Update CBOR protocol Jul 24, 2026
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