Orchestrata Ultimate › Tests › Reference › gateway

Tests reference — tests/gateway

tests/gateway — 85 test modules, 1141 test functions (cumulative over subdirectories). Source tree: tests/gateway at commit 8a2cb42ad. Generated from the tests AST snapshot by scripts/gen-data-pages.py.

Prose pending.

Subdirectories

Directory Modules Tests
handlers/ 19 283

Modules

Module Tests Covers
_mcp_gateway_support.py 0 0
conftest.py 0 3
test_audit.py 9 2
test_audit_behavioral.py 12 3
test_auth.py 13 3
test_auth_behavioral.py 14 3
test_auth_handler.py 3 3
test_auth_handler_behavioral.py 6 4
test_auth_handler_ws.py 10 5
test_auth_static_hmac.py 46 6
test_cli.py 5 1
test_cli_behavioral.py 7 2
test_cli_coverage_wave.py 1 1
test_cli_extra.py 4 1
test_concurrent_read_write_regression.py 2 3
test_config.py 15 2
test_config_behavioral.py 9 1
test_connection_manager.py 14 3
test_cxp_send_receipt_check.py 2 6
test_exceptions.py 7 1
test_exceptions_behavioral.py 10 1
test_gateway_handler.py 16 8
test_gateway_metrics.py 22 14
test_handlers_behavioral.py 94 18
test_heartbeat_presence.py 6 5
test_http_surface.py 6 2
test_kernel_event_forwarder.py 7 4
test_kernel_reply_consumer.py 3 7
test_kernel_reprobe.py 6 8
test_mcp_approval_gate.py 7 1
test_mcp_ledger.py 6 1
test_mcp_registration_installer.py 12 1
test_mcp_transport.py 23 5
test_memory_engine_wiring.py 6 11
test_method_table.py 12 10
test_models.py 13 1
test_models_behavioral.py 20 1
test_orchestrator_evaluator_ingress.py 5 8
test_orchestrator_intent_parser.py 21 5
test_pipeline_forwarder_canonical_shape.py 1 2
test_protocol.py 21 4
test_protocol_behavioral.py 10 8
test_protocol_dispatch.py 5 8
test_protocol_ws_integration.py 6 3
test_publisher_wiring.py 16 13
test_pubsub.py 48 1
test_pubsub_behavioral.py 25 2
test_reply_consumer_addressing.py 3 8
test_ring_buffer.py 11 2
test_ring_buffer_behavioral.py 21 3
test_ring_buffer_serialize.py 7 1
test_rpc_behavioral.py 10 22
test_runtime_config.py 7 2
test_server_behavioral.py 17 6
test_server_coverage_wave.py 32 10
test_server_integration.py 16 7
test_session.py 20 3
test_session_behavioral.py 18 3
test_spec098_api_standards.py 28 7
test_subscription_filters.py 24 8
test_test_runner.py 9 3
test_test_runner_streaming.py 9 4
test_token_auth.py 8 3
test_volk_status_event_broadcast.py 1 7
test_workflow_types.py 11 1

Module details

tests/gateway/_mcp_gateway_support.py

source · 0 tests · 77 lines

