fix(integrations): keep a simulated connection's accounts on reconnect

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

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

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

評価

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

調査の方向性

Start with src/lib/adapters/simulated/index.ts and trace how exchangeCode gets its seed during reconnect, then read the reconnect flow in src/app/api/dev/fake-provider/authorize/route.ts. Update the simulated webhook setup in src/lib/adapters/simulated/webhooks.ts and Polar twin in src/lib/adapters/simulated/polar.ts; run npx vitest run src/lib/adapters/simulated. Finish by covering the refusal path in e2e/webhook-setup-polar.spec.ts with the keyboard and verifying reconnect preserves the included accounts.

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

説明

area: integrations bug impact: low priority: P2 size: S

Context

Found while fixing the Fable review of #525 (Polar webhooks, #429).

A simulated provider's exchangeCode (src/lib/adapters/simulated/index.ts) mints a fresh seed for every grant ("A fresh seed per grant, so two simulated connections never share accounts or events"), and the twin's accounts are named after that seed (Polar's sim-org-<seed>). A reconnect, such as the write access consent of automatic webhook setup, is a new grant. So connect.ts upserts a second account with a new seed and leaves the first one included. Observed in an e2e run on #525: after the consent, the simulated Polar connection held sim-org-402df0db and sim-org-0f23f197, both included. The stale account no longer belongs to the grant, so the twin's sync refuses it ("Simulated has no such account").

The cost is concrete for #525. Polar's automatic setup needs a connection that includes exactly one organization (AutomaticWebhookSetup.accounts: "one"). Polar's twin therefore does not forward that limit (src/lib/adapters/simulated/polar.ts), or every simulated automatic setup would be refused after its own consent. The one-organization refusal is unit tested but cannot run end to end against the twin.

Plan

  1. Keep the seed on a reconnect of a simulated connection, for example by carrying the stored credential's seed through the reconnect state to the simulated consent screen and into the code exchangeCode reads.
  2. With the seed kept, forward accounts in simulatedConnectionSetup (src/lib/adapters/simulated/webhooks.ts), and drop the note in simulated/polar.ts.
  3. Add the one-organization refusal to e2e/webhook-setup-polar.spec.ts: seed a second included organization, choose automatic setup, and assert no consent screen and the refusal banner.

Acceptance criteria

  • Reconnecting a simulated connection leaves its accounts unchanged.
  • Polar's twin carries accounts: "one", and its automatic setup still succeeds after the consent.
  • Unit test for the reconnect seed; Playwright: the refusal path in e2e/webhook-setup-polar.spec.ts, with the keyboard.

Files and areas

  • src/lib/adapters/simulated/index.ts, src/lib/adapters/simulated/webhooks.ts, src/lib/adapters/simulated/polar.ts, src/app/api/dev/fake-provider/authorize/route.ts, e2e/webhook-setup-polar.spec.ts.
  • Non-goals: what a real provider's reconnect does with accounts it no longer lists.

Verification

  • npx vitest run src/lib/adapters/simulated
  • the Polar webhook setup spec through the guarded runner

Branch: <issue-number>-simulated-reconnect-seed
Closes with a Closes #<issue-number> footer on the commit or pull request.

Model: anthropic/claude-opus-5-5 | Reasoning effort: not reported by the harness

主要言語
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 を短くまとめたダイジェスト。