refactor: rename ActivityParams → SendableActivity#342
refactor: rename ActivityParams → SendableActivity#342rajan-chari wants to merge 1 commit intofix/338-remove-dead-input-classesfrom
Conversation
Rename the outbound activity union type to better communicate its purpose. ActivityParams was vague — SendableActivity makes the API self-documenting: `async def send(self, activity: SendableActivity)`. Also renames the module file activity_params.py → sendable_activity.py. 13 files changed, pure rename — no logic changes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Manual Test Results — Echo Bot (Python)Tested on branch
All 5 test steps passed across the full PR stack. |
There was a problem hiding this comment.
Pull request overview
Renames the outbound activity union type in the Teams SDK from ActivityParams to SendableActivity to make outbound APIs (e.g., send(), reply(), conversation activity operations) more self-descriptive.
Changes:
- Renamed the outbound activity union type
ActivityParams→SendableActivityand updated exports/imports accordingly. - Renamed the defining module
activity_params.py→sendable_activity.pyand updated all references across apps + API packages. - Updated type hints in send/reply/create/update/reply APIs and adjusted related unit tests.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/apps/tests/test_activity_context.py | Renames a reply() test to reflect SendableActivity. |
| packages/apps/src/microsoft_teams/apps/routing/activity_context.py | Updates send()/reply() type hints and docstring references to SendableActivity. |
| packages/apps/src/microsoft_teams/apps/contexts/function_context.py | Updates FunctionContext send/resolve type hints to SendableActivity. |
| packages/apps/src/microsoft_teams/apps/app.py | Updates proactive App.send() signature to SendableActivity. |
| packages/apps/src/microsoft_teams/apps/app_process.py | Updates middleware-wrapped send() callable typing to SendableActivity. |
| packages/apps/src/microsoft_teams/apps/activity_sender.py | Updates ActivitySender typing to accept SendableActivity. |
| packages/api/tests/unit/test_sent_activity.py | Updates unit test imports/typing to SendableActivity. |
| packages/api/src/microsoft_teams/api/clients/conversation/params.py | Updates CreateConversationParams.activity typing to SendableActivity. |
| packages/api/src/microsoft_teams/api/clients/conversation/client.py | Updates conversation activity operation method parameter types to SendableActivity. |
| packages/api/src/microsoft_teams/api/clients/conversation/activity.py | Updates ConversationActivityClient create/update/reply/targeted method parameter types to SendableActivity. |
| packages/api/src/microsoft_teams/api/activities/sent_activity.py | Updates SentActivity to reference SendableActivity. |
| packages/api/src/microsoft_teams/api/activities/sendable_activity.py | Defines the renamed outbound union alias SendableActivity. |
| packages/api/src/microsoft_teams/api/activities/init.py | Updates public exports to export SendableActivity instead of ActivityParams. |
| @pytest.fixture | ||
| def mock_new_activity_params() -> ActivityParams: | ||
| """Create a mock ActivityParams for testing.""" | ||
| def mock_new_activity_params() -> SendableActivity: | ||
| """Create a mock SendableActivity for testing.""" |
There was a problem hiding this comment.
The fixture name mock_new_activity_params still references the old ActivityParams type but now returns SendableActivity, which is confusing when reading failures/debugging. Rename the fixture (and its usages) to reflect SendableActivity (e.g., mock_new_sendable_activity).
|
|
||
| from ..models import CustomBaseModel | ||
| from . import ActivityParams | ||
| from . import SendableActivity |
There was a problem hiding this comment.
sent_activity.py imports SendableActivity via from . import SendableActivity, which relies on package __init__.py import ordering and makes the module harder to reuse independently. Prefer importing SendableActivity directly from .sendable_activity to remove the implicit dependency.
| from . import SendableActivity | |
| from .sendable_activity import SendableActivity |
|
Hmm this one might warrant a larger discussion - its also called |
|
Abandoning this PR upon discussion with Aamir - don't think this union is in great need of name change. Better name would be ActivityInput but thats the base type for this, ActivityParams is the union of all inputs. |
Summary
Stacked on #340 → #341. Renames the outbound activity union type from
ActivityParamstoSendableActivity.ActivityParams→SendableActivityactivity_params.py→sendable_activity.pyWhy
ActivityParamswas vague — it didn't communicate that this union represents the set of activity types that can be sent outbound.SendableActivitymakes the API self-documenting:Test plan
Automated
Verification
from microsoft_teams.api.activities import SendableActivityworksfrom microsoft_teams.api.activities import ActivityParamsraisesImportErrorsend()/reply()/create()methods acceptSendableActivity🤖 Generated with Claude Code