Fix bugs, standardize error handling, add delete tools, and add tests#1
Open
adamweeks wants to merge 1 commit into
Open
Fix bugs, standardize error handling, add delete tools, and add tests#1adamweeks wants to merge 1 commit into
adamweeks wants to merge 1 commit into
Conversation
Critical bug fixes: - Remove ~50 lines of dead/unreachable code after the except block in send_webex_message that was left from a half-finished refactor - Fix the files parameter in send_webex_message — the SDK requires a list but a bare string was being passed, silently breaking file attachments - Fix timestamp field in create_error_response/create_success_response; REQUEST_TIMESTAMP env var is never set so the field was always empty string; now uses datetime.now(timezone.utc).isoformat() Architecture: - Remove double load_dotenv() call (was in both main.py and tools/common.py) - Remove redundant WEBEX_ACCESS_TOKEN check in main.py (tools/common.py already validates and raises on import) Error handling — all tools now use structured responses: - Standardize rooms.py, memberships.py, people.py, and the remaining message functions to use create_error_response / create_success_response with WebexErrorCodes (previously returned bare dicts with no error codes) - Extract _map_exception_to_error() and _*_to_dict() helpers in each module to eliminate repetitive per-field exception handling New tools (missing CRUD operations): - delete_webex_room / delete_webex_space - delete_webex_membership - delete_webex_message Code quality: - Consolidate duplicate mention-building logic in send_webex_message_with_mentions to use the existing create_message_with_mentions helper - Rename id parameter to person_id in list_webex_people (shadowed built-in) - Update _build_message_params shared helper used by both message send functions Config / metadata fixes: - Fix log level validation: accept "WARNING" not "WARN" (standard Python logging) - Fix pyproject.toml: rename dotenv -> python-dotenv, bump version to 1.0.0, add real description - Fix resources_count in version resource (was 8, now 10) - Update tools_count to 31 (added 3 delete tools + 2 delete aliases) Tests (new): - tests/test_messages.py: 38 unit tests covering mention formatters, create_message_with_mentions, send_webex_message validation, files wrapping, list/delete, response builders, and WebexConfig; mocks webexpythonsdk at sys.modules level so no real credentials are needed Documentation: - Add CLAUDE.md with full developer guide: layout, conventions, error code ranges, response shape, how to add a new tool, env var reference https://claude.ai/code/session_01KTZNsi11DycdLENcbUUbgU
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Critical bug fixes:
send_webex_message that was left from a half-finished refactor
but a bare string was being passed, silently breaking file attachments
REQUEST_TIMESTAMP env var is never set so the field was always empty string;
now uses datetime.now(timezone.utc).isoformat()
Architecture:
already validates and raises on import)
Error handling — all tools now use structured responses:
message functions to use create_error_response / create_success_response
with WebexErrorCodes (previously returned bare dicts with no error codes)
to eliminate repetitive per-field exception handling
New tools (missing CRUD operations):
Code quality:
to use the existing create_message_with_mentions helper
Config / metadata fixes:
add real description
Tests (new):
create_message_with_mentions, send_webex_message validation, files wrapping,
list/delete, response builders, and WebexConfig; mocks webexpythonsdk at
sys.modules level so no real credentials are needed
Documentation:
ranges, response shape, how to add a new tool, env var reference
https://claude.ai/code/session_01KTZNsi11DycdLENcbUUbgU