Skip to content

refactor: rename ActivityParams → SendableActivity#342

Closed
rajan-chari wants to merge 1 commit intofix/338-remove-dead-input-classesfrom
fix/338-rename-activity-params
Closed

refactor: rename ActivityParams → SendableActivity#342
rajan-chari wants to merge 1 commit intofix/338-remove-dead-input-classesfrom
fix/338-rename-activity-params

Conversation

@rajan-chari
Copy link
Copy Markdown
Contributor

@rajan-chari rajan-chari commented Mar 31, 2026

Summary

Stacked on #340#341. Renames the outbound activity union type from ActivityParams to SendableActivity.

  • Renames type: ActivityParamsSendableActivity
  • Renames module: activity_params.pysendable_activity.py
  • Updates all 13 files that reference the type
  • Pure rename — no logic changes

Why

ActivityParams was vague — it didn't communicate that this union represents the set of activity types that can be sent outbound. SendableActivity makes the API self-documenting:

async def send(self, activity: SendableActivity) -> SentActivity:

Test plan

Automated

  • CI passes: build, lint (ruff + pyright), and unit tests on Python 3.12/3.13/3.14
  • Local: 552 tests pass on Python 3.13

Verification

  • from microsoft_teams.api.activities import SendableActivity works
  • from microsoft_teams.api.activities import ActivityParams raises ImportError
  • All send() / reply() / create() methods accept SendableActivity

🤖 Generated with Claude Code

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>
@rajan-chari
Copy link
Copy Markdown
Contributor Author

Manual Test Results — Echo Bot (Python)

Tested on branch fix/338-rename-activity-params, commit bf62a5c. Python echo bot deployed to BAMI1 tenant via DevTunnel. This branch includes changes from #340 and #341.

# Test Result Details
1 Send a message → bot replies PASS Sent "Hello from bolt test" → bot replied "You said 'Hello from bolt test'" (MessageActivityInput via ctx.send(str))
2 Bot shows typing indicator before reply PASS TypingActivityInput sent in handler before reply
3 Edit a sent message → @app.on_message_update fires PASS Edited message → bot replied "Message updated: 'Hello from bolt test EDITED'"
4 Delete a message → @app.on_message_delete fires PASS Deleted message → bot replied "A message was deleted."
5 No regression in send/typing PASS Full stack (#340 narrowed union + #341 dead class removal + #342 rename) works end-to-end

All 5 test steps passed across the full PR stack. SendableActivity rename causes no regressions.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ActivityParamsSendableActivity and updated exports/imports accordingly.
  • Renamed the defining module activity_params.pysendable_activity.py and 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.

Comment on lines 11 to +13
@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."""
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot uses AI. Check for mistakes.

from ..models import CustomBaseModel
from . import ActivityParams
from . import SendableActivity
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
from . import SendableActivity
from .sendable_activity import SendableActivity

Copilot uses AI. Check for mistakes.
@lilyydu
Copy link
Copy Markdown
Collaborator

lilyydu commented Apr 1, 2026

Hmm this one might warrant a larger discussion - its also called ActivityParams in TS. Not sure if SendableActivity is a good name because it implies send vs reply/delete. maybe ActivityInput is better, but might be confusing with ActivityInputBase

@lilyydu
Copy link
Copy Markdown
Collaborator

lilyydu commented Apr 2, 2026

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.

@lilyydu lilyydu closed this Apr 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants