diff --git a/Cargo.lock b/Cargo.lock index 5f254a4..3bbc30c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -27,9 +27,9 @@ dependencies = [ [[package]] name = "alkcall" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83e91782140beee66656cda7c5bfb1248f76302225b51538d3523b51d178ac7d" +checksum = "d0e415a03f77446ba446b3a758dc7846283b217a356376499a74a836b10e875a" dependencies = [ "async-trait", "bytes", diff --git a/Cargo.toml b/Cargo.toml index f42b3a3..ac8b72f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,7 +42,7 @@ h2 = ["server", "dep:hyper", "hyper-util/http2", "hyper/http2"] http1 = ["server", "dep:hyper", "hyper-util/http1", "hyper/http1"] [dependencies] -alkcall = { version = "0.2", features = ["gateway"] } +alkcall = { version = "0.3", features = ["gateway"] } arc-swap = { version = "1", optional = true } axum = { version = "0.8", optional = true, features = ["ws"] } bytes = "1" diff --git a/src/adapters/from_wss.rs b/src/adapters/from_wss.rs index 5fafcb4..e49ab1a 100644 --- a/src/adapters/from_wss.rs +++ b/src/adapters/from_wss.rs @@ -272,7 +272,6 @@ impl WssSession { .ok_or_else(|| AdapterError::Transport { message: "channel client closed before channel 0 was installed".to_string(), })?; - let call_connection = Arc::new(call_connection); let (close_tx, mut close_rx) = tokio::sync::oneshot::channel(); let pending = Arc::clone(call_connection.pending()); @@ -512,7 +511,7 @@ mod tests { /// A producer registry: `echo/run` (open), `admin/run` (admin scope), /// plus the discovery ops the importer calls over channel 0. fn producer_registry() -> Arc { - let mut inner = OperationRegistry::new(); + let inner = OperationRegistry::new(); inner .register(HandlerRegistration::new( OperationSpec::new( @@ -556,7 +555,7 @@ mod tests { .unwrap(); let inner = Arc::new(inner); - let mut registry = OperationRegistry::new(); + let registry = OperationRegistry::new(); registry .register(HandlerRegistration::new( services_list_spec(), @@ -596,7 +595,7 @@ mod tests { /// A producer registry with a never-responding `slow/op`. fn slow_producer_registry() -> Arc { - let mut inner = OperationRegistry::new(); + let inner = OperationRegistry::new(); inner .register(HandlerRegistration::new( OperationSpec::new( @@ -620,7 +619,7 @@ mod tests { )) .unwrap(); let inner = Arc::new(inner); - let mut registry = OperationRegistry::new(); + let registry = OperationRegistry::new(); registry .register(HandlerRegistration::new( services_list_spec(), diff --git a/src/adapters/to_mcp.rs b/src/adapters/to_mcp.rs index cec7190..2c1b8f8 100644 --- a/src/adapters/to_mcp.rs +++ b/src/adapters/to_mcp.rs @@ -585,7 +585,7 @@ mod tests { fn full_registry_with_ops( specs: Vec<(String, OperationType, AccessControl)>, ) -> Arc { - let mut inner = OperationRegistry::new(); + let inner = OperationRegistry::new(); for (name, op_type, acl) in specs { inner .register(HandlerRegistration::new( @@ -600,7 +600,7 @@ mod tests { } let inner = Arc::new(inner); - let mut dispatch_registry = OperationRegistry::new(); + let dispatch_registry = OperationRegistry::new(); for op in inner.list_operations() { dispatch_registry .register(HandlerRegistration::new( @@ -932,7 +932,7 @@ mod tests { #[tokio::test] async fn schema_denies_internal_op_with_not_found_symmetrically_with_http() { - let mut inner = OperationRegistry::new(); + let inner = OperationRegistry::new(); inner .register(HandlerRegistration::new( internal_spec("secret/op"), @@ -944,7 +944,7 @@ mod tests { )) .unwrap(); let inner = Arc::new(inner); - let mut dispatch_registry = OperationRegistry::new(); + let dispatch_registry = OperationRegistry::new(); dispatch_registry .register(HandlerRegistration::new( internal_spec("secret/op"), @@ -1188,7 +1188,7 @@ mod tests { #[tokio::test] async fn call_tool_via_services_schema_with_internal_name_returns_not_found() { - let mut inner = OperationRegistry::new(); + let inner = OperationRegistry::new(); inner .register(HandlerRegistration::new( internal_spec("secret/op"), @@ -1200,7 +1200,7 @@ mod tests { )) .unwrap(); let inner = Arc::new(inner); - let mut dispatch_registry = OperationRegistry::new(); + let dispatch_registry = OperationRegistry::new(); dispatch_registry .register(HandlerRegistration::new( internal_spec("secret/op"), @@ -1261,7 +1261,7 @@ mod tests { #[tokio::test] async fn batch_tool_via_services_schema_with_internal_name_yields_not_found_entry() { - let mut inner = OperationRegistry::new(); + let inner = OperationRegistry::new(); inner .register(HandlerRegistration::new( internal_spec("secret/op"), @@ -1283,7 +1283,7 @@ mod tests { )) .unwrap(); let inner = Arc::new(inner); - let mut dispatch_registry = OperationRegistry::new(); + let dispatch_registry = OperationRegistry::new(); dispatch_registry .register(HandlerRegistration::new( internal_spec("secret/op"), diff --git a/src/adapters/to_openapi.rs b/src/adapters/to_openapi.rs index 4b81f92..a3f85d8 100644 --- a/src/adapters/to_openapi.rs +++ b/src/adapters/to_openapi.rs @@ -1548,7 +1548,7 @@ mod tests { #[test] fn internal_operations_excluded_from_error_projection() { - let mut registry = OperationRegistry::new(); + let registry = OperationRegistry::new(); registry .register(HandlerRegistration::new( OperationSpec::new( diff --git a/src/gateway/routes.rs b/src/gateway/routes.rs index 9fd4170..01fc2db 100644 --- a/src/gateway/routes.rs +++ b/src/gateway/routes.rs @@ -888,7 +888,7 @@ mod tests { } fn registry_with_echo() -> Arc { - let mut registry = OperationRegistry::new(); + let registry = OperationRegistry::new(); registry .register(HandlerRegistration::new( external_spec("echo/run", AccessControl::default()), @@ -903,7 +903,7 @@ mod tests { } fn registry_with_restricted_op() -> Arc { - let mut registry = OperationRegistry::new(); + let registry = OperationRegistry::new(); registry .register(HandlerRegistration::new( external_spec( @@ -924,7 +924,7 @@ mod tests { } fn registry_with_internal_op() -> Arc { - let mut registry = OperationRegistry::new(); + let registry = OperationRegistry::new(); registry .register(HandlerRegistration::new( internal_spec("secret/op"), @@ -977,7 +977,7 @@ mod tests { name: &str, outputs: Vec, ) -> Arc { - let mut registry = OperationRegistry::new(); + let registry = OperationRegistry::new(); registry .register(HandlerRegistration::new( subscription_spec(name, Visibility::External, AccessControl::default()), @@ -992,7 +992,7 @@ mod tests { } fn registry_with_subscription_error(name: &str, error: CallError) -> Arc { - let mut registry = OperationRegistry::new(); + let registry = OperationRegistry::new(); registry .register(HandlerRegistration::new( subscription_spec(name, Visibility::External, AccessControl::default()), @@ -1009,12 +1009,12 @@ mod tests { fn registry_with_discovery_and_ops( inner_ops: Vec, ) -> Arc { - let mut inner = OperationRegistry::new(); + let inner = OperationRegistry::new(); for op in inner_ops { inner.register(op).unwrap(); } let inner = Arc::new(inner); - let mut registry = OperationRegistry::new(); + let registry = OperationRegistry::new(); registry .register(HandlerRegistration::new( services_list_spec(), @@ -1053,7 +1053,7 @@ mod tests { } fn registry_with_discovery_and_internal_op() -> Arc { - let mut inner = OperationRegistry::new(); + let inner = OperationRegistry::new(); inner .register(HandlerRegistration::new( internal_spec("secret/op"), @@ -1075,7 +1075,7 @@ mod tests { )) .unwrap(); let inner = Arc::new(inner); - let mut registry = OperationRegistry::new(); + let registry = OperationRegistry::new(); registry .register(HandlerRegistration::new( services_list_spec(), @@ -1620,7 +1620,7 @@ mod tests { #[tokio::test] async fn batch_internal_op_returns_not_found_in_array() { - let mut registry = OperationRegistry::new(); + let registry = OperationRegistry::new(); registry .register(HandlerRegistration::new( internal_spec("secret/op"), @@ -1828,7 +1828,7 @@ mod tests { name: &str, error: CallError, ) -> Arc { - let mut registry = OperationRegistry::new(); + let registry = OperationRegistry::new(); registry .register(HandlerRegistration::new( subscription_spec(name, Visibility::External, AccessControl::default()), @@ -1950,7 +1950,7 @@ mod tests { #[test] fn is_internal_op_detects_registered_internal_op() { - let mut registry = OperationRegistry::new(); + let registry = OperationRegistry::new(); registry .register(HandlerRegistration::new( internal_spec("secret/op"), @@ -1967,7 +1967,7 @@ mod tests { #[test] fn is_internal_op_false_for_external_op() { - let mut registry = OperationRegistry::new(); + let registry = OperationRegistry::new(); registry .register(HandlerRegistration::new( external_spec("echo/run", AccessControl::default()), @@ -2003,7 +2003,7 @@ mod tests { #[tokio::test] async fn call_error_envelope_carries_retry_after_on_retryable_503() { - let mut registry = OperationRegistry::new(); + let registry = OperationRegistry::new(); registry .register(HandlerRegistration::new( external_spec("flaky/op", AccessControl::default()), @@ -2228,7 +2228,7 @@ mod tests { use alkcall::registry::registration::make_sink_handler; fn publish_registry() -> Arc { - let mut registry = OperationRegistry::new(); + let registry = OperationRegistry::new(); registry .register(HandlerRegistration::new( OperationSpec::new( @@ -2401,7 +2401,7 @@ mod tests { #[tokio::test] async fn publish_unauthorized_restricted_op_returns_403() { - let mut registry = OperationRegistry::new(); + let registry = OperationRegistry::new(); registry .register(HandlerRegistration::new( pub_spec( @@ -2540,7 +2540,7 @@ mod tests { #[tokio::test] async fn publish_error_envelope_maps_to_http_status() { - let mut registry = OperationRegistry::new(); + let registry = OperationRegistry::new(); registry .register(HandlerRegistration::new( OperationSpec::new( @@ -2641,7 +2641,7 @@ mod tests { #[tokio::test] async fn publish_line_exceeding_cap_yields_invalid_input_chunk_error() { - let mut registry = OperationRegistry::new(); + let registry = OperationRegistry::new(); registry .register(HandlerRegistration::new( OperationSpec::new( @@ -2690,7 +2690,7 @@ mod tests { } fn registry_with_cap_witness_sink() -> Arc { - let mut registry = OperationRegistry::new(); + let registry = OperationRegistry::new(); registry .register(HandlerRegistration::new( OperationSpec::new( @@ -2928,7 +2928,7 @@ mod tests { /// no `/publish` request to fail and no fail-open window. #[test] fn uncompilable_publish_schema_is_rejected_at_registration() { - let mut registry = OperationRegistry::new(); + let registry = OperationRegistry::new(); let result = registry.register(HandlerRegistration::new( OperationSpec::new( "ingest/broken", @@ -2961,7 +2961,7 @@ mod tests { #[tokio::test] async fn publish_hot_reload_replacement_schema_is_picked_up() { - let mut registry = OperationRegistry::new(); + let registry = OperationRegistry::new(); registry .register(HandlerRegistration::new( OperationSpec::new( diff --git a/src/server/adapter.rs b/src/server/adapter.rs index 2988d38..19c7e05 100644 --- a/src/server/adapter.rs +++ b/src/server/adapter.rs @@ -855,7 +855,7 @@ mod tests { async fn openapi_json_serves_the_gateway_projection() { use tokio::io::{AsyncReadExt, AsyncWriteExt}; - let mut registry = OperationRegistry::new(); + let registry = OperationRegistry::new(); let spec = alkcall::registry::spec::OperationSpec::new( "echo/run", alkcall::registry::spec::OperationType::Query, diff --git a/tests/full_surface.rs b/tests/full_surface.rs index 355a195..c0d199e 100644 --- a/tests/full_surface.rs +++ b/tests/full_surface.rs @@ -65,7 +65,7 @@ fn provider_with(tokens: Vec<(&str, Identity)>) -> Arc { /// and echo-restricted variants), a streaming sub op, and the discovery /// ops the adapters need. fn local_registry() -> Arc { - let mut inner = OperationRegistry::new(); + let inner = OperationRegistry::new(); inner .register(HandlerRegistration::new( OperationSpec::new( @@ -119,7 +119,7 @@ fn local_registry() -> Arc { .unwrap(); let inner = Arc::new(inner); - let mut registry = OperationRegistry::new(); + let registry = OperationRegistry::new(); registry .register(HandlerRegistration::new( services_list_spec(), @@ -351,7 +351,7 @@ async fn from_openapi_import_then_gateway_call() { // a wire call to them is NOT_FOUND (ADR-015 ยง2). The assembly layer // composes them under an External facade. Verify Internal-not-callable // through the gateway, then compose the External facade and call that. - let mut registry = OperationRegistry::new(); + let registry = OperationRegistry::new(); for b in bundles { registry.register(b).unwrap(); } diff --git a/tests/ws_overlay_ops.rs b/tests/ws_overlay_ops.rs index b1cfa6f..339d898 100644 --- a/tests/ws_overlay_ops.rs +++ b/tests/ws_overlay_ops.rs @@ -58,7 +58,7 @@ fn echo_handler() -> alkcall::registry::registration::Handler { } fn echo_registry() -> Arc { - let mut registry = OperationRegistry::new(); + let registry = OperationRegistry::new(); registry .register(HandlerRegistration::new( external_spec("echo/run", AccessControl::default()), @@ -510,7 +510,7 @@ async fn disconnect_drops_session_cleanly_subsequent_reach_fails_cleanly() { } fn slow_and_echo_registry() -> Arc { - let mut registry = OperationRegistry::new(); + let registry = OperationRegistry::new(); registry .register(HandlerRegistration::new( external_spec("slow/op", AccessControl::default()), diff --git a/tests/ws_upgrade_session.rs b/tests/ws_upgrade_session.rs index 88d5442..b469efe 100644 --- a/tests/ws_upgrade_session.rs +++ b/tests/ws_upgrade_session.rs @@ -30,7 +30,7 @@ fn echo_handler() -> Handler { } fn echo_registry() -> Arc { - let mut registry = OperationRegistry::new(); + let registry = OperationRegistry::new(); registry .register(HandlerRegistration::new( OperationSpec::new( @@ -54,7 +54,7 @@ fn echo_registry() -> Arc { } fn slow_and_echo_registry() -> Arc { - let mut registry = OperationRegistry::new(); + let registry = OperationRegistry::new(); registry .register(HandlerRegistration::new( OperationSpec::new( @@ -100,7 +100,7 @@ fn slow_and_echo_registry() -> Arc { } fn internal_registry() -> Arc { - let mut registry = OperationRegistry::new(); + let registry = OperationRegistry::new(); registry .register(HandlerRegistration::new( OperationSpec::new( @@ -124,7 +124,7 @@ fn internal_registry() -> Arc { } fn restricted_registry() -> Arc { - let mut registry = OperationRegistry::new(); + let registry = OperationRegistry::new(); registry .register(HandlerRegistration::new( OperationSpec::new( @@ -151,12 +151,12 @@ fn restricted_registry() -> Arc { } fn registry_with_services_list(inner_ops: Vec) -> Arc { - let mut inner = OperationRegistry::new(); + let inner = OperationRegistry::new(); for op in inner_ops { inner.register(op).unwrap(); } let inner = Arc::new(inner); - let mut registry = OperationRegistry::new(); + let registry = OperationRegistry::new(); registry .register(HandlerRegistration::new( services_list_spec(), @@ -696,7 +696,7 @@ async fn ws_sessions_registry_tracks_and_aborts_live_sessions() { async fn session_cap_rejects_over_limit_with_503_and_frees_slots_on_end() { use alkhttp::server::HttpAdapter; - let mut registry_val = OperationRegistry::new(); + let registry_val = OperationRegistry::new(); registry_val .register(HandlerRegistration::new( OperationSpec::new(