Go side:
- Log hooks returned by Implemented()
- Log each hook name -> ID mapping
- Log OnActivate implementation status
- Log OnActivate call flow
Python side:
- Log Implemented() return value
- Log OnActivate gRPC receipt and handler invocation
This is temporary debug logging to diagnose why OnActivate
isn't being called for Python plugins.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add tests for both Go and Python ServeHTTP implementations covering:
- Body chunking behavior (small, exact, multiple, large bodies)
- Context cancellation during body streaming
- Header conversion utilities
- HTTPRequest/HTTPResponseWriter helper classes
- Request body assembly from multiple chunks
- Error handling (500 for handler errors, 404 for missing handler)
Go tests:
- TestChunking_* for body chunking scenarios
- TestConvertHTTPHeaders for header conversion
- TestBuildRequestInit for request metadata building
- TestWriteResponseHeaders for response header writing
- TestContextCancellation_DuringBodyRead for cancellation
Python tests:
- TestHTTPRequest for request wrapper class
- TestHTTPResponseWriter for response writer class
- TestHeaderConversion for proto<->dict conversion
- TestServeHTTPServicer for gRPC servicer behavior
- TestChunkingBehavior for body assembly
- TestCancellation for request cancellation
Also:
- Fixed sendRequest to properly set body_complete flag on EOF
- Added ServeHTTP to HookName enum
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add test_hooks_command_config.py: ExecuteCommand and
ConfigurationWillBeSaved hook tests
- Add test_hooks_user_channel.py: User lifecycle, channel/team,
and SAML login hook tests
- Add test_hooks_notifications.py: Reaction, notification, and
preferences hook tests
- Add test_hooks_system.py: System, WebSocket, cluster, shared
channels, and support data hook tests
- All 65 new tests verify correct hook semantics including:
- Fire-and-forget vs return-value hooks
- Rejection string semantics for UserWillLogIn
- Modify/reject semantics for notifications
- Error handling for all hook types
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add test_hooks_grpc_integration.py with in-process gRPC tests:
- Test Implemented RPC returns correct hook list
- Test lifecycle hooks (OnActivate, OnDeactivate, OnConfigurationChange)
- Test MessageWillBePosted allow/reject/modify scenarios
- Test notification hooks (MessageHasBeenPosted)
- Test activation failure propagation via response.error
- Test async handlers work through gRPC
- Fix lifecycle hooks to encode errors in response, not gRPC status
- Remove context parameter from runner.invoke() for lifecycle hooks
- Ensures activation failures are returned as AppError, not gRPC error
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Test handshake line format matches go-plugin protocol
- Test server starts on ephemeral port
- Test health check responds with SERVING status
- Test RuntimeConfig loading from environment
- Add integration test for full plugin lifecycle
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Test sync and async handler execution
- Test timeout handling with HookTimeoutError
- Test exception wrapping in HookInvocationError
- Test gRPC status code conversion
- Test HookRunner class invocation
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Test hook decorator with enum, string, and inferred names
- Test Plugin base class hook discovery via __init_subclass__
- Test duplicate registration error
- Test implemented_hooks() returns sorted canonical names
- Test invoke_hook() and get_hook_handler() methods
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Create the foundational Python SDK package structure:
- pyproject.toml with project metadata and dependencies
- src/mattermost_plugin/ package with src layout
- Configured for Python >=3.9 with grpcio and protobuf deps
- Dev dependencies include grpcio-tools, mypy-protobuf, pytest
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>