Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add trace activity-buffering logic when DeliveryMode is "expectReplies" #2738

Merged
merged 8 commits into from
Oct 23, 2020

Conversation

stevengum
Copy link
Member

Fixes #2732

FYI @alopix, @johnataylor, @EricDahlvang

Description

When DeliveryMode is "expectReplies", outgoing trace activities are not routed through the TurnContext's BotAdapter. This resulted in trace activities being sent to the channel. This PR duplicates the trace activity logic in BotFrameworkAdapter.sendActivities() and places it in TurnContext.sendActivities().

BotFrameworkAdapter.sendActivities():

if (activity.type === 'trace' && activity.channelId !== 'emulator') {
// Just eat activity
responses.push({} as ResourceResponse);

There are a couple of ways to address issue #2732, including via BotFrameworkAdapter.processActivity() or SkillDialog/BeginSkill. This current implementation at 02aff60 is perhaps the most straightforward way of fixing it, but may have unintended consequences for channels with custom clients/3rd-party channels that do support trace activities.

Additionally, having the trace filtering logic in BotFrameworkAdapter.processActivity() means the "restriction" is at the same level (an integration library, botbuilder) as opposed to having the logic in a base concept library (botbuilder-core).

Specific Changes

  • Move away from magic strings in BotFrameworkAdapter.sendActivities()
  • Duplicate trace activity logic in TurnContext.sendActivities()
  • Add unit tests for TurnContext changes & minor test cleanup

Testing

Added unit tests

@coveralls
Copy link

coveralls commented Aug 22, 2020

Pull Request Test Coverage Report for Build 170414

  • 7 of 7 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.07%) to 83.409%

Totals Coverage Status
Change from base Build 170396: 0.07%
Covered Lines: 15599
Relevant Lines: 17788

💛 - Coveralls

@gabog gabog added this to the R11 milestone Sep 2, 2020
@gabog gabog removed the R11 label Sep 2, 2020
@stevengum
Copy link
Member Author

@gabog, right now I strongly believe we should add expectReplies bufferedReplies-parsing logic at the BotFrameworkAdapter level. We should also setup the Adapter to have a hook for filtering out certain activities in bufferedReplies and configure tracing to be an explicit opt-in.

@joshgummersall joshgummersall changed the base branch from master to main September 29, 2020 16:32
@joshgummersall
Copy link
Contributor

@stevengum do we intend to land this change? I see it's linked to an open R11 issue.

@stevengum
Copy link
Member Author

Yes, this will probably land early next week. I'll sync with @gabog and @tracyboehrer to verify resource availability for porting it to .NET and Python

Copy link
Contributor

@joshgummersall joshgummersall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems okay to me, though I don't think I fully understand the potential issues you mentioned in the description.

@stevengum stevengum marked this pull request as ready for review October 23, 2020 17:48
Copy link
Contributor

@joshgummersall joshgummersall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tiny suggestion, otherwise LGTM.

libraries/botbuilder/src/botFrameworkAdapter.ts Outdated Show resolved Hide resolved
@joshgummersall joshgummersall merged commit a8efd5a into main Oct 23, 2020
@joshgummersall joshgummersall deleted the stgum/2732 branch October 23, 2020 19:16
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.

Trace activities not filtered on DeliveryMode.ExpectReplies
5 participants