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

fix: auto acknowledge self events before ignoring #2329

Open
wants to merge 2 commits into
base: autoack
Choose a base branch
from

Conversation

WilliamBergamin
Copy link
Contributor

Summary

Since #2283 event requests are no longer auto acknowledged in the processEvent function. This behavior was handed over to the autoAcknowledge middleware. This created a gap in the ignoreSelf middleware since the events reaching it were assumed to already be acknowledged. This PR aims to add auto acknowledge behavior into the ignoreSelf global middleware.

Requirements (place an x in each [ ])

@WilliamBergamin WilliamBergamin added the bug M-T: confirmed bug report. Issues are confirmed when the reproduction steps are documented label Nov 11, 2024
@WilliamBergamin WilliamBergamin self-assigned this Nov 11, 2024
Copy link

codecov bot commented Nov 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.09%. Comparing base (2f25b21) to head (e44cac8).
Report is 2 commits behind head on autoack.

Additional details and impacted files
@@           Coverage Diff            @@
##           autoack    #2329   +/-   ##
========================================
  Coverage    91.08%   91.09%           
========================================
  Files           22       22           
  Lines         6116     6122    +6     
  Branches       655      655           
========================================
+ Hits          5571     5577    +6     
  Misses         540      540           
  Partials         5        5           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@misscoded
Copy link
Contributor

Does this address the current non-acknowledged events in the Assistant class, or unrelated?

@WilliamBergamin
Copy link
Contributor Author

@misscoded this should be unrelated

Copy link
Contributor

@filmaj filmaj left a comment

Choose a reason for hiding this comment

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

I have a concern about the test utilities, which is likely a symptom of a deeper issue relating to TS union types.

@@ -59,13 +59,14 @@ const ack: AckFn<void> = (_r?) => Promise.resolve();
export function wrapMiddleware<Args extends AnyMiddlewareArgs>(
args: Args,
ctx?: Context,
): Args & AllMiddlewareArgs & { next: SinonSpy } {
): Args & AllMiddlewareArgs & { next: SinonSpy; ack: SinonSpy } {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this is correct. Args here extends AnyMiddlewareArgs which is a union of different kinds of middleware args. Some of these middleware args contain ack and others do not, so in theory Args should be carrying the correct type, including the conditional presence of ack.

You may have to narrow the return type from this method appropriately to get the right kind of Args depending on the situation, which should in theory sometimes carry ack.

I assume the issue was asserting on ack in the test file you changed in this PR?

@WilliamBergamin WilliamBergamin changed the base branch from main to autoack November 13, 2024 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug M-T: confirmed bug report. Issues are confirmed when the reproduction steps are documented
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants