Upgrading from 0.11 to 0.12
0.12.0 is the deliberate breaking minor before the two clean minors that
STABILITY.md §7 requires, so every "this struct should have been
#[non_exhaustive]" fix lands here rather than one per release. Five items;
the fourth is the one most code will meet.
HandlerLimits gains two fields
push_delivery_budget (default 30 s) and executor_drain_timeout (default
5 s) are new. A literal naming every field stops compiling with
"missing fields":
// 0.11 — a full struct literal
let limits = HandlerLimits {
max_id_length: 2048,
max_metadata_size: 1_048_576,
max_cancellation_tokens: 10_000,
// … every other field …
};
Use Default and the setters. Every field has one (fourteen in 0.12):
#![allow(unused)] fn main() { use std::time::Duration; use a2a_protocol_server::HandlerLimits; let limits = HandlerLimits::default() .with_max_id_length(2048) .with_push_delivery_budget(Duration::from_secs(30)) // new in 0.12 .with_executor_drain_timeout(Duration::from_secs(5)); // new in 0.12 let _ = limits; }
A literal that ended in ..HandlerLimits::default() was not broken by the
new fields — but it is by the fourth item below, which makes the struct
#[non_exhaustive]; the setter form above is the one that survives both.
Hand the result to RequestHandlerBuilder::with_handler_limits as before.
WebSocketTransportConfig (client) gains max_pending_requests
Default 64. The same rule: a full literal breaks, Default plus setters does
not, and every field has a setter.
#![allow(unused)] fn main() { use std::time::Duration; use a2a_protocol_client::WebSocketTransportConfig; let config = WebSocketTransportConfig::default() .with_connect_timeout(Duration::from_secs(5)) .with_request_timeout(Duration::from_secs(30)) .with_max_pending_requests(64); // new in 0.12 let _ = config; }
Hand it to WebSocketTransport::connect_with_config(endpoint, config) as
before. The new bound is why the next item exists.
ClientError gains TooManyPendingRequests { limit }
Returned up front when a WebSocket connection already has limit requests
awaiting responses. The enum is #[non_exhaustive], so an exhaustive match
already had a wildcard arm and nothing stops compiling. If you branch on
retryability, ClientError::is_retryable() returns true for it: room
appears as responses arrive.
#![allow(unused)] fn main() { use a2a_protocol_client::ClientError; fn describe(err: &ClientError) -> String { match err { ClientError::TooManyPendingRequests { limit } => { format!("{limit} requests already in flight on this connection; retry") } other => other.to_string(), } } }
Fifteen configuration structs are #[non_exhaustive]
Server: HandlerLimits, DispatchConfig, CorsConfig, GrpcConfig,
CacheConfig, PushRetryPolicy, RateLimitConfig, TaskStoreConfig,
TenantStoreConfig, PerTenantConfig, TenantLimits. Client:
ClientConfig, RetryPolicy, WebSocketTransportConfig,
GrpcTransportConfig. (ServeConfig already was; the wire types in
a2a-protocol-types are deliberately not on the list — a literal is how the
spec's data types are meant to be built.) None of them will gain a field at
your expense again.
The rule is the same for all fifteen: a struct literal of any shape —
..Default::default() included — is an error outside the crate, and every
public field has a with_<field> setter. Before:
// 0.11
let limiter = RateLimitInterceptor::new(RateLimitConfig {
requests_per_window: 100,
window_secs: 60,
..RateLimitConfig::default()
})?;
After — start from Default (or the documented constructor:
CorsConfig::new/permissive, CacheConfig::with_max_age) and chain the
setters for the fields you set:
#![allow(unused)] fn main() { use a2a_protocol_server::{RateLimitConfig, RateLimitInterceptor}; fn example() -> Result<(), a2a_protocol_server::ServerError> { let limiter = RateLimitInterceptor::new( RateLimitConfig::default() .with_requests_per_window(100) .with_window_secs(60), )?; let _ = limiter; Ok(()) } }
Some setters did not exist before this release and were added for it, so a
missing one is a 0.11 build, not a missing field: RateLimitConfig's four,
TaskStoreConfig's four (with_max_capacity, with_task_ttl,
with_eviction_interval, with_max_page_size), CorsConfig's four,
TenantStoreConfig::with_per_tenant/with_max_tenants,
PerTenantConfig::with_default/with_overrides/with_override,
TenantLimits::with_* for each of its fields (its builder() still works),
DispatchConfig::with_require_version_header, and ten on ClientConfig.
The setters for Option fields take the Option, so None is spelled
where the literal spelled it:
#![allow(unused)] fn main() { use a2a_protocol_server::TaskStoreConfig; let no_ttl = TaskStoreConfig::default() .with_max_capacity(Some(50_000)) .with_task_ttl(None); let _ = no_ttl; }
GrpcTransportConfig also gained bare_address_scheme and, under the
grpc-tls feature, tls_config; every field has a setter there too:
#![allow(unused)] fn main() { use std::time::Duration; use a2a_protocol_client::GrpcBareAddressScheme; use a2a_protocol_client::transport::grpc::GrpcTransportConfig; let config = GrpcTransportConfig::default() .with_timeout(Duration::from_secs(30)) .with_connect_timeout(Duration::from_secs(5)) .with_max_message_size(4 * 1024 * 1024) .with_stream_channel_capacity(64) .with_bare_address_scheme(GrpcBareAddressScheme::HttpsExceptLoopback); // new in 0.12 let _ = config; }
with_tls_config(tonic::transport::ClientTlsConfig) is its sixth setter,
behind grpc-tls.
InMemoryQueueWriter (server) is no longer UnwindSafe / RefUnwindSafe
It now holds the Arc<dyn Metrics> it reports dropped persistence events
through, and a trait object without those bounds removes the auto-impls.
Only code that wrapped a writer in std::panic::catch_unwind or
AssertUnwindSafe can notice. The handler that owns the writer never
required either bound. There is no migration beyond AssertUnwindSafe if you
are in that position.
Also in 0.12, not breaking
- MSRV lowered from 1.93 to 1.88; edition 2024. Lowering is not a break.
- Dependency majors: opentelemetry / opentelemetry_sdk / opentelemetry-otlp
0.32, tokio-tungstenite 0.30, rig-core 0.42 in the example. If your crate
depends on one of these directly and holds a type the SDK hands back
(
init_otlp_pipelinereturnsopentelemetry_sdk'sSdkMeterProvider), align your version with the SDK's; STABILITY.md §6 says re-exported dependency types carry their own stability.
Back to Upgrading Between Minor Versions.