Skip to content

fix(slack): let healthy link previews survive a failed video lookup - #3363

Open
vedanth-jadhav wants to merge 5 commits into
CapSoftware:mainfrom
vedanth-jadhav:fix/web-slack-unfurl-partial-failures
Open

vedanth-jadhav wants to merge 5 commits into
CapSoftware:mainfrom
vedanth-jadhav:fix/web-slack-unfurl-partial-failures

Conversation

@vedanth-jadhav

@vedanth-jadhav vedanth-jadhav commented Oct 26, 2026 •

Copy link
Copy Markdown

Problem and trigger

A Slack link_shared event can contain up to five Cap links. The handler resolves their videos concurrently with Promise.all, which rejects the entire batch if one lookup throws. That drops valid previews from the same message even when other videos were resolved successfully.

Fix

Use Promise.allSettled for the independent per-video lookups and include only fulfilled, non-null results in the Slack unfurl map. Keep the existing five-link cap, deduplication, public visibility checks, stable link ordering, and one final sendSlackUnfurl call. Slack API and installation-token failures are still allowed to propagate; only a failed video lookup is isolated.

Regression tests

  • A two-link event with one rejected lookup still sends exactly one valid preview with the correct original link as its map key.
  • If every lookup rejects, do not send an empty Slack request.
  • Existing tests cover self-hosted links, legacy links, restricted videos, malformed events, and uninstalled workspaces.

Validation

  • Two changed files, branch directly from current upstream main.
  • Local Cap workspace dependencies are unavailable in this connector environment; GitHub CI must run unit tests, typecheck, and Biome. No local test pass or Greptile score claimed.
  • Focused command: bun run --cwd apps/web vitest run __tests__/unit/slack-unfurl.test.ts.
  • This is resilience/correctness, not a benchmarked latency optimization.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no new actionable issues were found.

Summary

This PR keeps healthy Slack previews when another video lookup fails.

  • Slack keeps healthy previews when another link lookup fails.

Review used code inspection. Tests were not run.

Reviews (2) · Last reviewed commit: "style(slack): match Biome formatting for..." · Reviewed by Greptile

@vercel

vercel Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
cap-status Skipped Skipped Oct 26, 2026 10:03am UTC

@vercel
vercel Bot temporarily deployed to Preview – cap-status October 26, 2026 09:53 Inactive

Copy link
Copy Markdown
Author

@greptile review

Please review current head 950625516ecd186cfac23e1e90c967b033adebdb. The change isolates independently failing video lookups in Slack link-unfurl batches, with mixed-success and all-failure regression cases. All five GitHub Actions workflows passed on this SHA.

Comment thread apps/web/lib/slack/unfurl.ts
@vercel
vercel Bot temporarily deployed to Preview – cap-status October 26, 2026 09:59 Inactive
@vercel
vercel Bot temporarily deployed to Preview – cap-status October 26, 2026 10:01 Inactive
@vercel
vercel Bot temporarily deployed to Preview – cap-status October 26, 2026 10:03 Inactive

Copy link
Copy Markdown
Author

@greptile review

Re-review latest commit 764e1e20ef65b5b57413488e2e3b8f97b641faff. The prior P2 finding is addressed: failed video lookups are logged with video ID and error while successful previews are preserved; regression assertions cover the warning paths. CI is rerunning on this SHA after the Biome formatting fix.

This branch was previously deployed

1 inactive deployment
Preview – cap-status — 764e1e20 Deployed Oct 26, 2026 by vercel[bot]
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.

1 participant