fix(slack): unfurl org pages for the connected workspace, and finish unfurls
Merged
SA
2mo ago+49+49+01234567890123456789-53-53-01234567890123456789
Problem
Harshith's link to an org-visible page (pr-7773-…-dojhim) didn't unfurl in #general, and he didn't see a connect-account prompt either.
- He has no Slack identity linked in prod, so the page returned
needs_userand we tried theuser_auth_requiredprompt. route.tsfiredprocessLinkShared(and entity details / app home) without awaiting it or usingafter(). Vercel froze the function after the 200. In prod logs everychat.unfurlfailure (cannot_auth_user,cannot_prompt) is attached to unrelated requests (/api/auth/oauth2/token, Linear webhook) 12–47 min after thelink_sharedevent.
Changes
route.ts:link_shared,entity_details_requestedandapp_home_openedhandlers run insideafter().previewAccess:everyoneandorgpages are readable for the Slack workspace connected to the page's org, like tasks.just_mestill needs the linked creator. Visibilities are matched by name so a future one falls through to the reader check.
Validation
bun testforpackages/trpc/src/router/pageandapps/api/src/app/api/integrations/slack: pass.tsc --noEmitonapps/apiandpackages/trpc, biome: clean.- Not verified in Slack yet: route tests stop before the
after()calls. Plan: re-post Harshith's link in #general after deploy and confirm it unfurls.
Summary by cubic
Fixes Slack unfurls for org-visible pages and ensures Slack event handlers finish after the response is sent.
- Org and public pages now unfurl for the connected Slack workspace, like tasks;
just_mepages still require their creator to have linked Slack. - The
link_shared,entity_details_requested, andapp_home_openedhandlers now run insideafter()so Vercel doesn't freeze them after the 200.