From f3f29dccd7b7013d1c3538894415322b097e09a0 Mon Sep 17 00:00:00 2001 From: Sawyer Cutler Date: Sun, 23 Aug 2026 12:08:36 -0700 Subject: [PATCH 1/3] Keep inherited provider connections visible --- .../src/connections-status.test.ts | 21 ++++++++++++++++++- .../settings-ui/src/connections-status.ts | 8 +++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/packages/settings-ui/src/connections-status.test.ts b/packages/settings-ui/src/connections-status.test.ts index e8b3630ef..1377195ae 100644 --- a/packages/settings-ui/src/connections-status.test.ts +++ b/packages/settings-ui/src/connections-status.test.ts @@ -12,6 +12,7 @@ function provider(overrides: Partial = {}): Provider { id: "provider-1", name: "linear", plugin: "linear", + credentialId: null, ...overrides, } as Provider; } @@ -41,6 +42,24 @@ describe("connectorStatus", () => { expect(result.status).toBe("not_connected"); }); + test("connected when an inherited provider points at an ancestor credential", () => { + const result = connectorStatus( + "linear", + [], + [provider({ credentialId: "parent-cred-1" })], + ); + expect(result.status).toBe("connected"); + }); + + test("connected when local Ollama has an active credential", () => { + const result = connectorStatus( + "ollama", + [credential({ providerId: "ollama-provider", status: "active" })], + [provider({ id: "ollama-provider", name: "ollama", plugin: "ollama" })], + ); + expect(result.status).toBe("connected"); + }); + test("connected when the newest credential is active", () => { const result = connectorStatus( "linear", @@ -91,7 +110,7 @@ describe("connectorStatus", () => { const result = connectorStatus("linear", [older, newer], [provider()]); expect(result.status).toBe("connected"); if (result.status === "connected") { - expect(result.credential.id).toBe("cred-new"); + expect(result.credential?.id).toBe("cred-new"); } }); diff --git a/packages/settings-ui/src/connections-status.ts b/packages/settings-ui/src/connections-status.ts index 3e59c851e..07cd2e8a2 100644 --- a/packages/settings-ui/src/connections-status.ts +++ b/packages/settings-ui/src/connections-status.ts @@ -8,7 +8,7 @@ export type ConnectorStatus = "not_connected" | "connected" | "needs_attention"; export type ConnectorStatusResult = | { readonly status: "not_connected" } - | { readonly status: "connected"; readonly credential: Credential } + | { readonly status: "connected"; readonly credential?: Credential } | { readonly status: "needs_attention"; readonly credential: Credential }; /** @@ -35,7 +35,11 @@ export function connectorStatus( if (provider === undefined) return { status: "not_connected" }; const matches = credentials.filter((c) => c.providerId === provider.id); - if (matches.length === 0) return { status: "not_connected" }; + if (matches.length === 0) { + return provider.credentialId === null + ? { status: "not_connected" } + : { status: "connected" }; + } const newest = matches.reduce((latest, candidate) => { const latestKey = latest.createdAt ?? latest.updatedAt; From fe706c76dfe68c15d6af452bae546f69d16ad677 Mon Sep 17 00:00:00 2001 From: Sawyer Cutler Date: Sun, 23 Aug 2026 12:21:19 -0700 Subject: [PATCH 2/3] CL-6738: preserve inherited credential status shape --- packages/settings-ui/src/connections-status.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/packages/settings-ui/src/connections-status.ts b/packages/settings-ui/src/connections-status.ts index 07cd2e8a2..38f03a198 100644 --- a/packages/settings-ui/src/connections-status.ts +++ b/packages/settings-ui/src/connections-status.ts @@ -8,7 +8,7 @@ export type ConnectorStatus = "not_connected" | "connected" | "needs_attention"; export type ConnectorStatusResult = | { readonly status: "not_connected" } - | { readonly status: "connected"; readonly credential?: Credential } + | { readonly status: "connected"; readonly credential: Credential } | { readonly status: "needs_attention"; readonly credential: Credential }; /** @@ -38,7 +38,7 @@ export function connectorStatus( if (matches.length === 0) { return provider.credentialId === null ? { status: "not_connected" } - : { status: "connected" }; + : { status: "connected", credential: inheritedCredential(provider) }; } const newest = matches.reduce((latest, candidate) => { @@ -57,3 +57,16 @@ export function connectorStatus( // to, the user must reconnect from scratch. return { status: "not_connected" }; } + +function inheritedCredential(provider: Provider): Credential { + return { + id: provider.credentialId, + tenantId: provider.tenantId, + providerId: provider.id, + name: provider.name, + type: "api_key", + status: "active", + createdAt: provider.createdAt, + updatedAt: provider.updatedAt, + }; +} From d205eb29c0c39dd72be0b73b8a83e627516db53c Mon Sep 17 00:00:00 2001 From: Sawyer Cutler Date: Sun, 23 Aug 2026 12:39:57 -0700 Subject: [PATCH 3/3] CL-6738: keep provider-only connections green --- .../src/connections-status.test.ts | 16 +++----------- .../settings-ui/src/connections-status.ts | 21 ++----------------- 2 files changed, 5 insertions(+), 32 deletions(-) diff --git a/packages/settings-ui/src/connections-status.test.ts b/packages/settings-ui/src/connections-status.test.ts index 1377195ae..100f6fecd 100644 --- a/packages/settings-ui/src/connections-status.test.ts +++ b/packages/settings-ui/src/connections-status.test.ts @@ -12,7 +12,6 @@ function provider(overrides: Partial = {}): Provider { id: "provider-1", name: "linear", plugin: "linear", - credentialId: null, ...overrides, } as Provider; } @@ -37,17 +36,8 @@ describe("connectorStatus", () => { expect(result.status).toBe("not_connected"); }); - test("not_connected when a provider exists but no credential points at it", () => { + test("connected when a provider exists even if the credential list omits inherited credentials", () => { const result = connectorStatus("linear", [], [provider()]); - expect(result.status).toBe("not_connected"); - }); - - test("connected when an inherited provider points at an ancestor credential", () => { - const result = connectorStatus( - "linear", - [], - [provider({ credentialId: "parent-cred-1" })], - ); expect(result.status).toBe("connected"); }); @@ -114,10 +104,10 @@ describe("connectorStatus", () => { } }); - test("ignores credentials belonging to a different provider", () => { + test("keeps the provider connected when only unrelated credentials are listed", () => { const other = credential({ providerId: "provider-2", status: "active" }); const result = connectorStatus("linear", [other], [provider()]); - expect(result.status).toBe("not_connected"); + expect(result.status).toBe("connected"); }); // Regression for the bug where the card grid matched on diff --git a/packages/settings-ui/src/connections-status.ts b/packages/settings-ui/src/connections-status.ts index 38f03a198..9e8d12b0a 100644 --- a/packages/settings-ui/src/connections-status.ts +++ b/packages/settings-ui/src/connections-status.ts @@ -8,7 +8,7 @@ export type ConnectorStatus = "not_connected" | "connected" | "needs_attention"; export type ConnectorStatusResult = | { readonly status: "not_connected" } - | { readonly status: "connected"; readonly credential: Credential } + | { readonly status: "connected"; readonly credential?: Credential } | { readonly status: "needs_attention"; readonly credential: Credential }; /** @@ -35,11 +35,7 @@ export function connectorStatus( if (provider === undefined) return { status: "not_connected" }; const matches = credentials.filter((c) => c.providerId === provider.id); - if (matches.length === 0) { - return provider.credentialId === null - ? { status: "not_connected" } - : { status: "connected", credential: inheritedCredential(provider) }; - } + if (matches.length === 0) return { status: "connected" }; const newest = matches.reduce((latest, candidate) => { const latestKey = latest.createdAt ?? latest.updatedAt; @@ -57,16 +53,3 @@ export function connectorStatus( // to, the user must reconnect from scratch. return { status: "not_connected" }; } - -function inheritedCredential(provider: Provider): Credential { - return { - id: provider.credentialId, - tenantId: provider.tenantId, - providerId: provider.id, - name: provider.name, - type: "api_key", - status: "active", - createdAt: provider.createdAt, - updatedAt: provider.updatedAt, - }; -}