fix(connections): say why a connection needs attention or failed, and tell its owners

オープン
#767 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
next.js, playwright, react, typescript

調査の方向性

Start with src/app/w/[workspace]/connections/[connectionId]/page.tsx and src/lib/jobs/sync-connection.ts to trace the connection status and stored error details. Then read the existing delivery paths in src/lib/notifications/ and their tests to understand recipient and deduplication behavior. Done means the page explains the failure and next step, owners and admins receive one notice per failure episode, and the listed unit and end-to-end checks pass.

索引モデルが issue の本文から書いたものです。

説明

area: alerts area: connections bug impact: medium priority: P2 size: M

Context

Found by the Fable pre-production review on 2026-12-02 (main at cedc1914; every line reference below re-checked on main at cde5aa3b). Source: provider connect readiness report, N7.

After a revoked or expired token, or a provider that keeps failing, the connection page shows only a badge:

  • The page explains only missing scopes (src/app/w/[workspace]/connections/[connectionId]/page.tsx:256-280).
  • last_error_code and last_error_reference are written (src/lib/jobs/sync-connection.ts:409-410, :450-451) but no connection page or component reads them (they are read only for alert channels, src/components/alerts/alert-delivery.tsx:53-56).
  • Every non-credential failure reads "did not answer after several attempts" (sync-connection.ts:357), schema drift included.
  • The reason sits in one stackdash.sync_failed timeline event (sync-connection.ts:362-374); no notification code references that event, so nobody is emailed.
  • "Sync now" shows unless the connection is revoked (page.tsx:443-445), while a sync skips needs_attention connections (sync-connection.ts:103-107).

Impact: an owner whose connection broke learns about it only by opening the page or the timeline; meanwhile alerts go quiet on stale data. #60 (closed) built the status and the event; this is the explanation and the notice.

Plan

  1. On the connection page, for needs_attention and failed, show the cause in plain words from last_error_code, the reference id, and the next step (reconnect, wait for the hourly retry, or contact support).
  2. Hide "Sync now" while a reconnect is pending, or explain why it will not run.
  3. Send one message per failure episode (the event's dedupe key already marks the episode) to the workspace's owners and admins, through the existing alert email and channel delivery, with an unsubscribe that matches the other alert mail.
  4. Copy follows the house voice: what happened, what it affected, what to do; no provider error codes.

Acceptance criteria

  • The connection page states cause, reference id, and next step for needs_attention and failed.
  • "Sync now" is hidden or explained while a reconnect is pending.
  • One message per failure episode reaches owners and admins; a second failure in the same episode sends nothing.
  • Unit tests for the cause mapping and the one-per-episode rule.
  • Playwright e2e on the connection page with an axe scan and a keyboard pass.

Files and areas

src/app/w/[workspace]/connections/[connectionId]/page.tsx, a small cause mapping module under src/lib/connections/, src/lib/notifications/, their tests.

Non-goals: per-account errors (#{n5}), the sync deadline (#{n4}), new alert channel kinds.

Verification

npm run typecheck, npm run lint, npx vitest run src/lib/connections src/lib/notifications, the connections e2e spec.


Branch: <issue-number>-connection-failure-reason

Model: anthropic/claude-opus-5-5 | Reasoning effort: unknown

主要言語
TypeScript
スター
13
フォーク
2
平均マージ
5時間 20分
マージ済み PR(30日)
287

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

eddiejaoude/StackDash のほかの issue

eddiejaoude/StackDash の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。