Repository navigation
fix(slack): dispatch app_uninstalled to onUninstalled - #1073
Merged
Merged
Conversation
Signed-off-by: Muhammadjon Marufov <marufov254@gmail.com>
Contributor
|
@mmarufov is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
There was a problem hiding this comment.
Thanks for this, the implementation looks correct and the new suite is solid: the 15 tests pass locally along with the full @chat-adapter/slack suite, and coverage shows every new line in extractInstallationFromEvent, the app_uninstalled early return in resolveEventRequestContext, and the dispatch path is exercised.
Requesting changes to close a few test gaps, noted inline:
tokens_revokedordering is only tested in single-workspace mode (botTokenset), so the multi-workspace path never runs for it. The interesting case is multi-workspace with the handler deleting the installation, thentokens_revokedarriving: it should hit the"unresolved"branch, return 200, and not callonUninstalledagain.- Two defensive branches in
handleAppUninstalledare uncovered: the!this.chatguard and theevent_id ?? ""fallback. - The Socket Mode test calls
routeSocketEventdirectly with noretry_num, so redelivery dedup over Socket Mode isn't covered for this event. - The org-wide fixture is synthetic (as the PR notes). If a real org-wide
app_uninstalledenvelope can be captured, adding it tosample-messages.mdand the test would confirmauthorizations[0]carriesenterprise_idwithis_enterprise_install: trueand a nullteam_id. If not, a short comment on the fixture saying it is unverified would help future readers.
Signed-off-by: Muhammadjon Marufov <marufov254@gmail.com>
Signed-off-by: Muhammadjon Marufov <marufov254@gmail.com>
…on uninstalls tokens_revoked events now skip the installation lookup, like app_uninstalled, so multi-workspace apps no longer log missing-installation warnings when one arrives after the installation is deleted. Slack uninstall events set tenantId to the Enterprise Grid enterprise_id when the payload carries one. Add app_uninstalled to the Slack manifests in the docs and README, check the adapter name in the onUninstalled examples, note that deleteInstallation doesn't remove records from an installationProvider store, and update the Teams page now that Slack emits onUninstalled. Tests cover authorizations taking precedence over top-level fields, the top-level fallback, handler work registered with waitUntil, and app_uninstalled_team not dispatching. A new integration test checks that the Teams docs example ignores a Slack uninstall. Signed-off-by: Ben Sabic <bensabic@users.noreply.github.com>
bensabic
approved these changes
Oct 27, 2026
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.
Summary
Slack uninstall events currently never reach
onUninstalled. In multi-workspace apps, a missing installation can also cause the event to be dropped before routing.app_uninstalledthrough the existing lifecycle handler for HTTP and Socket Mode, without resolving a bot token.event.conversationId, so handlers can clean up workspace or org-wide installations.event.tenantIdis the Enterprise Gridenterprise_idwhen the payload carries one.tokens_revokedtoo. It still doesn't callonUninstalled, but multi-workspace apps no longer log missing-installation warnings when it arrives after the installation is deleted.app_uninstalledto the Slack manifests, check the adapter name in everyonUninstalledexample, and add a minor changeset.tokens_revokeddoesn't callonUninstalledbecause Slack can revoke tokens while leaving the app installed (auth.revoke). Mapping it would report removals that didn't happen and duplicate callbacks during a full uninstall.app_uninstalled_teamisn't mapped either: it tells org-wide admin apps that some other app was removed (reference).Existing
onUninstalledhandlers only see Slack events once the Slack app subscribes toapp_uninstalled. Apps already subscribed start receiving it when they upgrade, which the changeset calls out.Refs #1057.
Test plan
uninstall.test.tscovers single- and multi-workspace revocation ordering, token-only revocation,authorizationstaking precedence over top-level fields, the top-level fallback, Enterprise GridtenantId, handler work registered withwaitUntil, HTTP and Socket Mode retries, and missing initialization and event IDs.installation.test.tschecks that the Teams docs example ignores a Slack uninstall that would otherwise match a Teams record.pnpm validatepasses.Payloads follow Slack's documented examples; no live uninstall was performed. The org-wide fixture is synthetic and unverified against live traffic.
Checklist
git commit -s)pnpm validatepasses