fix(integrations): keep a simulated connection's accounts on reconnect
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 57/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- next.js, playwright, react, typescript
Research direction
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.
Written by the indexing model from the issue text.
Description
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
- 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
exchangeCodereads. - With the seed kept, forward
accountsinsimulatedConnectionSetup(src/lib/adapters/simulated/webhooks.ts), and drop the note insimulated/polar.ts. - 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
- Dominant language
- TypeScript
- Stars
- 13
- Forks
- 2
- Avg merge
- 5h 20m
- Merged PRs (30d)
- 287
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from eddiejaoude/StackDash
-
area: integrations documentation priority: P2 size: XS
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
eddiejaoude/StackDash#798 ·
Maintainers usually reply within 1 day
-
area: ops documentation priority: P3 size: XS
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
eddiejaoude/StackDash#796 ·
Maintainers usually reply within 1 day
-
area: docs documentation impact: low priority: P3 size: XS
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
eddiejaoude/StackDash#790 ·
Maintainers usually reply within 1 day
-
area: ops bug impact: low priority: P3 size: XS
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
eddiejaoude/StackDash#785 ·
Maintainers usually reply within 1 day
-
area: connections enhancement impact: low priority: P3 size: XS
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
eddiejaoude/StackDash#768 ·
Maintainers usually reply within 1 day
All issues in eddiejaoude/StackDash
Similar issues
-
bot:ai-assisted component:midnight-js status:untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
midnightntwrk/midnight-js#1790 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
area:vscode bug has repro platform:macos platform:vscode regression
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
anthropics/claude-code#113502 ·
-
Add: Rajdhani TV HDOpencheck:passed streams:add
Difficulty 1/5 Under an hour Newbie friendliness 77/100
Maintainers usually reply within 1 day
-
effort/l priority/p1 risk/high triage/core
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
iflytek/skillhub#1188 · 1 comment ·
Maintainers usually reply within 1 day