Commit graph

13 commits

Author SHA1 Message Date
Nick Misasi
eaad7aff18 feat(06-03): implement PostsMixin with post and reaction methods
Add PostsMixin with 15 methods:
- create_post, get_post, update_post, delete_post
- send_ephemeral_post, update_ephemeral_post, delete_ephemeral_post
- get_post_thread, get_posts_since, get_posts_after, get_posts_before
- add_reaction, remove_reaction, get_reactions

All methods follow the established mixin pattern with proper error
handling and type annotations.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 10:06:11 -05:00
Nick Misasi
31c3bd6a89 feat(06-03): add wrapper dataclasses for Post, Reaction, FileInfo, KV types
Add dataclasses for:
- Post: Mattermost message with full field support
- Reaction: User emoji reaction to a post
- PostList: Ordered list of posts with pagination
- FileInfo: File metadata with all attributes
- UploadSession: Resumable upload session
- PluginKVSetOptions: Options for KV set operations

All wrappers include from_proto() and to_proto() methods for
protobuf serialization.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 10:06:04 -05:00
Nick Misasi
529e8d9a05 test(06-02): add unit tests for User/Team/Channel API methods
Add comprehensive test suite covering:

Wrapper type tests:
- User, Team, Channel from_proto/to_proto round-trips
- UserStatus, TeamMember, ChannelMember conversions

Client method tests:
- User: get_user success, not found error, gRPC error, create_user
- Team: get_team, create_team_member, get_teams_for_user
- Channel: get_channel, add_channel_member, get_direct_channel, search

Error handling tests:
- PermissionDeniedError (HTTP 403)
- ValidationError (HTTP 400)
- AlreadyExistsError (HTTP 409)

All 21 tests use mocked stubs for fast execution.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 09:55:18 -05:00
Nick Misasi
f66cfeb78d feat(06-02): add coverage audit script for RPC/method parity
Add audit_client_coverage.py that verifies all gRPC RPCs have
corresponding Python client methods:

- Extracts RPC names from generated gRPC stub source
- Compares against PluginAPIClient public methods
- Supports --include/--exclude regex filters for scoping
- Reports coverage percentage and missing methods

Usage:
  python scripts/audit_client_coverage.py --include '(User|Team|Channel)'

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 09:55:10 -05:00
Nick Misasi
f598ab0121 fix(06-02): connect mixin classes to PluginAPIClient
Add mixin imports and inheritance to PluginAPIClient so that the
User/Team/Channel API methods are actually available on the client.

This was missing from the previous mixin implementation commit.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 09:55:01 -05:00
Nick Misasi
e1dfd1ec5f feat(06-02): implement User/Team/Channel API client mixins
Add domain-specific mixin classes for PluginAPIClient:
- UsersMixin: 33 user methods (CRUD, status, auth, sessions, permissions)
- TeamsMixin: 20 team methods (CRUD, members, icons, stats)
- ChannelsMixin: 25 channel methods (CRUD, members, sidebar categories)

Each method:
- Builds correct protobuf requests from Python inputs
- Converts responses to Pythonic wrapper types
- Maps gRPC/AppError to SDK exceptions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 14:55:56 -05:00
Nick Misasi
4411ccbcbf feat(06-02): add wrapper dataclasses for User, Team, Channel types
Add Pythonic wrapper types for core Mattermost entities:
- User, UserStatus, CustomStatus, UserAuth, Session, UserAccessToken
- Team, TeamMember, TeamMemberWithError, TeamUnread, TeamStats
- Channel, ChannelMember, ChannelStats, SidebarCategoryWithChannels
- ViewUsersRestrictions and related enums

All wrappers implement from_proto/to_proto for protobuf conversion.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 14:55:48 -05:00
Nick Misasi
6043b7906a test(06-01): add smoke tests for codegen and client
Add comprehensive smoke tests:
- test_codegen_imports.py: verify all generated modules import correctly
- test_client_smoke.py: test client lifecycle, error mapping, and RPC calls
- Tests use in-process fake gRPC server for integration testing
- 42 tests passing covering imports, message creation, and error handling

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 14:45:01 -05:00
Nick Misasi
0c905f4d07 feat(06-01): add generated protobuf and gRPC Python code
Generate Python code from server/public/pluginapi/grpc/proto:
- Protocol buffer message definitions (*_pb2.py)
- gRPC service stubs (*_pb2_grpc.py)
- Type stubs for IDE completion (*_pb2.pyi, *_pb2_grpc.pyi)
- Imports fixed to use package-relative imports

Generated from 18 .proto files using grpcio-tools and mypy-protobuf.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 14:44:54 -05:00
Nick Misasi
5cff580fcb feat(06-01): add sync and async Plugin API clients
Add client classes for Mattermost Plugin API:
- PluginAPIClient: sync client with context manager support
- AsyncPluginAPIClient: async client with grpc.aio support
- Both implement get_server_version() as smoke test RPC
- Proper error handling converts gRPC errors to SDK exceptions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 14:44:47 -05:00
Nick Misasi
d52baf9345 feat(06-01): add channel factory and exception hierarchy
Add core SDK runtime components:
- channel.py: gRPC channel factory with keepalive and size options
- exceptions.py: SDK exception hierarchy with gRPC error mapping
  - PluginAPIError (base), NotFoundError, PermissionDeniedError,
    ValidationError, AlreadyExistsError, UnavailableError
- convert_grpc_error() and convert_app_error() utilities

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 14:44:41 -05:00
Nick Misasi
aae96ff737 feat(06-01): add protobuf code generation script
Add generate_protos.py script that:
- Generates Python and gRPC code from .proto files
- Generates mypy type stubs via mypy-protobuf
- Fixes imports to use package-relative imports
- Outputs to src/mattermost_plugin/grpc/

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 14:44:35 -05:00
Nick Misasi
3cf6e36477 feat(06-01): add Python SDK package scaffold with pyproject.toml
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>
2026-01-16 14:44:29 -05:00