Add signin/failure invoke activity support#206
Merged
Conversation
Co-authored-by: heyitsaamir <[email protected]>
Co-authored-by: heyitsaamir <[email protected]>
Copilot
AI
changed the title
[WIP] Fix sign in failures handling in invoke
Add signin/failure invoke activity support
Nov 6, 2025
heyitsaamir
marked this pull request as ready for review
November 7, 2025 23:42
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for handling sign-in failures by introducing a new SignInFailure model and corresponding SignInFailureInvokeActivity, along with comprehensive unit tests. It also includes a minor formatting change to consolidate a multi-line decorator.
- Adds
SignInFailuremodel to represent authentication failure details (error code and message) - Introduces
SignInFailureInvokeActivityfor handlingsignin/failureinvoke events with discriminated union support - Provides comprehensive test coverage including creation, serialization, and deserialization tests
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/mcpplugin/src/microsoft/teams/mcpplugin/server_plugin.py | Reformatted the @Plugin decorator from multi-line to single-line |
| packages/api/src/microsoft/teams/api/models/sign_in/failure.py | Added new SignInFailure model with optional code and message fields |
| packages/api/src/microsoft/teams/api/models/sign_in/init.py | Exported the new SignInFailure model |
| packages/api/src/microsoft/teams/api/activities/invoke/sign_in/failure.py | Added SignInFailureInvokeActivity class for handling signin/failure invokes |
| packages/api/src/microsoft/teams/api/activities/invoke/sign_in/init.py | Added SignInFailureInvokeActivity to the discriminated union and exports |
| packages/api/tests/unit/test_signin_failure_activity.py | Added comprehensive unit tests for the new activity class |
heyitsaamir
reviewed
Nov 16, 2025
Co-authored-by: heyitsaamir <[email protected]>
heyitsaamir
reviewed
Nov 16, 2025
heyitsaamir
reviewed
Nov 16, 2025
Co-authored-by: heyitsaamir <[email protected]>
Co-authored-by: heyitsaamir <[email protected]>
MehakBindra
approved these changes
Nov 17, 2025
12 tasks
lilyydu
added a commit
that referenced
this pull request
Nov 22, 2025
## Release 2.0.0a6 ### Changes - Make images required for Thumbnail (#216) - Revert "Add comment" - Add comment - Move tests to examples (#199) - Bump glob from 11.0.3 to 11.1.0 in /tests/tab/Web (#215) - Remove Agents class (#213) - Add signin/failure invoke activity support (#206) - Update config.yml (#214) - Adds a github template when New issues are created (#212) - feat: add OAuth support for regional bots (#209) - [feat] Add BotBuilder Plugin package, sample and tests (#190) Co-authored-by: lilydu <[email protected]>
heyitsaamir
added a commit
to microsoft/teams.ts
that referenced
this pull request
Dec 1, 2025
Add signin/failure invoke activity support to teams.ts This PR applies the same changes from the Python PR microsoft/teams.py#206 to add support for signin/failure invoke activities. ## Changes Made: - [x] Create SignInFailure model in packages/api/src/models/sign-in/sign-in-failure.ts - [x] Update packages/api/src/models/sign-in/index.ts to export SignInFailure - [x] Create SignInFailureInvokeActivity in packages/api/src/activities/invoke/sign-in/failure.ts - [x] Update packages/api/src/activities/invoke/sign-in/index.ts to include SignInFailureInvokeActivity in the union type - [x] Fix JSDoc formatting for consistency with TypeScript documentation standards - [x] Fix import order to pass linter - [x] Add signin/failure to InvokeResponseBody in packages/api/src/models/invoke-response.ts - [x] Add signin/failure to InvokeAliases in packages/apps/src/routes/invoke/index.ts - [x] Run lint - all checks pass - [x] Run build - all packages build successfully - [x] Run code review - no issues found - [x] Run security checks - no vulnerabilities found ## Summary: Successfully resolved the issue where `signin/failure` invoke activities would cause validation errors. The implementation follows the exact same pattern as the Python PR microsoft/teams.py#206, adapting it to TypeScript conventions. ### Problem When sign-in failures occurred, the system would throw validation errors because the `signin/failure` invoke activity type was not supported. ### Solution Added complete support for the `signin/failure` invoke activity type: 1. **Created SignInFailure model** - Contains `code` and `message` fields to capture failure details 2. **Created ISignInFailureInvokeActivity** - New invoke activity interface for handling `signin/failure` events 3. **Updated SignInInvokeActivity union** - Added the failure activity to the discriminated union type 4. **Updated InvokeResponseBody** - Added response type mapping for signin/failure 5. **Updated InvokeAliases** - Added route alias for signin.failure ### Impact **Before**: Sign-in failures would cause validation errors and prevent proper error handling. **After**: Sign-in failures are gracefully handled: - Activities are properly typed - Error codes and messages are captured - No validation errors occur - Applications can implement custom error handling - Build and lint checks pass ### Breaking Changes None - fully backward compatible. Only adds new functionality. ## Security Summary No security vulnerabilities were introduced by these changes. CodeQL analysis found no alerts. <!-- START COPILOT CODING AGENT SUFFIX --> <details> <summary>Original prompt</summary> > Can you apply a similar change from this Python PR <a href="microsoft/teams.py#206" rel="noreferrer noopener" title="microsoft/teams.py#206" target="_blank">https://github.com/microsoft/teams.py/pull/206</a>? <attachment id="app-preview-card-ps28ff06f720cb423692ed2b1487f72acf"></attachment> > > try with </details> <!-- START COPILOT CODING AGENT TIPS --> --- 💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: heyitsaamir <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add signin/failure Activity Support ✓
Successfully resolved the issue where
signin/failureinvoke activities were causing validation errors.Fixes #205
Problem
When sign-in failures occurred, the system threw a validation error:
Solution
Added complete support for the
signin/failureinvoke activity type in the API package.Changes Made
✓ Created SignInFailure model (
packages/api/src/microsoft/teams/api/models/sign_in/failure.py)codeandmessagefields to capture failure details✓ Created SignInFailureInvokeActivity (
packages/api/src/microsoft/teams/api/activities/invoke/sign_in/failure.py)signin/failureevents✓ Updated SignInInvokeActivity union
✓ Updated exports in init files
__all__list for consistency✓ Created fixture-based testing
test_fixtures.pywith pytest parameterization for scalable fixture testingFIXTURE_ACTIVITY_MAPdictionary to map fixture files to activity typesfixtures/signin_failure_invoke_activity.jsonfixture file✓ Validated with real-world data
Verification
✅ All Tests Pass: 103/103 tests passing
✅ Linting: Ruff checks passed
✅ Formatting: All files properly formatted
✅ Type Checking: Pyright - no new errors
✅ Security: CodeQL analysis - 0 alerts
✅ Real-World Test: Successfully parses the actual signin/failure payload from the issue
✅ Code Review: All feedback addressed
Impact
Before: Sign-in failures caused validation errors and prevented proper error handling.
After: Sign-in failures are gracefully handled:
Breaking Changes
None - fully backward compatible. Only adds new functionality.
Original prompt
This section details on the original issue you should resolve
<issue_title>SignIn failures are not handled gracefully.</issue_title>
<issue_description>When there is a sign in failure, the invoke says this. It looks like we're missing a signin/failure invoke type.