Shared helpers for the ADR-0099 MCP transport tests (non-test sibling

tests/gateway/conftest.py

source · 0 tests · 128 lines

Shared fixtures for gateway behavioral tests.

Covers: gateway.auth, gateway.config, gateway.server

tests/gateway/test_audit.py

source · 9 tests · 81 lines

Tests for gateway.audit.

Covers: gateway.audit, gateway.config

Kind Name Line Description
class TestAuditWriter 29
method TestAuditWriter.test_init 30
method TestAuditWriter.test_connect_no_neo4j 36
method TestAuditWriter.test_log_event_returns_entry_id 41
method TestAuditWriter.test_log_event_with_data 48
method TestAuditWriter.test_log_event_invalid_type 54
method TestAuditWriter.test_log_event_empty_type 60
method TestAuditWriter.test_log_event_invalid_connection 66
method TestAuditWriter.test_log_event_invalid_data 72
method TestAuditWriter.test_close_no_driver 78

tests/gateway/test_audit_behavioral.py

source · 12 tests · 173 lines

Behavioral tests for gateway graph audit writer.

Covers: core.graph.adapters.bolt_async, gateway.audit, gateway.config

Kind Name Line Description
class TestAuditWriter 12 Real behavioral tests using live graph.
method TestAuditWriter.test_log_event_returns_entry_id 23
method TestAuditWriter.test_log_event_without_data 29
method TestAuditWriter.test_log_event_without_driver 34
method TestAuditWriter.test_log_event_invalid_event_type 42
method TestAuditWriter.test_log_event_empty_event_type 47
method TestAuditWriter.test_log_event_invalid_connection_id 52
method TestAuditWriter.test_log_event_empty_connection_id 57
method TestAuditWriter.test_log_event_invalid_data 62
method TestAuditWriter.test_close_idempotent 67
method TestAuditWriter.test_connect_without_neo4j_package 74
method TestAuditWriter.test_circuit_opens_on_failure_and_skips_fast 90 A failed graph write opens the circuit so later writes skip fast.
method TestAuditWriter.test_log_event_reachable_from_project 141 Session-254 root-connectivity ruling: the Session + GatewayAuditEvent

tests/gateway/test_auth.py

source · 13 tests · 119 lines

Tests for gateway.auth.

Covers: gateway.auth, gateway.config, gateway.exceptions

Kind Name Line Description
class TestTokenAuthenticator 34
method TestTokenAuthenticator.test_init_from_config 35
method TestTokenAuthenticator.test_create_token_basic 44
method TestTokenAuthenticator.test_create_token_with_claims 53
method TestTokenAuthenticator.test_create_token_empty_user_id_raises 59
method TestTokenAuthenticator.test_create_token_non_str_user_id_raises 64
method TestTokenAuthenticator.test_create_token_invalid_claims_raises 69
method TestTokenAuthenticator.test_validate_token_success 74
method TestTokenAuthenticator.test_validate_token_missing_sub 80
method TestTokenAuthenticator.test_validate_token_expired 86
method TestTokenAuthenticator.test_validate_token_invalid_signature 95
method TestTokenAuthenticator.test_validate_token_malformed 101
method TestTokenAuthenticator.test_roundtrip_different_secret 106
method TestTokenAuthenticator.test_custom_expiry 113

tests/gateway/test_auth_behavioral.py

source · 14 tests · 112 lines

Behavioral tests for gateway JWT authentication.

Covers: gateway.auth, gateway.config, gateway.exceptions

Kind Name Line Description
class TestTokenAuthenticator 13 Real behavioral tests for TokenAuthenticator.
method TestTokenAuthenticator.test_create_token 21
method TestTokenAuthenticator.test_create_token_with_claims 26
method TestTokenAuthenticator.test_create_token_has_expiry 33
method TestTokenAuthenticator.test_create_token_empty_user_id_raises 40
method TestTokenAuthenticator.test_create_token_non_string_user_id_raises 44
method TestTokenAuthenticator.test_create_token_invalid_claims_type_raises 50
method TestTokenAuthenticator.test_validate_token 56
method TestTokenAuthenticator.test_validate_token_missing_sub_raises 61
method TestTokenAuthenticator.test_validate_expired_token_raises 67
method TestTokenAuthenticator.test_validate_invalid_token_raises 77
method TestTokenAuthenticator.test_validate_token_wrong_secret 81
method TestTokenAuthenticator.test_roundtrip 86
method TestTokenAuthenticator.test_different_secrets_produce_different_tokens 94
method TestTokenAuthenticator.test_custom_algorithm 107

tests/gateway/test_auth_handler.py

source · 3 tests · 34 lines

Tests for gateway/handlers/auth.py — real implementation.

Covers: gateway.auth, gateway.config, gateway.handlers.auth

Kind Name Line Description
class TestAuthHandler 8
method TestAuthHandler.test_handle_authenticate_valid_token 10
method TestAuthHandler.test_handle_authenticate_garbage_token_rejected 27
method TestAuthHandler.test_handle_authenticate_tokenless_rejected_by_default 32

tests/gateway/test_auth_handler_behavioral.py

source · 6 tests · 93 lines

Behavioral tests for gateway auth handler functions.

Covers: gateway.audit, gateway.auth_handler, gateway.config, gateway.ring_buffer

Kind Name Line Description
class TestSendError 19 Tests for send_error helper.
method TestSendError.test_send_error 23
class TestTryConnectRedis 36 Tests for try_connect_redis helper.
method TestTryConnectRedis.test_try_connect_redis_with_connected_buffer 40
method TestTryConnectRedis.test_try_connect_redis_with_failing_buffer 50
class TestTryConnectNeo4j 62 Tests for try_connect_graph helper.
method TestTryConnectNeo4j.test_try_connect_graph_with_connected_audit 66
method TestTryConnectNeo4j.test_try_connect_graph_with_failing_audit 76
method TestTryConnectNeo4j.test_try_connect_graph_raises_synchronously_on_bad_scheme 84 AsyncGraphDatabase.driver() validates the URI scheme synchronously

tests/gateway/test_auth_handler_ws.py

source · 10 tests · 338 lines

Behavioral tests for auth_handler WebSocket authentication flows.

Covers: gateway.auth, gateway.auth_handler, gateway.config, gateway.models, gateway.session

Kind Name Line Description
class TestAuthenticate 29 Tests for authenticate function using a real WebSocket pair.
method TestAuthenticate.test_authenticate_with_valid_token 37
method TestAuthenticate.test_authenticate_with_invalid_token 71
method TestAuthenticate.test_authenticate_non_auth_message 103
method TestAuthenticate.test_authenticate_jsonrpc_auth 131
class TestHandleJsonrpcAuth 163 Tests for handle_jsonrpc_auth function.
method TestHandleJsonrpcAuth.test_auth_authenticate_without_token_is_rejected 167
method TestHandleJsonrpcAuth.test_auth_authenticate_with_valid_token 197
method TestHandleJsonrpcAuth.test_auth_authenticate_with_invalid_token_is_rejected 231
method TestHandleJsonrpcAuth.test_auth_authenticate_anonymous_when_explicitly_enabled 262
method TestHandleJsonrpcAuth.test_anonymous_denied 289
method TestHandleJsonrpcAuth.test_anonymous_allowed 317

tests/gateway/test_auth_static_hmac.py

source · 46 tests · 639 lines

Tests for SPEC-014 FR-006 (Static Token Auth) and FR-007 (HMAC Auth).

Covers: gateway.auth, gateway.auth_handler, gateway.config, gateway.exceptions, gateway.models, gateway.session

Kind Name Line Description
class TestGatewayConfigAuthMode 84 GatewayConfig.auth_mode + the FR-006/FR-007 config fields.
method TestGatewayConfigAuthMode.test_default_auth_mode_is_jwt 87
method TestGatewayConfigAuthMode.test_explicit_auth_mode_static 90
method TestGatewayConfigAuthMode.test_explicit_auth_mode_hmac 93
method TestGatewayConfigAuthMode.test_invalid_auth_mode_raises 96
method TestGatewayConfigAuthMode.test_auth_mode_from_environ 100
method TestGatewayConfigAuthMode.test_static_token_from_config 104
method TestGatewayConfigAuthMode.test_static_token_defaults_to_none 107
method TestGatewayConfigAuthMode.test_static_token_from_gateway_token_env 112
method TestGatewayConfigAuthMode.test_hmac_secrets_default_empty 118
method TestGatewayConfigAuthMode.test_hmac_secrets_parsed_from_csv 123
method TestGatewayConfigAuthMode.test_hmac_secrets_direct_kwarg 137
method TestGatewayConfigAuthMode.test_hmac_drift_seconds_default 141
method TestGatewayConfigAuthMode.test_hmac_drift_seconds_from_environ 144
method TestGatewayConfigAuthMode.test_hmac_client_scopes_parsed 150
method TestGatewayConfigAuthMode.test_hmac_client_scopes_skips_malformed_pairs 161
class TestStaticTokenAuthenticator 170 SPEC-014 FR-006.
method TestStaticTokenAuthenticator.test_rejects_blank_token 173
method TestStaticTokenAuthenticator.test_rejects_missing_token 179
method TestStaticTokenAuthenticator.test_rejects_when_not_configured 185
method TestStaticTokenAuthenticator.test_accepts_seeded_token 191
method TestStaticTokenAuthenticator.test_rejects_wrong_token 199
method TestStaticTokenAuthenticator.test_rotate_rejects_blank_token 205
method TestStaticTokenAuthenticator.test_rotate_updates_live_token_no_restart 211
method TestStaticTokenAuthenticator.test_current_token_falls_back_to_seed_when_unrotated 238
class TestHmacAuthenticator 244 SPEC-014 FR-007.
method TestHmacAuthenticator.test_rejects_missing_fields 256
method TestHmacAuthenticator.test_rejects_when_not_configured 261
method TestHmacAuthenticator.test_invalid_timestamp_format_rejected 271
method TestHmacAuthenticator.test_accepts_valid_signature 281
method TestHmacAuthenticator.test_rejects_bad_signature 294
method TestHmacAuthenticator.test_rejects_timestamp_drift 308
method TestHmacAuthenticator.test_rejects_replayed_nonce 320
method TestHmacAuthenticator.test_multiple_secrets_both_validate 335
method TestHmacAuthenticator.test_scope_from_client_mapping 360
method TestHmacAuthenticator.test_unmapped_client_gets_default_scope 372
method TestHmacAuthenticator.test_compute_signature_deterministic 384
class TestCreateAuthenticator 391 gateway.auth_handler.create_authenticator -- mode selection.
method TestCreateAuthenticator.test_default_jwt 394
method TestCreateAuthenticator.test_static_mode 397
method TestCreateAuthenticator.test_hmac_mode 401
class TestValidateViaMode 406 gateway.auth_handler.validate_via_mode -- payload dispatch by mode.
method TestValidateViaMode.test_jwt_mode_matches_validate_token 409
method TestValidateViaMode.test_jwt_mode_propagates_authentication_error 416
method TestValidateViaMode.test_static_mode_dispatch 422
method TestValidateViaMode.test_hmac_mode_dispatch 430
class TestAuthenticateEndToEndStaticMode 450 End-to-end: the WSMessage AUTH-frame path via a real WebSocket pair,
method TestAuthenticateEndToEndStaticMode.test_authenticate_with_valid_static_token 455
method TestAuthenticateEndToEndStaticMode.test_authenticate_rejects_blank_static_token 488
class TestAuthenticateEndToEndHmacMode 521 End-to-end: the WSMessage AUTH-frame path for FR-007 HMAC auth.
method TestAuthenticateEndToEndHmacMode.test_authenticate_with_valid_hmac_signature 524
method TestAuthenticateEndToEndHmacMode.test_authenticate_rejects_bad_hmac_signature 564
class TestHandleJsonrpcAuthNonJwtModeGuard 600 handle_jsonrpc_auth rejects the VizInt JSON-RPC auth.authenticate
method TestHandleJsonrpcAuthNonJwtModeGuard.test_static_mode_jsonrpc_auth_rejected_not_crashed 606

tests/gateway/test_cli.py

source · 5 tests · 55 lines

Tests for gateway/cli.py — CLI parser and entry point.

Covers: gateway.cli

Kind Name Line Description
class TestBuildParser 28
method TestBuildParser.test_serve_subcommand 29
method TestBuildParser.test_version_subcommand 34
method TestBuildParser.test_no_args 39
class TestMain 45
method TestMain.test_help_exits_with_error 46
method TestMain.test_version_output 51

tests/gateway/test_cli_behavioral.py

source · 7 tests · 162 lines

Behavioral tests for gateway CLI.

Covers: core.base.traces, gateway.cli

Kind Name Line Description
class TestBuildParser 14 Tests for CLI argument parser.
method TestBuildParser.test_parser_has_serve_command 17
method TestBuildParser.test_parser_has_version_command 22
method TestBuildParser.test_parser_no_args 27
class TestMain 33 Tests for CLI entry point.
method TestMain.test_version_output 36
method TestMain.test_no_args_prints_help 49
class TestRunServeLifecycle 87 Exercise run_serve()'s real start -> block -> cancel -> stop
method TestRunServeLifecycle.test_cancel_after_start_triggers_clean_stop 91 run_serve() blocks on a real asyncio.Future() after a real
class TestMainServeDispatch 132 Exercise main()'s serve branch: asyncio.run(run_serve())
method TestMainServeDispatch.test_serve_dispatches_and_propagates_real_bind_failure 136 A real socket already bound+listening on the configured port makes

tests/gateway/test_cli_coverage_wave.py

source · 1 tests · 86 lines

Coverage-wave tests for gateway/cli.py — run_serve()'s start/block/cancel/

Covers: gateway.cli

Kind Name Line Description
class TestRunServe 49
method TestRunServe.test_run_serve_starts_blocks_then_cancels_and_stops_cleanly 50 run_serve() builds a GatewayConfig from the explicit env mapping,

tests/gateway/test_cli_extra.py

source · 4 tests · 44 lines

Extra tests for gateway.cli — no monkeypatch.

Covers: gateway.cli

Kind Name Line Description
function test_build_parser_no_args 25
function test_build_parser_serve 31
function test_build_parser_version 37
function test_version_constant 43

tests/gateway/test_concurrent_read_write_regression.py

source · 2 tests · 101 lines

Hardening test: gateway read methods snapshot shared dicts under the lock.

Covers: gateway.config, gateway.pubsub, gateway.session

Kind Name Line Description
function test_pubsub_reads_consistent_under_churn 29 Concurrent (un)subscribe + reads never raise and stay coherent.
function test_connection_reads_consistent_under_churn 67 Concurrent register/unregister + reads never raise and stay coherent.

tests/gateway/test_config.py

source · 15 tests · 238 lines

Tests for gateway.config.

Covers: gateway.config, gateway.exceptions

Kind Name Line Description
class TestEnvInt 34
method TestEnvInt.test_reads_int 35
method TestEnvInt.test_uses_default 38
class TestDefaultKgUri 42
method TestDefaultKgUri.test_routing_uri 43
method TestDefaultKgUri.test_kg_uri_when_routing_uri_absent 49
method TestDefaultKgUri.test_routing_uri_wins 55
method TestDefaultKgUri.test_neo4j_env_keys_are_no_longer_read 66 NEO4J_URI / NEO4J_HOST / NEO4J_PORT must not resolve.
method TestDefaultKgUri.test_unset_is_empty_not_localhost 85 Unset yields "", never the old bolt://localhost:7687 default.
class TestGatewayConfig 96
method TestGatewayConfig.test_default_values 97
method TestGatewayConfig.test_custom_env_values 129
method TestGatewayConfig.test_http_surface_binds_host_when_http_host_unset 159 Default: the HTTP surface follows host — behaviour unchanged.
method TestGatewayConfig.test_http_host_overrides_only_the_http_surface 175 GATEWAY_HTTP_HOST moves /metrics WITHOUT moving the WS API.
method TestGatewayConfig.test_frozen_dataclass 197
class TestJWTSecretGuard 203 SPEC-099 P0: JWT_SECRET must not silently fall back to the
method TestJWTSecretGuard.test_missing_secret_outside_dev_test_raises 208 (a) No JWT_SECRET and no opt-in/dev-test signal -> fail-closed.
method TestJWTSecretGuard.test_dev_test_or_explicit_opt_in_allowed 213 (b) Explicit opt-in, or the pytest dev/test signal, is allowed.
method TestJWTSecretGuard.test_explicit_strong_secret_in_production_allowed 233 (c) An explicitly-configured non-default secret is always allowed.

tests/gateway/test_config_behavioral.py

source · 9 tests · 105 lines

Behavioral tests for gateway configuration.

Covers: gateway.config

Kind Name Line Description
class TestEnvInt 11 Tests for _env_int helper.
method TestEnvInt.test_env_int_with_valid_int 14
method TestEnvInt.test_env_int_uses_default_when_missing 17
method TestEnvInt.test_env_int_with_zero 20
method TestEnvInt.test_env_int_with_negative 23
class TestGatewayConfig 27 Real behavioral tests for GatewayConfig dataclass.
method TestGatewayConfig.test_default_values 30
method TestGatewayConfig.test_custom_env_values 58
method TestGatewayConfig.test_frozen_dataclass_cannot_be_modified 90
method TestGatewayConfig.test_allow_anonymous_case_insensitive 96
method TestGatewayConfig.test_allow_anonymous_false_variants 101

tests/gateway/test_connection_manager.py

source · 14 tests · 98 lines

Tests for gateway/session.py ConnectionManager.

Covers: gateway.config, gateway.models, gateway.session

Kind Name Line Description
class TestConnectionManager 10
method TestConnectionManager.test_register 16
method TestConnectionManager.test_register_existing_updates_state 24
method TestConnectionManager.test_unregister 31
method TestConnectionManager.test_unregister_not_found 39
method TestConnectionManager.test_unregister_invalid_type 44
method TestConnectionManager.test_unregister_empty 49
method TestConnectionManager.test_get 54
method TestConnectionManager.test_get_missing 61
method TestConnectionManager.test_get_invalid_type 65
method TestConnectionManager.test_update_heartbeat 70
method TestConnectionManager.test_update_heartbeat_missing 75
method TestConnectionManager.test_get_active_connections 79
method TestConnectionManager.test_get_user_connections 88
method TestConnectionManager.test_get_user_connections_invalid_type 96

tests/gateway/test_cxp_send_receipt_check.py

source · 2 tests · 124 lines

Covers: core.base.traces, cxp.proto_codec, cxp.servicer, cxp.transport, gateway.handlers.cxp, gateway.pubsub

Kind Name Line Description
function test_failed_receipt_triggers_unavailable_notice 82 A send_packet receipt with success=False produces the machine-
function test_successful_receipt_no_unavailable_notice 105 A send_packet receipt with success=True produces no unavailable

tests/gateway/test_exceptions.py

source · 7 tests · 64 lines

Tests for gateway.exceptions.

Covers: gateway.exceptions

Kind Name Line Description
class TestGatewayExceptions 33
method TestGatewayExceptions.test_gateway_error_is_exception 34
method TestGatewayExceptions.test_authentication_error_inheritance 39
method TestGatewayExceptions.test_connection_lifecycle_error 44
method TestGatewayExceptions.test_rpc_error_default_code 48
method TestGatewayExceptions.test_rpc_error_custom_code 53
method TestGatewayExceptions.test_ring_buffer_error 58
method TestGatewayExceptions.test_pubsub_error 62

tests/gateway/test_exceptions_behavioral.py

source · 10 tests · 80 lines

Behavioral tests for gateway exceptions.

Covers: gateway.exceptions

Kind Name Line Description
class TestGatewayErrorHierarchy 15 Tests for exception hierarchy and behavior.
method TestGatewayErrorHierarchy.test_gateway_error_is_base 18
method TestGatewayErrorHierarchy.test_authentication_error_inheritance 23
method TestGatewayErrorHierarchy.test_connection_lifecycle_error_inheritance 28
method TestGatewayErrorHierarchy.test_ring_buffer_error_inheritance 33
method TestGatewayErrorHierarchy.test_pubsub_error_inheritance 38
method TestGatewayErrorHierarchy.test_rpc_error_default_code 43
method TestGatewayErrorHierarchy.test_rpc_error_custom_code 49
method TestGatewayErrorHierarchy.test_rpc_error_zero_code 54
method TestGatewayErrorHierarchy.test_exceptions_are_catchable_as_gateway_error 58
method TestGatewayErrorHierarchy.test_exceptions_are_catchable_as_exception 70

tests/gateway/test_gateway_handler.py

source · 16 tests · 200 lines

Tests for gateway/handlers/gateway.py — real implementation.

Covers: gateway.audit, gateway.config, gateway.handlers.gateway, gateway.protocol, gateway.pubsub, gateway.ring_buffer, gateway.rpc, gateway.session

Kind Name Line Description
class TestNormalizeParams 19
method TestNormalizeParams.test_no_aliases 20
method TestNormalizeParams.test_camel_to_snake 23
method TestNormalizeParams.test_snake_preferred 29
class TestGatewayHandler 37
method TestGatewayHandler.test_init 38
method TestGatewayHandler.test_set_processor 46
method TestGatewayHandler.test_handle_ping 63
method TestGatewayHandler.test_handle_info 74
method TestGatewayHandler.test_handle_clients 89
method TestGatewayHandler.test_handle_replay 102
method TestGatewayHandler.test_handle_replay_missing_topic 114
method TestGatewayHandler.test_handle_subscribe 125
method TestGatewayHandler.test_handle_subscribe_missing_topic 138
method TestGatewayHandler.test_handle_unsubscribe_by_id 149
method TestGatewayHandler.test_handle_unsubscribe_by_topic 162
method TestGatewayHandler.test_handle_publish 175
method TestGatewayHandler.test_handle_connections_info 191

tests/gateway/test_gateway_metrics.py

source · 22 tests · 589 lines

Tests for the eight SPEC-014 gateway Prometheus metrics.

Covers: core.base.traces, gateway.audit, gateway.auth, gateway.auth_handler, gateway.config, gateway.exceptions, gateway.http_surface, gateway.metrics, gateway.models, gateway.protocol, gateway.pubsub, gateway.ring_buffer, gateway.rpc, gateway.session

Kind Name Line Description
function test_metrics_module_reimport_is_idempotent 537 Re-importing (reloading) metrics.py must never raise prometheus_client's
class TestConnectionMetrics 94
method TestConnectionMetrics.test_connected_clients_gauge_tracks_register_and_unregister 96
method TestConnectionMetrics.test_total_connections_counter_increments_on_new_registration_only 108
class TestMessageMetrics 133
method TestMessageMetrics.test_messages_received_total_increments_on_process 135
method TestMessageMetrics.test_messages_received_total_counts_invalid_frames_too 155
method TestMessageMetrics.test_messages_sent_total_increments_on_send_to 173
method TestMessageMetrics.test_messages_sent_total_increments_on_push_to_client 194
method TestMessageMetrics.test_messages_sent_total_increments_per_broadcast_recipient 215
class TestRpcLatencyMetric 249
method TestRpcLatencyMetric.test_rpc_latency_seconds_observes_dispatch_by_method 251
method TestRpcLatencyMetric.test_rpc_latency_not_recorded_for_unknown_method 277
class TestSubscriptionCountMetric 308
method TestSubscriptionCountMetric.test_subscription_count_tracks_subscribe_and_unsubscribe 310
method TestSubscriptionCountMetric.test_subscription_count_tracks_unsubscribe_by_id 323
method TestSubscriptionCountMetric.test_subscription_count_tracks_unsubscribe_all 336
class TestAuthMetrics 372
method TestAuthMetrics.test_auth_success_total_increments_on_valid_wsmessage_auth 374
method TestAuthMetrics.test_auth_failure_total_increments_on_invalid_token 406
method TestAuthMetrics.test_auth_success_total_increments_on_jsonrpc_auth 437
method TestAuthMetrics.test_auth_failure_total_increments_on_jsonrpc_missing_token 469
class TestMetricsScrapeVisibility 501 REQ-014-141 + REQ-014-142..149: the real operations above must be
method TestMetricsScrapeVisibility.test_connected_clients_visible_on_metrics_endpoint 507
method TestMetricsScrapeVisibility.test_all_eight_metric_names_are_registered 522
class TestSafeSwallowsFailures 553 The design ruling every observe_/record_ helper relies on: a
method TestSafeSwallowsFailures.test_safe_swallows_and_logs_instead_of_raising 558
method TestSafeSwallowsFailures.test_safe_runs_op_normally_when_it_succeeds 569
method TestSafeSwallowsFailures.test_rpc_latency_swallows_a_non_numeric_duration 574

tests/gateway/test_handlers_behavioral.py

source · 94 tests · 864 lines

Behavioral tests for gateway handler classes using real infrastructure.

Covers: core.graph.adapters.bolt_async, gateway.auth, gateway.config, gateway.exceptions, gateway.handlers.auth, gateway.handlers.cxp, gateway.handlers.fireflies, gateway.handlers.gateway, gateway.handlers.governance, gateway.handlers.knowledge, gateway.handlers.projects, gateway.handlers.session, gateway.handlers.state, gateway.handlers.utils, gateway.handlers.volk, gateway.pubsub, gateway.ring_buffer, gateway.session

Kind Name Line Description
class TestCxpHandler 64 Tests for CxpHandler -- send, subscribe, unsubscribe, status.
method TestCxpHandler.test_handle_send_missing_target_raises 68
method TestCxpHandler.test_handle_send_without_processor 74
method TestCxpHandler.test_handle_subscribe 86
method TestCxpHandler.test_handle_unsubscribe_missing_raises 95
method TestCxpHandler.test_handle_unsubscribe_found_false 101
method TestCxpHandler.test_handle_unsubscribe_with_subscribed 111
method TestCxpHandler.test_handle_status_missing_raises 121
method TestCxpHandler.test_handle_status_with_thread 127
class TestVolkHandler 138 Tests for VolkHandler -- list, get, register, deregister, lifecycle.
method TestVolkHandler.test_handle_list 142
method TestVolkHandler.test_handle_get_by_alias 148
method TestVolkHandler.test_handle_get_by_volk_id_alias 154
method TestVolkHandler.test_handle_get_missing_raises 160
method TestVolkHandler.test_handle_get_not_found_raises 166
method TestVolkHandler.test_handle_register_raises 172
method TestVolkHandler.test_handle_deregister_raises 178
method TestVolkHandler.test_handle_lifecycle 184
method TestVolkHandler.test_registry_property 190
method TestVolkHandler.test_load_volk_registry_with_missing_path 194
method TestVolkHandler.test_load_volk_registry_with_valid_yaml 199
method TestVolkHandler.test_load_volk_registry_with_invalid_yaml 207
method TestVolkHandler.test_load_volk_registry_with_empty_volks 214
method TestVolkHandler.test_find_volks_yaml_returns_something 221
class TestGovernanceHandler 230 Tests for GovernanceHandler -- decisions, query, evaluate, rules.
method TestGovernanceHandler.test_handle_decisions 234
method TestGovernanceHandler.test_handle_query 241
method TestGovernanceHandler.test_handle_evaluate 247
method TestGovernanceHandler.test_handle_rules 254
class TestSessionHandler 263 Tests for SessionHandler -- list, get, active, open, close, events.
method TestSessionHandler.test_handle_active 267
method TestSessionHandler.test_handle_active_no_pubsub 274
method TestSessionHandler.test_handle_list 280
method TestSessionHandler.test_handle_get 287
method TestSessionHandler.test_handle_open 293
method TestSessionHandler.test_handle_close 299
method TestSessionHandler.test_handle_events 305
method TestSessionHandler.test_handle_events_no_pubsub 311
method TestSessionHandler.test_handle_facts_subscribe 317
class TestFirefliesHandler 327 Tests for FirefliesHandler -- transcripts, transcript, search, summary.
method TestFirefliesHandler.test_handle_transcripts 331
method TestFirefliesHandler.test_handle_transcripts_with_pagination 340
method TestFirefliesHandler.test_handle_transcript 347
method TestFirefliesHandler.test_handle_search 355
method TestFirefliesHandler.test_handle_summary 363
class TestAuthHandler 374 Tests for AuthHandler -- authenticate stub.
method TestAuthHandler.test_handle_authenticate 378
class TestGatewayHandler 399 Tests for GatewayHandler -- ping, info, clients, replay, pub/sub.
method TestGatewayHandler.test_handle_ping 413
method TestGatewayHandler.test_handle_info 419
method TestGatewayHandler.test_handle_clients 428
method TestGatewayHandler.test_handle_replay_missing_topic_raises 433
method TestGatewayHandler.test_handle_replay_empty 440
method TestGatewayHandler.test_handle_subscribe_missing_topic_raises 448
method TestGatewayHandler.test_handle_subscribe_valid 455
method TestGatewayHandler.test_handle_unsubscribe_missing_raises 463
method TestGatewayHandler.test_handle_unsubscribe_by_topic 470
method TestGatewayHandler.test_handle_unsubscribe_by_subscription_id 476
method TestGatewayHandler.test_handle_publish_missing_topic_raises 486
method TestGatewayHandler.test_handle_publish_writes_ring_buffer 493
method TestGatewayHandler.test_handle_connections_info_not_found 503
method TestGatewayHandler.test_handle_connections_info_found 512
class TestKnowledgeHandler 521 Tests for KnowledgeHandler using real graph.
method TestKnowledgeHandler.test_handle_query_missing_raises 525
method TestKnowledgeHandler.test_handle_query_mutation_raises 531
method TestKnowledgeHandler.test_handle_query_without_driver 537
method TestKnowledgeHandler.test_handle_query_with_driver 546
method TestKnowledgeHandler.test_handle_query_invalid_cypher_raises 552
method TestKnowledgeHandler.test_handle_nodes_missing_raises 560
method TestKnowledgeHandler.test_handle_nodes_invalid_identifier_raises 566
method TestKnowledgeHandler.test_handle_nodes_without_driver 572
method TestKnowledgeHandler.test_handle_nodes_with_driver 579
method TestKnowledgeHandler.test_handle_relationships_missing_raises 587
method TestKnowledgeHandler.test_handle_relationships_invalid_raises 593
method TestKnowledgeHandler.test_handle_relationships_without_driver 599
method TestKnowledgeHandler.test_handle_relationships_with_driver 605
method TestKnowledgeHandler.test_neo4j_value_to_dict_with_items 614
method TestKnowledgeHandler.test_neo4j_value_to_dict_scalar 618
class TestProjectsHandler 626 Tests for ProjectsHandler using real graph.
method TestProjectsHandler.test_handle_list_without_driver 630
method TestProjectsHandler.test_handle_list_with_driver 637
method TestProjectsHandler.test_handle_get_missing 643
method TestProjectsHandler.test_handle_get_without_driver 649
method TestProjectsHandler.test_handle_get_with_driver_no_match 655
method TestProjectsHandler.test_handle_tasks_without_driver 665
method TestProjectsHandler.test_handle_tasks_with_driver_no_filter 672
method TestProjectsHandler.test_handle_tasks_with_project_filter 680
method TestProjectsHandler.test_handle_tasks_with_status_filter 690
method TestProjectsHandler.test_handle_tasks_with_project_and_status 698
method TestProjectsHandler.test_handle_task_create_without_driver 709
method TestProjectsHandler.test_handle_task_create_with_driver_no_project 715
method TestProjectsHandler.test_handle_task_create_with_project 736
class TestStateHandler 760 Tests for StateHandler using real Redis.
method TestStateHandler.test_handle_get_all_without_client 764
method TestStateHandler.test_handle_get_all_with_client 773
method TestStateHandler.test_handle_put_all_empty 787
method TestStateHandler.test_handle_put_all_no_client 793
method TestStateHandler.test_handle_put_all_success 802
method TestStateHandler.test_handle_put_missing_key_raises 814
method TestStateHandler.test_handle_put_no_client 822
method TestStateHandler.test_handle_put_success 829
method TestStateHandler.test_handle_delete_missing_key_raises 839
method TestStateHandler.test_handle_delete_no_client 847
method TestStateHandler.test_handle_delete_success 854

tests/gateway/test_heartbeat_presence.py

source · 6 tests · 386 lines

Tests for SPEC-014 FR-014 heartbeat: the server-initiated ping loop,

Covers: core.base.traces, gateway.auth, gateway.config, gateway.models, gateway.server

Kind Name Line Description
class TestHeartbeatLoopLifecycle 72 REQ-014-106/REQ-014-110: the ping loop runs with the server and
method TestHeartbeatLoopLifecycle.test_heartbeat_task_starts_with_server_and_is_cancelled_on_stop 78
class TestHeartbeatSurvivesAnsweringClient 100 REQ-014-108: a client that answers every ping must never be
method TestHeartbeatSurvivesAnsweringClient.test_pong_answering_client_stays_connected 106
class TestHeartbeatLoopTracksNormalDisconnects 152 A connection that closes NORMALLY (not via heartbeat timeout) between
method TestHeartbeatLoopTracksNormalDisconnects.test_client_closing_mid_ping_is_pruned_from_tracking 160
class TestHeartbeatTimeoutDisconnectsAndPublishesPresence 210 REQ-014-108/REQ-014-114: a non-answering client is disconnected
method TestHeartbeatTimeoutDisconnectsAndPublishesPresence.test_non_answering_client_disconnected_after_exact_miss_count 218
class TestLastActivityRefreshesOnAnyMessage 312 REQ-014-109: last_activity updates on ANY client message, not just
method TestLastActivityRefreshesOnAnyMessage.test_last_activity_updates_on_ordinary_jsonrpc_call 318
method TestLastActivityRefreshesOnAnyMessage.test_last_activity_updates_even_on_malformed_json 358

tests/gateway/test_http_surface.py

source · 6 tests · 76 lines

Tests for the gateway HTTP surface (SPEC-014 FR-021).

Covers: gateway.config, gateway.http_surface

Kind Name Line Description
function test_health_is_alive 17
function test_metrics_returns_prometheus_exposition 24
function test_ready_short_circuits_when_gateway_not_started 33
function test_ready_probes_infrastructure_when_gateway_started 45
function test_detailed_health_router_is_mounted 56
function test_config_exposes_http_surface_fields 63

tests/gateway/test_kernel_event_forwarder.py

source · 7 tests · 204 lines

Covers: gateway.config, gateway.server, kernel.event_bus, core.protocols/ (package)

Kind Name Line Description
function test_decode_kernel_event_handles_bytes_and_lifts_message 43
function test_decode_kernel_event_bad_json_falls_back_to_empty_payload 65
function test_decode_kernel_event_keeps_correlation_id_when_present 75
function test_pump_kernel_events_broadcasts_flat_payload 92
function test_pump_kernel_events_returns_same_id_when_no_new_events 135
function test_consume_kernel_events_returns_immediately_when_no_redis_client 166
function test_consume_kernel_events_broken_redis_client_hits_exception_backoff 172 xread() against the kernel-events key fails for real when that key

tests/gateway/test_kernel_reply_consumer.py

source · 3 tests · 227 lines

Covers: agents.kernel_handler, cxp.proto_codec, cxp.servicer, cxp.transport, gateway.server, kernel.pipeline, core.packet/ (package)

Kind Name Line Description
function test_pump_broadcasts_volk_reply_to_cxp_traffic 70
function test_pump_raises_when_server_unreachable 111 _pump_kernel_replies_once raises AioRpcError when the kernel is gone.
function test_pump_recovers_after_server_restart 165 _pump_kernel_replies_once works again after a server restart.

tests/gateway/test_kernel_reprobe.py

source · 6 tests · 282 lines

Tests for the gateway kernel re-probe (SPEC-014, plans/contracts/gateway-kernel-reprobe).

Covers: agents.kernel_handler, cxp.servicer, cxp.transport, gateway.config, gateway.kernel_reprobe, gateway.server, kernel.pipeline, core.packet/ (package)

Kind Name Line Description
class TestGatewayReprobe 96
method TestGatewayReprobe.test_reprobe_upgrades_fallback_to_grpc_when_kernel_appears 97
method TestGatewayReprobe.test_reprobe_interval_zero_stays_in_process 148
method TestGatewayReprobe.test_reprobe_task_is_cancelled_on_stop 181
class TestKernelReprober 203
method TestKernelReprober.test_reprober_stops_after_first_success 204
method TestKernelReprober.test_reprober_survives_attempt_exception_and_disabled_start 228
class TestConfig 261
method TestConfig.test_config_reprobe_interval_default_env_and_validation 262

tests/gateway/test_mcp_approval_gate.py

source · 7 tests · 78 lines

McpApprovalGate -- the single-use, tool-bound, expiring token contract

Covers: gateway.mcp_approval_gate

Kind Name Line Description
function test_default_ttl_is_300_seconds 15
function test_an_issued_token_redeems_once_for_its_tool 19
function test_tokens_are_unguessable_and_distinct 27
function test_a_token_is_bound_to_one_tool 35
function test_forged_missing_and_empty_tokens_are_refused 44
function test_an_expired_token_is_refused 53
function test_concurrent_redemption_succeeds_exactly_once 61

tests/gateway/test_mcp_ledger.py

source · 6 tests · 78 lines

McpLedger -- the append-only ndjson ledger of MCP call outcomes

Covers: gateway.mcp_ledger

Kind Name Line Description
function test_rows_are_appended_with_id_tool_outcome_and_exit_code 13
function test_parent_directories_are_created 29
function test_the_path_comes_from_the_environment_override 37
function test_the_default_path_is_the_per_user_state_file 48
function test_the_process_environment_is_the_default_source 54
function test_concurrent_appends_keep_every_row_whole 59

tests/gateway/test_mcp_registration_installer.py

source · 12 tests · 428 lines

Deployed MCP registration (ADR-0038 rules 3-4, ADR-0099; REQ-014-207).

Covers: core.base.traces

Kind Name Line Description
function test_both_servers_are_registered_at_user_scope_and_identity_passes 133
function test_registration_is_idempotent 175
function test_a_foreign_codetools_path_fails_exactly_the_registration_check 186
function test_a_foreign_orchestrata_path_fails_the_orchestrata_registration_check 208
function test_verify_only_registers_nothing 229
function test_an_undeployed_orchestrata_release_is_refused 238
function test_an_undeployed_codetools_is_refused 250
function test_install_verify_passes_when_orchestrata_mcp_is_inside_the_release 317
function test_install_verify_refuses_an_orchestrata_mcp_that_is_missing 329
function test_install_verify_refuses_an_orchestrata_mcp_that_resolves_outside 343
function test_install_verify_skips_the_check_for_a_ref_without_the_entry_point 358
function test_scenario_registered_at_user_scope 378

tests/gateway/test_mcp_transport.py

source · 23 tests · 596 lines

McpTransport -- the gateway's MCP transport (ADR-0099; REQ-014-204,

Covers: core.base.traces, gateway.mcp_ledger, gateway.mcp_transport, gateway.method_spec, gateway.method_table

Kind Name Line Description
function test_one_tool_per_exposed_method_plus_approve 63
function test_gated_tools_take_the_approval_token_and_read_only_ones_do_not 74
function test_streaming_aliases_and_auth_are_not_tools 89
function test_params_schema_flows_into_the_tool_schema 110
function test_a_read_only_call_reaches_the_gateway_without_a_token 127
function test_a_gated_call_without_a_token_never_reaches_the_gateway 141
function test_an_approved_call_reaches_the_gateway_once_and_the_token_is_spent 162
function test_a_token_is_refused_for_another_tool 196
function test_forged_token_unknown_tool_and_read_only_approval_are_refused 214
function test_a_gateway_rpc_error_is_returned_with_a_ledger_row 243
function test_the_connection_is_reopened_after_it_closes 267
function test_a_wrong_token_is_a_failed_call_not_a_crash 284
function test_an_unreachable_gateway_is_a_failed_call 308
function test_a_silent_gateway_times_out 326 A real server that accepts the socket and never answers.
function test_an_exported_variable_wins_over_the_deployed_environment_layer 350
function test_aclose_without_a_connection_is_a_no_op 365
function test_the_pyproject_entry_point_resolves_to_main 373
function test_pipe_lists_one_tool_per_exposed_method_plus_approve 436
function test_pipe_approval_flow_refuses_then_allows_once_then_refuses_reuse 450
function test_pipe_missing_gateway_token_is_reported_not_fatal 497
function test_scenario_tool_list_generated 521
function test_scenario_mutating_call_needs_token 527
function test_scenario_unexposed_methods 533

tests/gateway/test_memory_engine_wiring.py

source · 6 tests · 143 lines

K3 wiring (SPEC-010 FR-001/FR-008, SPEC-024): the gateway owns ONE

Covers: core.interfaces.memory, di.container, gateway.audit, gateway.config, gateway.handlers.session, gateway.pubsub, gateway.ring_buffer, gateway.rpc, gateway.server, gateway.session, memory.memory_engine

Kind Name Line Description
function test_id 38
function test_engine_registered_as_di_singleton 53
function test_rpc_set_memory_engine_shares_one_engine 66
function test_gateway_registers_and_wires_memory_engine 84
function test_session_close_migrates_hot_memory_to_cold 101
function test_session_close_without_engine_is_a_noop 135

tests/gateway/test_method_table.py

source · 12 tests · 287 lines

The declarative gateway method table (ADR-0099 rules 2 and 3).

Covers: core.base.traces, gateway.audit, gateway.config, gateway.mcp_transport, gateway.method_spec, gateway.method_table, gateway.pubsub, gateway.ring_buffer, gateway.rpc, gateway.session

Kind Name Line Description
function test_names_are_unique 143
function test_table_is_data_only 148 Importable without constructing anything: the table module imports no
function test_every_row_resolves_to_a_handler_coroutine 162
function test_default_is_gated_and_exposed 168
function test_params_schema_overrides_the_default_schema 175
function test_read_only_marking_is_exactly_the_reviewed_set 181
function test_exposure_is_exactly_streaming_aliases_and_auth 185
function test_rpc_handler_dispatch_dict_equals_the_table 189
function test_a_row_added_to_the_table_appears_in_both_transports 200
function test_a_row_with_an_unknown_owner_is_refused 216
function test_an_absent_optional_handler_answers_unavailable 222
function test_scenario_one_method_table_feeds_both_transports 256

tests/gateway/test_models.py

source · 13 tests · 167 lines

Tests for gateway.models — WebSocket gateway data models.

Covers: gateway.models

Kind Name Line Description
function test_utc_iso_returns_string 42
function test_new_id_is_uuid 46
function test_new_sub_id_prefix 53
function test_message_type_values 63
function test_ws_message_defaults 77
function test_ws_message_to_dict 86
function test_ws_message_from_dict 96
function test_ws_message_from_dict_not_dict_raises 110
function test_connection_state_values 120
function test_connection_info_defaults 131
function test_connection_info_to_dict 139
function test_subscription_defaults 154
function test_subscription_to_dict 162

tests/gateway/test_models_behavioral.py

source · 20 tests · 230 lines

Behavioral tests for gateway data models.

Covers: gateway.models

Kind Name Line Description
class TestWSMessage 20 Real behavioral tests for WSMessage.
method TestWSMessage.test_create_with_defaults 23
method TestWSMessage.test_create_with_explicit_values 31
method TestWSMessage.test_to_dict 45
method TestWSMessage.test_from_dict_roundtrip 62
method TestWSMessage.test_from_dict_with_partial_data 75
method TestWSMessage.test_from_dict_invalid_type 84
method TestWSMessage.test_from_dict_invalid_message_type 88
class TestConnectionInfo 93 Real behavioral tests for ConnectionInfo.
method TestConnectionInfo.test_create_with_defaults 96
method TestConnectionInfo.test_create_with_explicit_values 106
method TestConnectionInfo.test_to_dict 122
method TestConnectionInfo.test_to_dict_does_not_mutate 135
class TestSubscription 142 Real behavioral tests for Subscription.
method TestSubscription.test_create_with_defaults 145
method TestSubscription.test_create_with_explicit_values 153
method TestSubscription.test_to_dict 165
method TestSubscription.test_to_dict_does_not_mutate_filters 181
class TestUtilityFunctions 188 Tests for module-level helper functions.
method TestUtilityFunctions.test_new_id_is_uuid 191
method TestUtilityFunctions.test_new_sub_id_format 196
method TestUtilityFunctions.test_utc_iso_format 201
class TestMessageType 210 Tests for MessageType enum.
method TestMessageType.test_all_members 213
class TestConnectionState 222 Tests for ConnectionState enum.
method TestConnectionState.test_all_members 225

tests/gateway/test_orchestrator_evaluator_ingress.py

source · 5 tests · 110 lines

Tests for the SPEC-003 ingress reconciliation: the gateway

Covers: gateway.audit, gateway.config, gateway.handlers.orchestrator, gateway.pubsub, gateway.ring_buffer, gateway.rpc, gateway.session, orchestrator.intent_classifier

Kind Name Line Description
function test_evaluator_ingress_produces_structured_metadata 37 Free text is classified into real action/target/work_type/resource_path
function test_evaluator_ingress_gates_unclassifiable_text 57 Text with no work-type signal is returned for disambiguation instead of
function test_evaluator_ingress_preserves_at_mention_assignee 70 The @volk assignee is extracted regardless of parser.
function test_without_evaluator_falls_back_to_heuristic 82 No evaluator wired -> the coarse heuristic still runs (degraded).
function test_rpc_handler_auto_wires_a_default_evaluator 94 RPCHandler construction wires a real evaluator into the orchestrator so

tests/gateway/test_orchestrator_intent_parser.py

source · 21 tests · 326 lines

Covers: core.graph.adapters.bolt_async, gateway.config, gateway.exceptions, gateway.handlers.orchestrator, gateway.handlers.projects

Kind Name Line Description
function test_parse_action_verbs_map_to_create 50 Every recognised leading verb yields action='create' and strips the verb
function test_parse_no_known_verb_defaults_to_create_and_keeps_title 62 Text without a leading action verb still defaults to action='create' and
function test_parse_strips_article_a_an_the 70
function test_parse_priority_critical 82
function test_parse_priority_high 88
function test_parse_priority_low 94
function test_parse_priority_default_medium 99
function test_parse_priority_critical_precedence_over_high 103 When both critical and high keywords are present, critical wins (checked
function test_parse_extracts_volk_mention_and_removes_from_title 115
function test_parse_volk_mention_simple_handle 123
function test_parse_no_mention_yields_none_volk 129
function test_parse_empty_string_falls_back_to_text_for_title 138 Empty input: title falls back to the (empty) text rather than crashing,
function test_parse_verb_only_falls_back_to_original_text 149 A bare verb leaves no title after stripping; the parser falls back to the
function test_parse_outer_whitespace_is_trimmed 156 Outer whitespace is stripped from the title. Note the real behavior:
function test_synthetic_task_carries_parsed_fields 174
function test_handle_intent_parses_into_task_structure 191 With no kernel client and no projects handler, handle_intent still parses
function test_handle_intent_missing_text_raises_rpc_error 216
function test_handle_intent_non_string_text_raises_rpc_error 223
function test_handle_intent_empty_text_raises_rpc_error 230 Empty string is falsy -> missing-text guard fires before parsing.
function test_handle_intent_swallows_broken_projects_handler_exception 259
function test_handle_intent_adopts_persisted_task_id 291 When a real ProjectsHandler persists the task to real graph, handle_intent

tests/gateway/test_pipeline_forwarder_canonical_shape.py

source · 1 tests · 149 lines

Covers: gateway.server, kernel.pipeline_events

Kind Name Line Description
function test_pipeline_event_bus_to_production_forwarder_canonical_shape 52 Real PipelineEventBus.emit_* -> real Redis stream -> the

tests/gateway/test_protocol.py

source · 21 tests · 370 lines

Covers: gateway.exceptions, gateway.models, gateway.protocol, gateway.pubsub

Kind Name Line Description
function test_process_invalid_conn_id_type 96
function test_process_empty_conn_id 102
function test_process_invalid_raw_type 108
function test_process_invalid_json 114
function test_process_heartbeat 128
function test_process_ignores_non_rpc_non_heartbeat_message_type 135
function test_process_rpc_request 153
function test_process_rpc_error 169
function test_process_publish_method_triggers_legacy_broadcast 187
function test_broadcast_no_pubsub 223
function test_broadcast_no_recipients 235
function test_broadcast_delivers 241
function test_broadcast_sequence_increments 264
function test_broadcast_survives_a_dead_recipient_socket 279
function test_push_to_client_success 296
function test_push_to_client_missing 308
function test_push_to_client_send_failure_returns_false 314
function test_send_to 326
function test_send_to_missing 334
function test_send_to_dead_socket_does_not_raise 340
function test_broadcast_legacy_skips_sender_and_survives_dead_socket 352

tests/gateway/test_protocol_behavioral.py

source · 10 tests · 146 lines

Behavioral tests for gateway message processor.

Covers: gateway.audit, gateway.config, gateway.models, gateway.protocol, gateway.pubsub, gateway.ring_buffer, gateway.rpc, gateway.session

Kind Name Line Description
class TestMessageProcessor 21 Real behavioral tests for MessageProcessor.
method TestMessageProcessor.test_process_heartbeat 35
method TestMessageProcessor.test_process_invalid_json 43
method TestMessageProcessor.test_process_empty_conn_id_raises 56
method TestMessageProcessor.test_process_non_string_conn_id_raises 63
method TestMessageProcessor.test_process_non_string_raw_raises 70
method TestMessageProcessor.test_broadcast_no_pubsub 77
method TestMessageProcessor.test_broadcast_with_recipients 83
method TestMessageProcessor.test_broadcast_sequence_increments 109
method TestMessageProcessor.test_push_to_client 128
method TestMessageProcessor.test_push_to_client_not_found 144

tests/gateway/test_protocol_dispatch.py

source · 5 tests · 134 lines

Behavioral tests for MessageProcessor dispatch and broadcast.

Covers: gateway.audit, gateway.config, gateway.models, gateway.protocol, gateway.pubsub, gateway.ring_buffer, gateway.rpc, gateway.session

Kind Name Line Description
class TestMessageProcessorDispatch 21 Tests for _dispatch_rpc and message routing.
method TestMessageProcessorDispatch.test_dispatch_rpc_ping 35
method TestMessageProcessorDispatch.test_dispatch_rpc_unknown_method 55
method TestMessageProcessorDispatch.test_dispatch_rpc_publish_triggers_broadcast 74
method TestMessageProcessorDispatch.test_broadcast_legacy 101
method TestMessageProcessorDispatch.test_process_non_rpc_request 125

tests/gateway/test_protocol_ws_integration.py

source · 6 tests · 195 lines

Covers: gateway.models, gateway.protocol, gateway.pubsub

Kind Name Line Description
function test_process_heartbeat_over_ws 70
function test_process_rpc_request_response 89
function test_process_invalid_json 114
function test_broadcast_to_multiple_ws 138
function test_push_to_client_over_ws 170
function test_push_to_missing_client 188

tests/gateway/test_publisher_wiring.py

source · 16 tests · 439 lines

Tests for SPEC-014 publisher wiring (item 2): "publisher-less streams".

Covers: gateway.audit, gateway.config, gateway.handlers.governance, gateway.handlers.session, gateway.handlers.volk, gateway.protocol, gateway.pubsub, gateway.ring_buffer, gateway.rpc, gateway.session, governance.policy_engine, governance.prolog_client, infra.prolog_bridge

Kind Name Line Description
function test_volk_register_publishes_lifecycle_event 70
function test_volk_deregister_publishes_lifecycle_event 97
function test_volk_deregister_nonexistent_does_not_publish 126
function test_publish_lifecycle_event_noop_without_processor 148 No processor injected (e.g. constructed before gateway boot wires it)
function test_session_open_publishes_session_events 161
function test_session_close_publishes_session_events 185
function test_session_open_without_processor_does_not_raise 213
function test_session_close_without_processor_does_not_raise 220
function test_handle_events_registers_real_subscription 233
function test_handle_facts_subscribe_registers_real_subscription 246
function test_handle_events_subscription_respects_filters_on_delivery 257 session.events subscribed with a session_id filter only receives
function test_publish_decision_event_reaches_subscriber 296 publish_decision_event delivers a real decision dict, nested under
function test_publish_decision_event_noop_without_processor 328 No processor injected (e.g. constructed before gateway boot wires it)
function test_handle_evaluate_with_real_engine_publishes_governance_event 339 A real governance decision, produced by handle_evaluate through a REAL
function test_handle_evaluate_stub_mode_does_not_publish 387 Without a PolicyEngine wired, handle_evaluate answers with the
function test_handle_evaluate_engine_error_publishes_denied_event 409 A real engine.evaluate() failure still fail-closed-denies AND

tests/gateway/test_pubsub.py

source · 48 tests · 387 lines

Covers: gateway.pubsub

Kind Name Line Description
function test_evaluate_filters_no_filters_matches_everything 37
function test_evaluate_filters_volk_id_matches_to 41
function test_evaluate_filters_volk_id_matches_from 45
function test_evaluate_filters_volk_id_no_match 49
function test_evaluate_filters_subject_glob_match 53
function test_evaluate_filters_subject_glob_no_match 58
function test_evaluate_filters_plain_key_equality 63
function test_evaluate_filters_multiple_keys_and_semantics 68
function test_pubsub_init 79
function test_subscribe_basic 90
function test_subscribe_with_filters 97
function test_subscribe_invalid_connection_id_type 104
function test_subscribe_empty_connection_id 110
function test_subscribe_invalid_topic_type 116
function test_subscribe_empty_topic 122
function test_unsubscribe_existing 133
function test_unsubscribe_missing 141
function test_unsubscribe_invalid_connection_id_type 147
function test_unsubscribe_empty_connection_id 153
function test_unsubscribe_invalid_topic_type 159
function test_unsubscribe_empty_topic 165
function test_unsubscribe_pattern_not_subscribed 171
function test_unsubscribe_by_id_existing 183
function test_unsubscribe_by_id_missing 191
function test_unsubscribe_by_id_invalid_type 197
function test_unsubscribe_by_id_empty 203
function test_unsubscribe_all 214
function test_unsubscribe_all_missing 223
function test_unsubscribe_all_invalid_type 229
function test_unsubscribe_all_empty 235
function test_get_matching_connections_exact 246
function test_get_matching_connections_wildcard 253
function test_get_matching_connections_no_match 260
function test_get_matching_connections_invalid_topic_type 267
function test_get_matching_connections_empty_topic 273
function test_get_matching_connections_dedupes_same_connection 279
function test_get_matching_connections_payload_filters_out_non_matching 289
function test_get_matching_connections_payload_keeps_matching 296
function test_get_subscriptions_sorted 308
function test_get_subscriptions_invalid_type 316
function test_get_subscriptions_empty 322
function test_publish_counts_matching_connections 333
function test_publish_no_matches 341
function test_publish_invalid_topic_type 347
function test_publish_empty_topic 353
function test_get_subscription_by_id_existing 364
function test_get_subscription_by_id_missing 373
function test_get_total_subscription_count 383

tests/gateway/test_pubsub_behavioral.py

source · 25 tests · 183 lines

Behavioral tests for gateway pub/sub manager.

Covers: gateway.models, gateway.pubsub

Kind Name Line Description
class TestPubSubManager 9 Real behavioral tests for PubSubManager.
method TestPubSubManager.test_subscribe 17
method TestPubSubManager.test_subscribe_with_filters 22
method TestPubSubManager.test_subscribe_invalid_connection_id_type 29
method TestPubSubManager.test_subscribe_empty_connection_id 36
method TestPubSubManager.test_subscribe_invalid_topic_type 41
method TestPubSubManager.test_subscribe_empty_topic 46
method TestPubSubManager.test_unsubscribe 51
method TestPubSubManager.test_unsubscribe_not_found 57
method TestPubSubManager.test_unsubscribe_by_id 62
method TestPubSubManager.test_unsubscribe_by_id_not_found 68
method TestPubSubManager.test_unsubscribe_all 73
method TestPubSubManager.test_unsubscribe_all_not_found 82
method TestPubSubManager.test_get_matching_connections_exact_match 87
method TestPubSubManager.test_get_matching_connections_wildcard 95
method TestPubSubManager.test_get_matching_connections_no_match 103
method TestPubSubManager.test_get_matching_connections_multiple 111
method TestPubSubManager.test_get_matching_connections_invalid_topic 120
method TestPubSubManager.test_get_matching_connections_empty_topic 127
method TestPubSubManager.test_get_subscriptions 134
method TestPubSubManager.test_get_subscriptions_not_found 141
method TestPubSubManager.test_get_subscription_by_id 146
method TestPubSubManager.test_get_subscription_by_id_not_found 154
method TestPubSubManager.test_get_total_subscription_count 161
method TestPubSubManager.test_multiple_subscriptions_same_connection 169
method TestPubSubManager.test_isolation_between_connections 179

tests/gateway/test_reply_consumer_addressing.py

source · 3 tests · 207 lines

Covers: agents.kernel_handler, cxp.proto_codec, cxp.servicer, cxp.transport, gateway.handlers.cxp, gateway.pubsub, kernel.pipeline, core.packet/ (package)

Kind Name Line Description
function test_two_gateways_each_receive_only_their_own_reply 74 End-to-end 2/2: two gateway-shaped CxpHandler instances, each with
function test_no_consumer_id_falls_back_to_legacy_human_queue 137 Back-compat: a CxpHandler that never calls set_reply_consumer_id
function test_send_stamps_reply_to_metadata_on_kernel_bound_packet 173 The metadata.reply_to stamp appears on the packet

tests/gateway/test_ring_buffer.py

source · 11 tests · 118 lines

Tests for gateway.ring_buffer.

Covers: gateway.config, gateway.ring_buffer

Kind Name Line Description
class TestSerializeForRedis 33
method TestSerializeForRedis.test_dict_value 34
method TestSerializeForRedis.test_list_value 39
method TestSerializeForRedis.test_none_value 44
method TestSerializeForRedis.test_string_value 49
method TestSerializeForRedis.test_int_value 54
method TestSerializeForRedis.test_multiple_values 59
class TestRedisRingBufferInit 73
method TestRedisRingBufferInit.test_init_from_config 74
method TestRedisRingBufferInit.test_client_property_none 85
class TestRedisRingBufferNotConnected 91
method TestRedisRingBufferNotConnected.test_write_raises 92
method TestRedisRingBufferNotConnected.test_read_raises 102
method TestRedisRingBufferNotConnected.test_read_since_raises 111

tests/gateway/test_ring_buffer_behavioral.py

source · 21 tests · 256 lines

Behavioral tests for gateway Redis ring buffer.

Covers: gateway.config, gateway.exceptions, gateway.ring_buffer

Kind Name Line Description
class TestSerializeForRedis 17 Tests for serialize_for_redis helper.
method TestSerializeForRedis.test_string_values 20
method TestSerializeForRedis.test_dict_values 24
method TestSerializeForRedis.test_list_values 28
method TestSerializeForRedis.test_none_values 32
method TestSerializeForRedis.test_int_values 36
method TestSerializeForRedis.test_bool_values 40
method TestSerializeForRedis.test_mixed_values 44
class TestRedisRingBuffer 61 Real behavioral tests using live Redis.
method TestRedisRingBuffer.test_connect 74
method TestRedisRingBuffer.test_write_and_read 82
method TestRedisRingBuffer.test_read_order 92
method TestRedisRingBuffer.test_read_count_limit 105
method TestRedisRingBuffer.test_read_since 115
method TestRedisRingBuffer.test_write_not_connected 129
method TestRedisRingBuffer.test_read_not_connected 136
method TestRedisRingBuffer.test_read_since_not_connected 143
method TestRedisRingBuffer.test_close_idempotent 150
method TestRedisRingBuffer.test_write_complex_data 156
method TestRedisRingBuffer.test_max_length_capping 179
class TestRedisRingBufferStreamErrorPaths 187 write()/read()/read_since() wrap real Redis errors in RingBufferError.
method TestRedisRingBufferStreamErrorPaths.test_write_wraps_wrongtype_redis_error 217
method TestRedisRingBufferStreamErrorPaths.test_read_wraps_wrongtype_redis_error 231
method TestRedisRingBufferStreamErrorPaths.test_read_since_wraps_wrongtype_redis_error 245

tests/gateway/test_ring_buffer_serialize.py

source · 7 tests · 44 lines

Tests for gateway/ring_buffer.py serialize_for_redis.

Covers: gateway.ring_buffer

Kind Name Line Description
class TestSerializeForRedis 8
method TestSerializeForRedis.test_empty_dict 9
method TestSerializeForRedis.test_string_value 12
method TestSerializeForRedis.test_int_value 15
method TestSerializeForRedis.test_none_value 18
method TestSerializeForRedis.test_dict_value 21
method TestSerializeForRedis.test_list_value 26
method TestSerializeForRedis.test_mixed_values 31

tests/gateway/test_rpc_behavioral.py

source · 10 tests · 273 lines

Behavioral tests for gateway RPC dispatcher.

Covers: core.graph.adapters.bolt_async, gateway.audit, gateway.config, gateway.exceptions, gateway.handlers.auth, gateway.handlers.cxp, gateway.handlers.fireflies, gateway.handlers.gateway, gateway.handlers.governance, gateway.handlers.knowledge, gateway.handlers.memory, gateway.handlers.orchestrator, gateway.handlers.projects, gateway.handlers.session, gateway.handlers.state, gateway.handlers.volk, gateway.protocol, gateway.pubsub, gateway.ring_buffer, gateway.rpc, gateway.session, memory.memory_engine

Kind Name Line Description
class TestRPCHandler 29 Real behavioral tests for RPCHandler.
method TestRPCHandler.test_orchestrator_pubsub_wired_at_construction 40 Orchestrator gets pub/sub in init, before/without
method TestRPCHandler.test_session_handler_root_sourced_from_gateway_config 62 RPCHandler forwards an explicit session root -- sourced from
method TestRPCHandler.test_dispatch_unknown_method 81
method TestRPCHandler.test_dispatch_ping 87
method TestRPCHandler.test_dispatch_ping_legacy 93
method TestRPCHandler.test_dispatch_info 99
method TestRPCHandler.test_set_processor_with_real_processor 109 set_processor wires a real MessageProcessor into handlers.
method TestRPCHandler.test_set_graph_repository_with_real_repository 128 set_graph_repository wires a real repository into knowledge handler.
method TestRPCHandler.test_remaining_setters_forward_to_handlers 150 The rest of RPCHandler's post-construction injectors are thin
class TestMethodRegistry 201 Tests for _build_method_registry.
method TestMethodRegistry.test_registry_has_expected_methods 204

tests/gateway/test_runtime_config.py

source · 7 tests · 109 lines

Tests for gateway.runtime_config -- ConfigSnapshot/ConfigChange/

Covers: core.redis_factory, gateway.runtime_config

Kind Name Line Description
function test_store_decode_falls_back_to_raw_string_for_non_json 76 RuntimeConfigStore._decode degrades gracefully for values written
function test_store_close_disconnects_without_raising 100 close() delegates to the real async Redis client's aclose() -- must
class TestConfigSnapshot 26
method TestConfigSnapshot.test_to_dict 27
class TestConfigChange 42
method TestConfigChange.test_to_dict 43
class TestSecretRedactor 55
method TestSecretRedactor.test_default_patterns_redact 56
method TestSecretRedactor.test_extra_patterns_redact 64
method TestSecretRedactor.test_is_secret_key_case_insensitive 69

tests/gateway/test_server_behavioral.py

source · 17 tests · 369 lines

Behavioral tests for gateway WebSocket server.

Covers: cxp.proto_codec, cxp.servicer, cxp.transport, gateway.config, gateway.runtime_config, gateway.server

Kind Name Line Description
class TestStartNeo4jDriverFailure 25 start()'s Neo4j-driver-construction failure path.
method TestStartNeo4jDriverFailure.test_invalid_graph_uri_is_caught_and_driver_left_unset 45
class TestConsumeKernelRepliesRealClient 54 _consume_kernel_replies driven against a real CXP gRPC client.
method TestConsumeKernelRepliesRealClient.test_cancellation_mid_pump_is_swallowed_internally 68 Cancelling while blocked on a real in-flight receive_packets
method TestConsumeKernelRepliesRealClient.test_stop_swallows_reply_task_cancellation_after_real_failure 93 A dead kernel endpoint makes _pump_kernel_replies_once raise a
class TestConsumePipelineEventsRealFailure 129 _consume_pipeline_events against a real, unreachable Redis client.
method TestConsumePipelineEventsRealFailure.test_stop_swallows_pipeline_task_cancellation_after_redis_failure 137 A real Redis client pointed at a dead port makes xread raise a
class TestConsumeConfigEventsNoStore 175 _consume_config_events short-circuits when no RuntimeConfigStore
method TestConsumeConfigEventsNoStore.test_returns_immediately_without_config_store 185
class TestConsumeConfigEventsRealFailure 192 _consume_config_events against a real, unreachable Redis client
method TestConsumeConfigEventsRealFailure.test_stop_swallows_config_task_cancellation_after_redis_failure 201 A real Redis client pointed at a dead port makes
class TestJsonRpcHelpers 243 Tests for JSON-RPC helper functions.
method TestJsonRpcHelpers.test_jsonrpc_error 246
method TestJsonRpcHelpers.test_jsonrpc_error_with_data 254 Supplied data lands in details, under a SPEC-098 category.
method TestJsonRpcHelpers.test_jsonrpc_error_none_id 269
method TestJsonRpcHelpers.test_jsonrpc_result 274
class TestWebSocketGateway 282 Real behavioral tests for WebSocketGateway.
method TestWebSocketGateway.test_init 289
method TestWebSocketGateway.test_push_to_client_not_connected 296
method TestWebSocketGateway.test_broadcast_no_subscribers 303
method TestWebSocketGateway.test_vizint_webui_alias 307
class TestNeo4jImportFallback 314 Module-level try: from neo4j import AsyncGraphDatabase fallback.
method TestNeo4jImportFallback.test_neo4j_unavailable_sets_flags_false 324
class TestConsumeKernelRepliesNoClient 340 _consume_kernel_replies short-circuits when no kernel is wired.
method TestConsumeKernelRepliesNoClient.test_returns_immediately_without_kernel_client 348
class TestConsumePipelineEventsNoRedis 357 _consume_pipeline_events short-circuits when Redis never connected.
method TestConsumePipelineEventsNoRedis.test_returns_immediately_without_redis_client 365

tests/gateway/test_server_coverage_wave.py

source · 32 tests · 978 lines

Coverage-wave tests for gateway/server.py (SPEC-014).

Covers: agents.kernel_handler, cxp.proto_codec, cxp.servicer, cxp.transport, gateway.config, gateway.models, gateway.ring_buffer, gateway.server, kernel.pipeline, core.packet/ (package)

Kind Name Line Description
class TestDecodePipelineEvent 163
method TestDecodePipelineEvent.test_bytes_fields_with_valid_json_data 164
method TestDecodePipelineEvent.test_str_fields_with_valid_json_data 170
method TestDecodePipelineEvent.test_invalid_json_falls_back_to_empty_dict 175
method TestDecodePipelineEvent.test_missing_data_field_defaults_to_empty_dict 180
method TestDecodePipelineEvent.test_empty_data_field_defaults_to_empty_dict 185
class TestPumpPipelineEventsOnce 196
method TestPumpPipelineEventsOnce.test_no_new_entries_returns_zero_count 204
method TestPumpPipelineEventsOnce.test_entry_with_thread_id_is_broadcast 228
method TestPumpPipelineEventsOnce.test_entry_without_thread_id_is_not_broadcast 266
class TestStartKernelWiring 302
method TestStartKernelWiring.test_cxp_env_unset_falls_back_to_task_only_mode 303 cxp_grpc_host/port() raising (both env vars unset) hits the
method TestStartKernelWiring.test_neo4j_driver_creation_failure_is_swallowed 319 A malformed graph_uri raises synchronously from
method TestStartKernelWiring.test_real_cxp_kernel_connects_during_start 336 A real, reachable CXP gRPC server lets start() wire the kernel
class TestGatewayInfoKernelBlock 377
method TestGatewayInfoKernelBlock.test_default_kernel_status_before_init_is_unavailable_and_unwired 378 A gateway that has never run _init_kernel (start() not called)
method TestGatewayInfoKernelBlock.test_unreachable_kernel_reports_in_process_and_not_wired 416 A gateway whose configured kernel endpoint is unreachable falls
method TestGatewayInfoKernelBlock.test_reachable_kernel_reports_grpc_wired_and_endpoint 441 A gateway wired to a real, reachable CXP kernel reports mode
method TestGatewayInfoKernelBlock.test_retry_attempts_unreachable_kernel_stay_bounded 470 The bounded gRPC retry loop makes exactly grpc_connect_attempts
class TestStopTaskCancellation 522
method TestStopTaskCancellation.test_stop_swallows_reply_task_cancellation 523
method TestStopTaskCancellation.test_stop_swallows_pipeline_task_cancellation 536
class TestConsumeKernelReplies 555
method TestConsumeKernelReplies.test_returns_immediately_when_no_kernel_client 556
method TestConsumeKernelReplies.test_cancellation_during_pump_call_breaks_cleanly 563 Cancelling while genuinely parked inside `await
method TestConsumeKernelReplies.test_success_then_failure_drives_backoff_and_cancels_cleanly 612
class TestConsumePipelineEvents 687
method TestConsumePipelineEvents.test_returns_immediately_when_no_redis_client 688
method TestConsumePipelineEvents.test_broken_redis_client_hits_exception_backoff 695 xread() against the pipeline-events key fails for real when that
class TestPolicyEngineFactory 733
method TestPolicyEngineFactory.test_governance_evaluate_triggers_lazy_policy_engine_build 734
class TestGatewayReadyClosure 761
method TestGatewayReadyClosure.test_ready_endpoint_reports_started_once_server_listens 762
class TestHandleConnectionBranches 789
method TestHandleConnectionBranches.test_invalid_auth_token_logs_failure_and_closes 808
method TestHandleConnectionBranches.test_client_disconnect_after_auth_hits_connection_closed 825 A graceful ws.close() doesn't exercise this branch: websockets'
method TestHandleConnectionBranches.test_legacy_non_jsonrpc_message_routes_to_processor 848
method TestHandleConnectionBranches.test_jsonrpc_missing_method_returns_invalid_request 870
method TestHandleConnectionBranches.test_jsonrpc_handler_raw_exception_yields_internal_error 889 projects.tasks parses limit with a bare int(...) before its own
class TestHandshakeNoiseFilter 925 Backlog 502: every connect-and-close liveness probe made websockets
method TestHandshakeNoiseFilter.test_drops_invalid_message_records 942
method TestHandshakeNoiseFilter.test_keeps_real_errors_and_plain_records 948
method TestHandshakeNoiseFilter.test_bare_tcp_probe_logs_no_error_record 953 End to end: a connect-and-close probe against a running gateway

tests/gateway/test_server_integration.py

source · 16 tests · 580 lines

Integration tests for gateway WebSocket server.

Covers: cxp.proto_codec, cxp.servicer, cxp.transport, gateway.auth, gateway.config, gateway.server, core.packet/ (package)

Kind Name Line Description
class TestWebSocketGatewayIntegration 29 Integration tests using real WebSocket connections.
method TestWebSocketGatewayIntegration.test_server_listens 49
method TestWebSocketGatewayIntegration.test_jsonrpc_ping 53
method TestWebSocketGatewayIntegration.test_jsonrpc_info 80
method TestWebSocketGatewayIntegration.test_jsonrpc_unknown_method 105
method TestWebSocketGatewayIntegration.test_invalid_json_after_auth 129
method TestWebSocketGatewayIntegration.test_broadcast 147
class TestGatewayHttpReadySurface 179 Exercises the HTTP /ready probe wired in start().
method TestGatewayHttpReadySurface.test_ready_endpoint_reports_started_gateway 200
class TestJsonRpcEdgeCases 222 Edge cases in _handle_jsonrpc not covered by the happy-path tests.
method TestJsonRpcEdgeCases.test_missing_method_returns_invalid_request 249
method TestJsonRpcEdgeCases.test_handler_exception_returns_internal_error_with_correlation_id 263 A protocol violation (params of the wrong type) makes the real
method TestJsonRpcEdgeCases.test_governance_evaluate_builds_policy_engine_from_factory 291 start() wires a deferred _make_policy_engine factory so the
class TestLegacyMessageRouting 318 _handle_message routes non-JSON-RPC frames to the legacy processor.
method TestLegacyMessageRouting.test_legacy_heartbeat_frame_routes_through_processor 334
class TestConnectionLifecycleEdgeCases 365 _handle_connection: anonymous-denied close and abrupt disconnects.
method TestConnectionLifecycleEdgeCases.test_non_auth_first_message_denied_when_anonymous_disallowed 381
method TestConnectionLifecycleEdgeCases.test_abrupt_client_disconnect_is_handled 400 Aborting the raw TCP transport (no WS close handshake) makes the
class TestNeo4jDriverLifecycle 449 start()'s graph-repository wiring and stop()'s cleanup of it.
method TestNeo4jDriverLifecycle.test_stop_closes_the_neo4j_driver_opened_in_start 462
class TestCxpKernelConnectionBranches 488 start()'s CXP kernel wiring when endpoint_config is unavailable.
method TestCxpKernelConnectionBranches.test_endpoint_config_import_error_falls_back_to_pipeline_kernel 499
class TestConsumeKernelRepliesLifecycle 519 Direct exercises of the reply-pump background loop's success, failure
method TestConsumeKernelRepliesLifecycle.test_successful_pump_resets_failures_then_cancels_cleanly 538 A completed (non-cancelled) successful pump resets

tests/gateway/test_session.py

source · 20 tests · 157 lines

Tests for gateway.session.

Covers: gateway.config, gateway.models, gateway.session

Kind Name Line Description
class TestConnectionManager 32
method TestConnectionManager.test_init 33
method TestConnectionManager.test_register_new 40
method TestConnectionManager.test_register_existing_reactivates 48
method TestConnectionManager.test_unregister_found 56
method TestConnectionManager.test_unregister_not_found 64
method TestConnectionManager.test_unregister_invalid_type 69
method TestConnectionManager.test_unregister_empty 74
method TestConnectionManager.test_get_found 79
method TestConnectionManager.test_get_not_found 86
method TestConnectionManager.test_get_invalid_type 90
method TestConnectionManager.test_get_empty 95
method TestConnectionManager.test_update_heartbeat_found 100
method TestConnectionManager.test_update_heartbeat_not_found 109
method TestConnectionManager.test_update_heartbeat_invalid_type 114
method TestConnectionManager.test_get_active_connections 119
method TestConnectionManager.test_get_active_connections_excludes_closed 126
method TestConnectionManager.test_get_user_connections 133
method TestConnectionManager.test_get_user_connections_invalid_type 142
method TestConnectionManager.test_get_user_connections_empty 147
method TestConnectionManager.test_get_user_connections_excludes_closed 152

tests/gateway/test_session_behavioral.py

source · 18 tests · 140 lines

Behavioral tests for gateway connection/session manager.

Covers: gateway.config, gateway.models, gateway.session

Kind Name Line Description
class TestConnectionManager 12 Real behavioral tests for ConnectionManager.
method TestConnectionManager.test_register_new_connection 20
method TestConnectionManager.test_register_reuse_existing 27
method TestConnectionManager.test_unregister 35
method TestConnectionManager.test_unregister_not_found 43
method TestConnectionManager.test_unregister_invalid_type 48
method TestConnectionManager.test_unregister_empty 53
method TestConnectionManager.test_get 58
method TestConnectionManager.test_get_not_found 65
method TestConnectionManager.test_get_invalid_type 70
method TestConnectionManager.test_update_heartbeat 75
method TestConnectionManager.test_update_heartbeat_not_found 84
method TestConnectionManager.test_update_heartbeat_invalid_type 89
method TestConnectionManager.test_get_active_connections 96
method TestConnectionManager.test_get_user_connections 105
method TestConnectionManager.test_get_user_connections_empty 114
method TestConnectionManager.test_get_user_connections_invalid_type 119
method TestConnectionManager.test_get_user_connections_empty_user 126
method TestConnectionManager.test_connection_count 133

tests/gateway/test_spec098_api_standards.py

source · 28 tests · 301 lines

SPEC-098 API Standards — the nine FRs that have a home in this gateway.

Covers: gateway.auth, gateway.config, gateway.error_taxonomy, gateway.exceptions, gateway.http_surface, gateway.models, gateway.server

Kind Name Line Description
class TestErrorSchemaAndCategories 54 FR-006: code + message + details. FR-007: six categories.
method TestErrorSchemaAndCategories.test_every_error_carries_code_message_and_details 57
method TestErrorSchemaAndCategories.test_details_is_an_object_even_when_empty 66 A client reading error.data.details must not branch on presence.
method TestErrorSchemaAndCategories.test_supplied_data_becomes_details 71
method TestErrorSchemaAndCategories.test_the_category_can_be_overridden_by_the_caller 77 -32600 is both "malformed request" and "not authenticated".
method TestErrorSchemaAndCategories.test_correlation_id_stays_beside_category_not_inside_details 95 Tracing metadata is about the REQUEST, not about the failure.
method TestErrorSchemaAndCategories.test_the_numeric_code_is_never_rewritten 115 The category is additive; clients already switch on the code.
method TestErrorSchemaAndCategories.test_reserved_codes_map_to_their_category 138
method TestErrorSchemaAndCategories.test_an_application_code_defaults_to_sys 141 A server-chosen error is a server-side condition to the client.
method TestErrorSchemaAndCategories.test_the_taxonomy_is_exactly_the_six_fr007_categories 145 FR-007 names six. More would mean clients cannot exhaustively branch.
method TestErrorSchemaAndCategories.test_error_data_always_produces_both_members 156
class TestSecurityHeadersAndTracing 161 FR-016 security headers, FR-017 X-Request-ID.
method TestSecurityHeadersAndTracing.test_security_headers_are_present 164
method TestSecurityHeadersAndTracing.test_a_supplied_request_id_is_echoed 169
method TestSecurityHeadersAndTracing.test_a_request_id_is_minted_when_absent 173 A caller that cannot see its trace id cannot quote it in a bug.
method TestSecurityHeadersAndTracing.test_minted_request_ids_are_not_reused 178
method TestSecurityHeadersAndTracing.test_headers_apply_to_every_endpoint 183
class TestVersionedHealth 190 FR-018 — /api/v1/health, without abandoning /health.
method TestVersionedHealth.test_the_versioned_path_answers 193
method TestVersionedHealth.test_it_agrees_with_the_unversioned_path 198 Two health endpoints that can disagree are their own outage class.
class TestCORS 209 FR-022 — CORS for ALLOWED origins, not for every origin.
method TestCORS.test_an_allowed_origin_is_permitted 212
method TestCORS.test_an_unlisted_origin_gets_no_allow_header 216 A wildcard here would let any page drive the gateway.
method TestCORS.test_origins_are_configurable 223
class TestTokenAuthentication 235 FR-010/FR-019 — the credentials are actually verified.
method TestTokenAuthentication.test_a_token_this_gateway_issued_validates 238
method TestTokenAuthentication.test_a_forged_token_is_rejected 245 The signature is verified, not merely decoded.
method TestTokenAuthentication.test_a_token_without_a_subject_is_rejected 254 Authentication that cannot name WHO is not authentication.
method TestTokenAuthentication.test_garbage_is_rejected 263
class TestWebSocketMessageTypes 269 FR-020 — every named semantic exists, as a type or as a method.
method TestWebSocketMessageTypes.test_event_and_error_are_message_types 272
method TestWebSocketMessageTypes.test_ping_and_pong_are_carried_by_one_heartbeat_type 276 The JSON-RPC envelope already distinguishes request from response.
method TestWebSocketMessageTypes.test_subscribe_and_unsubscribe_are_methods_not_types 284 Subscription takes parameters and returns a result — it is a CALL.
method TestWebSocketMessageTypes.test_the_mapping_to_fr020_is_documented_on_the_enum 296 The reconciliation must survive in the code, not only in the spec.

tests/gateway/test_subscription_filters.py

source · 24 tests · 314 lines

Tests for SPEC-014 FR-009 subscription filter evaluation and delivery.

Covers: gateway.audit, gateway.config, gateway.models, gateway.protocol, gateway.pubsub, gateway.ring_buffer, gateway.rpc, gateway.session

Kind Name Line Description
function test_evaluate_filters_empty_matches_everything 41
function test_evaluate_filters_equality_match 45
function test_evaluate_filters_equality_mismatch 49
function test_evaluate_filters_missing_key_mismatches 53
function test_evaluate_filters_and_semantics_all_pass 57
function test_evaluate_filters_and_semantics_one_fails 63
function test_evaluate_filters_volk_id_matches_to 69
function test_evaluate_filters_volk_id_matches_from 74
function test_evaluate_filters_volk_id_matches_neither 79
function test_evaluate_filters_subject_glob_match 84
function test_evaluate_filters_subject_glob_mismatch 89
function test_evaluate_filters_subject_missing_from_payload 94
function test_get_matching_connections_no_payload_ignores_filters 104 Backward compatibility: existing callers that omit payload keep
function test_get_matching_connections_payload_matches_filter 114
function test_get_matching_connections_payload_mismatch_withheld 124
function test_get_matching_connections_no_filters_always_passes 134
function test_get_matching_connections_one_of_multiple_subs_passes 144 A connection with two subscriptions to the same topic (different
function test_get_matching_connections_filters_per_connection_independent 157
function test_broadcast_delivers_when_filter_matches 188
function test_broadcast_withholds_when_filter_mismatches 206
function test_broadcast_no_filter_passes_everything 223
function test_handle_publish_legacy_withholds_on_filter_mismatch 243
function test_handle_publish_legacy_delivers_on_filter_match 268
function test_handle_publish_legacy_no_filter_delivers 293

tests/gateway/test_test_runner.py

source · 9 tests · 472 lines

Covers: core.graph.adapters.bolt_async, gateway.config, gateway.test_runner

Kind Name Line Description
function test_run_passes_extra_args_through_to_pytest_command 237 extra_args are appended to the pytest invocation and actually filter
function test_run_reports_error_status_on_real_launch_failure 264 Pointing project_root at a directory that does not exist makes the
function test_run_records_error_outcome_and_summary_error_count 289 A fixture-setup failure reports as a per-test ERROR line (tracked by
function test_run_completes_despite_broadcast_failures 315 A broadcast_fn that always raises must not abort the run: _emit logs
function test_run_completes_despite_graph_store_failure 335 An unreachable Neo4j driver must not abort the run: _store_result logs
function test_store_result_returns_false_with_no_graph_repository 377 No graph repository configured: nothing was stored, and the caller
function test_store_result_returns_false_on_unreachable_graph 389 A write that is attempted and fails must return False so the caller
function test_store_result_returns_true_on_success 407 A write that actually lands returns True -- the signal is not
function test_run_times_out_kills_and_reaps_subprocess 439 When the subprocess's stdout closes but the process itself keeps

tests/gateway/test_test_runner_streaming.py

source · 9 tests · 366 lines

Covers: core.graph.adapters.bolt_async, gateway.config, gateway.pubsub, gateway.test_runner

Kind Name Line Description
function test_initial_state_not_running 138
function test_run_streams_started_then_complete 150 A real all-passing run streams 'started' first and 'complete' last, and
function test_run_streams_per_test_progress 181 Per-test '... PASSED' lines drive incremental 'running' events whose
function test_run_finally_resets_running_flag 203 is_running is True only during the run and reset to False afterwards.
function test_run_failing_reports_failed_status_and_names 218 A run containing a failing test ends in 'failed' (non-zero returncode),
function test_run_empty_path_collects_nothing 245 Pointing the run at an empty directory collects zero tests. pytest exits
function test_run_rejects_concurrent_run 272 While a run is in progress the runner refuses to start another.
function test_run_with_real_pubsub_publish_sink 294 The broadcast contract is satisfied by the real PubSubManager.publish
function test_run_persists_result_to_real_neo4j 329 After a real run, _store_result writes a :TestRun node to real graph with

tests/gateway/test_token_auth.py

source · 8 tests · 83 lines

Tests for gateway.auth.

Covers: gateway.auth, gateway.config, gateway.exceptions

Kind Name Line Description
class TestTokenAuthenticator 30
method TestTokenAuthenticator.test_create_token 31
method TestTokenAuthenticator.test_validate_token 38
method TestTokenAuthenticator.test_create_token_with_claims 45
method TestTokenAuthenticator.test_create_token_empty_user_id 52
method TestTokenAuthenticator.test_create_token_non_string_user_id 58
method TestTokenAuthenticator.test_create_token_invalid_claims 64
method TestTokenAuthenticator.test_validate_token_invalid 70
method TestTokenAuthenticator.test_validate_token_missing_sub 76

tests/gateway/test_volk_status_event_broadcast.py

source · 1 tests · 131 lines

G3d wiring test (packet P8, plans/volk-comms-heartbeat-design.md §4.1

Covers: agents.volk_registry, core.base.traces, gateway.server, kernel.cli_main, kernel.event_bus, kernel.volk_status_bridge, kernel/ (package)

Kind Name Line Description
function test_status_change_event_reaches_gateway_broadcast 66 A real ACTIVE -> INACTIVE lazy-timeout transition fires a

tests/gateway/test_workflow_types.py

source · 11 tests · 122 lines

Tests for gateway.workflow_types -- WorkflowStatus/WorkflowState/

Covers: gateway.workflow_types

Kind Name Line Description
class TestWorkflowStatus 25
method TestWorkflowStatus.test_values 26
method TestWorkflowStatus.test_is_str_enum 34
class TestWorkflowState 39
method TestWorkflowState.test_to_dict 40
method TestWorkflowState.test_to_dict_with_no_last_stage 54
class TestWorkflowControlPortProtocol 78
method TestWorkflowControlPortProtocol.test_is_protocol 79
method TestWorkflowControlPortProtocol.test_has_required_methods 82
class TestBareWorkflowControlPortDefaults 93
method TestBareWorkflowControlPortDefaults.test_start_workflow_body_is_a_noop 94
method TestBareWorkflowControlPortDefaults.test_pause_workflow_body_is_a_noop 100
method TestBareWorkflowControlPortDefaults.test_resume_workflow_body_is_a_noop 106
method TestBareWorkflowControlPortDefaults.test_cancel_workflow_body_is_a_noop 112
method TestBareWorkflowControlPortDefaults.test_workflow_status_body_is_a_noop 118

Support files

Fixtures, package markers and helpers without test functions.