Skip to content

fix(providers): derive new-connection default name from live names (closes #15006) - #15018

Merged
diegosouzapw merged 1 commit into
diegosouzapw:release/v3.8.51from
toor11:fix/15006-cookie-default-name
Sep 29, 2026
Merged

diegosouzapw merged 1 commit into
diegosouzapw:release/v3.8.51from
toor11:fix/15006-cookie-default-name

Conversation

@toor11

@toor11 toor11 commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Adding a connection after deleting one no longer defaults to a name that collides with a live connection. With main/main-3 live (main-2 deleted), the modal proposed main-3 and the backend name-upsert silently overwrote it. It now proposes the first free slot (main-2).

Related Issues

Root cause

AddApiKeyModal derived its default name from connections.length (ProviderDetailPageClient.tsx:850 → ProviderModalsPanel → modal), but computeConnectionDefaultName has had a names-array overload since #11067 that the modal never used. After any delete, count no longer matches the highest suffix, so the generated name hits a live row and findExistingCookieConnection (src/lib/db/providers.ts:444, step 1 name-upsert) replaces it.

Change

Validation

  • Change type: UI
  • New vitest suite modals/__tests__/addApiKeyModal-default-name-15006.test.tsx: fail→fix→pass verified (2 failed on the pre-fix file with expected 'main' to be 'main-2', 3/3 pass with the fix)
  • Neighbor suite connModals.test.tsx: 20/20 pass
  • Helper suites compute-connection-default-name-6499/11033: 7/7 pass
  • npm run lint on touched files: clean (2 errors in ProviderDetailPageClient.tsx:8,95 and 1 dashboard-typecheck error in NoAuthAccountCard.tsx are pre-existing on the clean tip, verified via stash, left untouched)
  • Reconciled with origin/release/v3.8.51

Tests Added Or Updated

  • Added: src/app/(dashboard)/dashboard/providers/[id]/components/modals/__tests__/addApiKeyModal-default-name-15006.test.tsx

Coverage Notes

  • Touched dashboard files are covered by the new modal test (name derivation at both mount and on-open paths).

Reviewer Notes

  • Open design point from the issue left for you: whether a same-name/different-credential cookie add should ever be rejected as a conflict instead of upserting. I kept upsert intact because the rotation test depends on it; happy to implement the reject variant if you prefer.

@diegosouzapw
diegosouzapw merged commit 3b2c9fa into diegosouzapw:release/v3.8.51 Sep 29, 2026
11 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants