Remove ActivitySender send abstraction#479
Conversation
|
This change is part of the following stack: Change managed by git-spice. |
7d08d1a to
3646bf5
Compare
d1219ac to
123df7d
Compare
c6becbe to
9e101e1
Compare
fe6b8c5 to
1b0b92d
Compare
4a16fc5 to
414e668
Compare
d9fb845 to
28b42b4
Compare
38bbf08 to
8652367
Compare
28b42b4 to
9a47d7b
Compare
8652367 to
522ba00
Compare
9a47d7b to
bd67034
Compare
522ba00 to
b335f67
Compare
bd67034 to
703a53d
Compare
b335f67 to
22c23a6
Compare
703a53d to
dd092e4
Compare
corinagum
left a comment
There was a problem hiding this comment.
Removing ActivitySender is the right call, but it's introducing behavior regression between what people calling through it would experience vs. api.conversation...create() directly
There was a problem hiding this comment.
Pull request overview
This PR removes the ActivitySender abstraction from the apps package and reroutes App.send, ActivityContext.send, and FunctionContext.send through the API client’s conversations.activities(...).create(...) pathway, updating unit tests accordingly. It also keeps streaming support by having ActivityContext construct HttpStream directly from its scoped ApiClient.
Changes:
- Removed
ActivitySenderand updated app/context send flows to call the Conversations Activities API client directly. - Refactored
ActivityContextstreaming initialization to be lazy viaHttpStream(self.api, self.conversation_ref). - Updated tests to mock
conversations.activities(...).create(...)rather thanactivity_sender.send(...); deletedActivitySenderunit tests.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/apps/src/microsoft_teams/apps/routing/activity_context.py | Removes ActivitySender dependency, adds lazy stream, and routes send() through API client create. |
| packages/apps/src/microsoft_teams/apps/contexts/function_context.py | Routes send() through API client create and sets basic outbound activity fields. |
| packages/apps/src/microsoft_teams/apps/app.py | Removes ActivitySender initialization and routes proactive send() through API client create. |
| packages/apps/src/microsoft_teams/apps/app_process.py | Removes ActivitySender injection and builds ActivityContext without it. |
| packages/apps/src/microsoft_teams/apps/activity_sender.py | Deleted ActivitySender implementation. |
| packages/apps/tests/test_activity_context.py | Updates mocks/expectations to observe API client create calls instead of sender calls. |
| packages/apps/tests/test_quoted_reply.py | Updates reply/quote tests to read arguments passed to API client create. |
| packages/apps/tests/test_function_context.py | Updates tests to validate API client create call path and return type. |
| packages/apps/tests/test_app.py | Updates send/reply tests to mock the API create path. |
| packages/apps/tests/test_app_process.py | Updates processor tests to patch ApiClient/HttpStream instead of ActivitySender. |
| packages/apps/tests/test_app_oauth.py | Removes activity_sender argument from context construction. |
| packages/apps/tests/test_optional_graph_dependencies.py | Removes activity_sender argument from context construction. |
| packages/apps/tests/test_activity_sender.py | Deleted tests for removed ActivitySender. |
dd092e4 to
f305e45
Compare
ea94db0 to
45dbacd
Compare
5f7e6d7 to
c9223fe
Compare
45dbacd to
e37e732
Compare
c9223fe to
6088587
Compare
e37e732 to
7b4376b
Compare
6088587 to
54dc844
Compare
|
@corinagum the logic's updated again to move us to a utility that handles the complexities around sending. It's hared between ctx.send and app.send |
54dc844 to
a9ef9ab
Compare
7b4376b to
16b61b4
Compare
a9ef9ab to
cbadaff
Compare
16b61b4 to
14c6a68
Compare
cbadaff to
f7b9a58
Compare
14c6a68 to
5a364f3
Compare
f7b9a58 to
e874de7
Compare
5a364f3 to
9f395c9
Compare
e874de7 to
e4f974b
Compare
9f395c9 to
84bccbd
Compare
e4f974b to
fd063c1
Compare
fd063c1 to
408095b
Compare
Removes the separate
ActivitySenderclass while preserving its send behavior.Why:
ActivitySender had become a second send path. With AgenticIdentity support, the API client owns service URL resolution and request auth, so activity sends should route through the same API client path.
Interesting bits:
send_or_update_activitykeeps the old ActivitySender contract without keeping the class.activity.idis set.create_targeted/update_targeted.activity.from_ = ref.botandactivity.conversation = ref.conversationstamping.HttpStreamdirectly from its scoped API client.Reviewer tips:
Start with
activity_send.py, then checkActivityContext.send,App.send, andFunctionContext.send.Testing: