Skip to content

Allow unknown activity entities and missing channelData#438

Open
dcaayushd wants to merge 2 commits into
microsoft:mainfrom
dcaayushd:fix/unknown-entity-fallback
Open

Allow unknown activity entities and missing channelData#438
dcaayushd wants to merge 2 commits into
microsoft:mainfrom
dcaayushd:fix/unknown-entity-fallback

Conversation

@dcaayushd
Copy link
Copy Markdown

@dcaayushd dcaayushd commented May 23, 2026

Fixes #433

What changed

  • Add a fallback UnknownEntity so new entity types do not break activity parsing
  • Make conversationUpdate channelData optional to avoid 500s on missing data
  • Add tests for unknown entities and missing channelData

Why

Real Bot Framework traffic can include new entity types and sometimes skips channelData. These should not block message handling.

Tests

  • PYTHONPATH=packages/api/src:packages/common/src:packages/cards/src /Users/dcaayushd/Development/OpenSourceContribution/teams.py/venv/bin/python -m pytest packages/api/tests/unit/test_activity.py -k ActivityTypeAdapter
  • PYTHONPATH=packages/api/src:packages/common/src:packages/cards/src /Users/dcaayushd/Development/OpenSourceContribution/teams.py/venv/bin/python -m pytest packages/api/tests/unit/test_activity.py

Copilot AI review requested due to automatic review settings May 23, 2026 17:41
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

Note

Copilot was unable to run its full agentic suite in this review.

Adds forward-compatible handling for unknown activity entity types and relaxes conversationUpdate parsing when channelData is absent.

Changes:

  • Introduces UnknownEntity and includes it in the Entity union / exports.
  • Updates ConversationUpdateActivity.channel_data to be optional with a default of None.
  • Adds unit tests validating ActivityTypeAdapter behavior for unknown entities and missing channelData.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/api/tests/unit/test_activity.py Adds unit coverage for unknown entity passthrough and optional channel_data on conversation updates.
packages/api/src/microsoft_teams/api/models/entity/unknown_entity.py Introduces a new model type intended to capture unknown/forward-compatible entities.
packages/api/src/microsoft_teams/api/models/entity/entity.py Adds UnknownEntity into the Entity union for parsing.
packages/api/src/microsoft_teams/api/models/entity/init.py Exposes UnknownEntity as part of the public entity API.
packages/api/src/microsoft_teams/api/activities/conversation/conversation_update.py Makes channel_data optional to support payloads without channelData.

@dcaayushd
Copy link
Copy Markdown
Author

dcaayushd commented May 24, 2026

@heyitsaamir Could you please review this PR and approve the workflow when you have a chance? Thanks!

@mjamroz
Copy link
Copy Markdown
Contributor

mjamroz commented May 25, 2026

@mjamroz Could you please review this PR and approve the workflow when you have a chance? Thanks!

Hey @dcaayushd i believe it's some mistake, im not Microsoft staff neither related with teams.py

@dcaayushd
Copy link
Copy Markdown
Author

Sorry about the wrong tag! I'll find the right maintainer to review this.

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.

[Bug]: Activity validation fails on unknown entity types; strict tagged union rejects entire activity instead of ignoring unknown entities

3 participants