Skip to content

feat: add ctx.delete(activity_id) convenience method#343

Draft
rajan-chari wants to merge 9 commits intomainfrom
fix/338-add-ctx-delete
Draft

feat: add ctx.delete(activity_id) convenience method#343
rajan-chari wants to merge 9 commits intomainfrom
fix/338-add-ctx-delete

Conversation

@rajan-chari
Copy link
Copy Markdown
Contributor

@rajan-chari rajan-chari commented Apr 1, 2026

Summary

Stacked on #340#341#342. Adds a delete() convenience method to ActivityContext and ActivitySender.

Before:

await ctx.api.conversations.activities(ctx.activity.conversation.id).delete(activity_id)

After:

await ctx.delete(activity_id)

Why

With MessageDeleteActivityInput removed from SendableActivity, there's no way to delete via ctx.send() (which was broken anyway). This provides an ergonomic alternative to reaching through the raw API client. Opening as draft since the existing verbose path works fine — this is a convenience, not a fix.

Test plan

  • CI passes
  • Local: 552 tests pass on Python 3.13
  • Manual: call ctx.delete(sent.id) in a handler → activity is removed from conversation

🤖 Generated with Claude Code

rajan-chari and others added 5 commits March 31, 2026 18:34
The ActivityParams union included 10 *ActivityInput types, but the Teams
service (APX) only accepts `message` and `typing` on outbound POST/PUT.
The other types (messageDelete, messageUpdate, conversationUpdate,
handoff, trace, commandSend, commandResult) are inbound-only event
notifications — sending them produces gateway errors.

Narrowing the union to MessageActivityInput, TypingActivityInput, and
MessageReactionActivityInput (kept temporarily — needs its own send
path via the reactions API) so the type system matches what actually
works at runtime.

The *ActivityInput classes themselves are preserved for model symmetry;
only the union membership changes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Rewrite header comment to explain the union's purpose without
internal terminology. Explicitly call out MessageReactionActivityInput
as a temporary inclusion pending its own send path.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Delete 7 *ActivityInput classes that were removed from the
ActivityParams union in the previous commit and have zero references:

- MessageDeleteActivityInput
- MessageUpdateActivityInput
- ConversationUpdateActivityInput
- HandoffActivityInput
- TraceActivityInput
- CommandSendActivityInput
- CommandResultActivityInput

These represented inbound-only event types (server→bot) and had no
valid outbound send path. The corresponding *Activity classes (used
as handler type hints) are preserved.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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>
Adds delete() to ActivityContext and ActivitySender so handlers can
delete activities without reaching through the raw API client:

  await ctx.delete(activity_id)

instead of:

  await ctx.api.conversations.activities(conv_id).delete(activity_id)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@lilyydu lilyydu changed the base branch from fix/338-rename-activity-params to main April 3, 2026 22:44
@lilyydu lilyydu changed the base branch from main to fix/338-remove-unsendable-input-types April 3, 2026 22:47
@lilyydu lilyydu changed the base branch from fix/338-remove-unsendable-input-types to main April 3, 2026 22:48
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.

2 participants