address model gaps#336
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the Microsoft Teams SDK for Python activity/model layer to close schema gaps by removing fields/types that no longer exist (or break deserialization), and updating routing + tests to match the new model shapes.
Changes:
- Removed
EndOfConversationactivity support from models and routing registration. - Removed
relates_tofrom activities and removed multiple message base fields (speak,input_hint,importance,expiration) from message activities. - Updated
Accountby removingroleand introducingtype, plus updated several tests/usages accordingly.
Reviewed changes
Copilot reviewed 36 out of 36 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/apps/tests/test_activity_context.py | Updates tests to stop using removed Account.role and activity.relates_to. |
| packages/apps/src/microsoft_teams/apps/routing/generated_handlers.py | Removes the generated on_end_of_conversation handler API. |
| packages/apps/src/microsoft_teams/apps/routing/activity_route_configs.py | Drops the end_of_conversation route config entry. |
| packages/apps/src/microsoft_teams/apps/routing/activity_context.py | Removes relates_to usage in token exchange state and stops setting removed message fields. |
| packages/api/tests/unit/test_message_activities.py | Updates many tests to stop using removed message/account fields (but still has a leftover role= usage). |
| packages/api/src/microsoft_teams/api/models/attachment/attachment.py | Removes Attachment.id from the attachment model. |
| packages/api/src/microsoft_teams/api/models/activity.py | Removes relates_to and the with_relates_to() builder from the base activity model. |
| packages/api/src/microsoft_teams/api/models/account.py | Replaces Account.role with Account.type. |
| packages/api/src/microsoft_teams/api/models/init.py | Re-exports AccountType instead of AccountRole. |
| packages/api/src/microsoft_teams/api/activities/trace.py | Removes relates_to from trace activity base. |
| packages/api/src/microsoft_teams/api/activities/message/message.py | Removes message-base fields and builder methods (speak, input_hint, importance, expiration). |
| packages/api/src/microsoft_teams/api/activities/invoke/task/task_submit.py | Removes relates_to from task submit invoke activity. |
| packages/api/src/microsoft_teams/api/activities/invoke/task/task_fetch.py | Removes relates_to from task fetch invoke activity. |
| packages/api/src/microsoft_teams/api/activities/invoke/tab/tab_submit.py | Removes relates_to from tab submit invoke activity. |
| packages/api/src/microsoft_teams/api/activities/invoke/tab/tab_fetch.py | Removes relates_to from tab fetch invoke activity. |
| packages/api/src/microsoft_teams/api/activities/invoke/message/submit_action.py | Removes relates_to from message submit-action invoke activity. |
| packages/api/src/microsoft_teams/api/activities/invoke/message_extension/submit_action.py | Removes relates_to from message extension submit-action invoke activity. |
| packages/api/src/microsoft_teams/api/activities/invoke/message_extension/setting.py | Removes relates_to from message extension setting invoke activity. |
| packages/api/src/microsoft_teams/api/activities/invoke/message_extension/select_item.py | Removes relates_to from message extension select-item invoke activity. |
| packages/api/src/microsoft_teams/api/activities/invoke/message_extension/query.py | Removes relates_to from message extension query invoke activity. |
| packages/api/src/microsoft_teams/api/activities/invoke/message_extension/query_setting_url.py | Removes relates_to from message extension query-setting-url invoke activity. |
| packages/api/src/microsoft_teams/api/activities/invoke/message_extension/query_link.py | Removes relates_to from message extension query-link invoke activity. |
| packages/api/src/microsoft_teams/api/activities/invoke/message_extension/fetch_task.py | Removes relates_to from message extension fetch-task invoke activity. |
| packages/api/src/microsoft_teams/api/activities/invoke/message_extension/card_button_clicked.py | Removes relates_to from message extension card-button-clicked invoke activity. |
| packages/api/src/microsoft_teams/api/activities/invoke/message_extension/anon_query_link.py | Removes relates_to from message extension anon-query-link invoke activity. |
| packages/api/src/microsoft_teams/api/activities/invoke/handoff_action.py | Removes relates_to from handoff-action invoke activity. |
| packages/api/src/microsoft_teams/api/activities/invoke/file_consent.py | Removes relates_to from file consent invoke activity. |
| packages/api/src/microsoft_teams/api/activities/invoke/execute_action.py | Removes relates_to from execute-action invoke activity. |
| packages/api/src/microsoft_teams/api/activities/invoke/config/config_submit.py | Removes relates_to from config submit invoke activity. |
| packages/api/src/microsoft_teams/api/activities/invoke/config/config_fetch.py | Removes relates_to from config fetch invoke activity. |
| packages/api/src/microsoft_teams/api/activities/conversation/end_of_conversation.py | Deletes the end-of-conversation activity models. |
| packages/api/src/microsoft_teams/api/activities/conversation/conversation_update.py | Removes history_disclosed from conversation update activity. |
| packages/api/src/microsoft_teams/api/activities/conversation/init.py | Removes the discriminated union and exports ConversationUpdateActivity only. |
| packages/api/src/microsoft_teams/api/activities/command/command_result.py | Changes CommandResultValue.error typing away from Exception. |
| packages/api/src/microsoft_teams/api/activities/activity_params.py | Removes end-of-conversation from the activity params union. |
| packages/api/src/microsoft_teams/api/activities/init.py | Removes end-of-conversation exports. |
Comments suppressed due to low confidence (1)
packages/api/tests/unit/test_message_activities.py:263
Accountno longer defines/accepts therolefield, but this test still constructs anAccountwithrole="user", which will raise a validation/type error and fail the suite. Update the fixture to use the newtypefield (or omit the field entirely, consistent with the other updates in this file).
This is a breaking change, wondering if we should add the If we are not respecting DeliveryMode we should also mark it as deprecated. |
since we're still on public preview I think it's okay to just remove
|
equivalent to these 2 python PRs: microsoft/teams.py#340 (not all applicable bc TS doesnt have defined inbound/outbound interfaces) microsoft/teams.py#336 This pull request adds deprecation warnings to several activity-related interfaces and types to clarify that certain properties and activities are no longer recognized or returned by the service backend. This improves the clarity of the API and helps developers avoid using obsolete features. Verified with APX repo and manual testing. **Deprecation of properties and activities:** * Marked the `relatesTo` property as deprecated in the base `IActivity` interface, the `Activity` class, and in all derived activity interfaces where it appears, indicating it is no longer returned by the backend. * Added `@deprecated` annotations to the `withRelatesTo` method in the `Activity` class for consistency. **Deprecation of activity types not recognized by the backend:** * Marked the `IHandoffActivity` and `ITraceActivity` interfaces as deprecated * Marked the `IEndOfConversationActivity` interface and `EndOfConversationCode` type as deprecated --------- Co-authored-by: lilydu <[email protected]> Co-authored-by: Copilot <[email protected]>

model results from comparing backend codebase to our SDK, mostly removing parameters that were not being set from service. verified by examining files and/or manually testing to double confirm
Changes:
EndOfConversationactivityrelates_toremoved from all applicable activities (TraceActivity, ExecuteActionInvokeActivity, etc)Anyinstead ofExceptionb/c the deserialization would breakhistory_disclosedremovedspeak,input_hint,importance,expirationremovedroleremoved,typeadded (applicable for mention entities)idremoved