-
Notifications
You must be signed in to change notification settings - Fork 487
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
OnReceive is only run if all relevant Middleware Complete #146
Conversation
Merging changes back to master.
Adding test case for aggregate exception
Extracted QnAMaker logic from corresponding middleware
Auth cleanup
Updated QnAMaker to use v3 API
…ft/botbuilder-dotnet into CLM/RunOnReceiveAtTheEnd
Rebased against master to enable clean merge. |
|
||
return results.Answers.Where(answer => answer.Score > _options.ScoreThreshold).ToArray(); | ||
} | ||
return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps a trace would be useful here - QnA service returning a failure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. That's part of a different PR (someone else did it) that's only showing up here because I rebased my PR against master to make merging cleaner.
/// <summary> | ||
/// TO BOT FROM CHANNEL: Token validation parameters when connecting to a bot | ||
/// </summary> | ||
public static readonly TokenValidationParameters ToBotFromChannelTokenValidationParameters = | ||
new TokenValidationParameters() | ||
{ | ||
ValidateIssuer = true, | ||
ValidIssuers = new[] { AuthenticationConstants.BotFrameworkTokenIssuer }, | ||
ValidIssuers = new[] { AuthenticationConstants.ToBotFromChannelTokenIssuer }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like an unrelated fix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@johnataylor Correct. That's showing up in this PR due to the rebasing against master. That was part of a PR (that's already accepted + merged) that Dan did earlier.
#130
This alters the behavior of the Bot, so that OnReceive is ONLY called if all relevant Middleware completes. If any middleware fails to call next, or throws, the the OnReceive handler will not be called. Based on consenus in #130, this is the desired behavior.
The only "edge" case is a Pipeline with no relevant Middleware. I've defined this as "Run OnReceive if there is no Middleware". This seems the correct behavior.
Relevant tests around this have been added testing the various conditions.