From 0db9449cab99a489e6cac561dd351de5fc235847 Mon Sep 17 00:00:00 2001 From: Wout Stiens <71498452+StiensWout@users.noreply.github.com> Date: Tue, 17 Nov 2026 08:40:19 +0100 Subject: [PATCH 01/10] test(server): temporary tracker probe failures fail the connection list Co-authored-by: Claude Opus 5.5 --- .../src/issue/IssueTrackerConnections.test.ts | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 apps/server/src/issue/IssueTrackerConnections.test.ts diff --git a/apps/server/src/issue/IssueTrackerConnections.test.ts b/apps/server/src/issue/IssueTrackerConnections.test.ts new file mode 100644 index 000000000000..a1b6b8fdf38b --- /dev/null +++ b/apps/server/src/issue/IssueTrackerConnections.test.ts @@ -0,0 +1,104 @@ +import { describe, expect, it } from "@effect/vitest"; +import * as Effect from "effect/Effect"; +import * as Layer from "effect/Layer"; +import * as Option from "effect/Option"; +import { IssueTrackerKind } from "@t3tools/contracts"; +import { IssueTrackerError } from "@t3tools/source-control-core/server/IssueTracker"; + +import * as ServerSecretStore from "../auth/ServerSecretStore.ts"; +import * as IssueTrackerBindings from "../persistence/IssueTrackerBindings.ts"; +import * as IssueTrackerConnections from "./IssueTrackerConnections.ts"; +import * as IssueTrackerRegistry from "./IssueTrackerRegistry.ts"; + +const linear = IssueTrackerKind.make("linear"); + +const listWithProbeFailure = (reason: IssueTrackerError["reason"]) => + Effect.gen(function* () { + const tracker = { + kind: linear, + capabilities: { + create: true, + edit: true, + comment: true, + labels: true, + assignees: true, + reactions: true, + templates: true, + linkedPullRequests: true, + events: true, + search: true, + }, + standalone: { + tracker: linear, + displayName: "Linear", + host: "linear.app", + scopeNoun: "team", + credential: { label: "Personal API key", helpUrl: null }, + }, + getViewer: () => Effect.succeed("wout"), + listIssues: () => Effect.succeed({ items: [], nextCursor: null }), + getIssue: () => Effect.die("unused"), + getComments: () => Effect.succeed({ comments: [], nextCursor: null }), + probeCredential: () => + Effect.fail( + new IssueTrackerError({ + tracker: linear, + operation: "viewer", + reason, + detail: + reason === "rate-limited" + ? "Linear's rate limit was reached." + : "Linear could not be reached.", + }), + ), + }; + return yield* IssueTrackerConnections.IssueTrackerConnections.pipe( + Effect.flatMap((service) => service.list), + Effect.result, + Effect.provide( + IssueTrackerConnections.layer.pipe( + Layer.provide( + Layer.mergeAll( + Layer.succeed( + IssueTrackerRegistry.IssueTrackerRegistry, + IssueTrackerRegistry.fromTrackers([tracker]), + ), + Layer.mock(ServerSecretStore.ServerSecretStore)({ + get: () => Effect.succeed(Option.some(new TextEncoder().encode("saved-valid-key"))), + }), + Layer.mock(IssueTrackerBindings.IssueTrackerBindingsRepository)({ + list: Effect.succeed(new Map()), + }), + ), + ), + ), + ), + ); + }); + +describe("IssueTrackerConnections", () => { + it.effect.each(["rate-limited", "failed"] as const)( + "reports a %s probe as a retryable list failure instead of a rejected saved credential", + (reason) => + Effect.gen(function* () { + const result = yield* listWithProbeFailure(reason); + expect( + result, + "temporary probe failures must reach the settings load-error and Retry state", + ).toMatchObject({ + _tag: "Failure", + failure: { reason: "failed" }, + }); + }), + ); + + it.effect("reports an actual authentication refusal as a rejected saved credential", () => + Effect.gen(function* () { + const result = yield* listWithProbeFailure("unauthenticated"); + expect(result).toMatchObject({ + _tag: "Success", + success: { trackers: [{ connected: true, account: null }] }, + }); + }), + ); +}); From 1cb837debaf88c3e673b10b577734efad0ce745e Mon Sep 17 00:00:00 2001 From: Wout Stiens <71498452+StiensWout@users.noreply.github.com> Date: Tue, 17 Nov 2026 08:40:55 +0100 Subject: [PATCH 02/10] fix(server): Linear rate limits no longer show as a rejected API key Only an authentication refusal from the stored-credential probe is reported as a rejected key. Rate limits and outages now fail the connection listing, so Settings shows its load error and Retry. Co-authored-by: Claude Opus 5.5 --- .../src/issue/IssueTrackerConnections.ts | 46 +++++++++++-------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/apps/server/src/issue/IssueTrackerConnections.ts b/apps/server/src/issue/IssueTrackerConnections.ts index 9e9a0fae3447..bd87994ade64 100644 --- a/apps/server/src/issue/IssueTrackerConnections.ts +++ b/apps/server/src/issue/IssueTrackerConnections.ts @@ -16,7 +16,10 @@ import { type IssueTrackerConnection, type IssueTrackerConnectionList, } from "@t3tools/contracts"; -import type { StandaloneIssueTrackerApi } from "@t3tools/source-control-core/server/IssueTracker"; +import type { + IssueTrackerError, + StandaloneIssueTrackerApi, +} from "@t3tools/source-control-core/server/IssueTracker"; import * as ServerSecretStore from "../auth/ServerSecretStore.ts"; import * as IssueTrackerBindings from "../persistence/IssueTrackerBindings.ts"; @@ -79,7 +82,18 @@ const make = Effect.gen(function* () { scopes: [], }); - /** The tracker's view of a stored credential; a refusal is status, not a failure. */ + const probeFailure = (error: IssueTrackerError) => + new IssueTrackerConnectionError({ + tracker: error.tracker, + reason: error.reason === "unauthenticated" ? "rejected" : "failed", + detail: IssueService.trackerDetail(error), + cause: error, + }); + + /** + * The tracker's view of a stored credential. A refusal is status, not a failure; anything else + * (a rate limit, an outage) fails the listing so Settings offers a retry. + */ const status = (api: StandaloneIssueTrackerApi, token: string) => api.probeCredential(token).pipe( Effect.map((probe): IssueTrackerConnection => ({ @@ -90,13 +104,15 @@ const make = Effect.gen(function* () { scopes: probe.scopes, })), Effect.catch((error) => - Effect.succeed({ - ...api.standalone, - connected: true, - account: null, - detail: IssueService.trackerDetail(error), - scopes: [], - }), + error.reason === "unauthenticated" + ? Effect.succeed({ + ...api.standalone, + connected: true, + account: null, + detail: IssueService.trackerDetail(error), + scopes: [], + }) + : Effect.fail(probeFailure(error)), ), ); @@ -137,17 +153,7 @@ const make = Effect.gen(function* () { )(function* (input) { const api = yield* requireTracker(input.tracker); if (input.token === null) return yield* disconnect(api); - const probe = yield* api.probeCredential(input.token).pipe( - Effect.mapError( - (error) => - new IssueTrackerConnectionError({ - tracker: input.tracker, - reason: error.reason === "unauthenticated" ? "rejected" : "failed", - detail: IssueService.trackerDetail(error), - cause: error, - }), - ), - ); + const probe = yield* api.probeCredential(input.token).pipe(Effect.mapError(probeFailure)); yield* secrets .set(issueTrackerSecretName(api.kind), encoder.encode(input.token)) .pipe(Effect.mapError(secretFailure(api.kind, "The credential could not be stored."))); From dae7b0ba6b8eb646c9e3922d257e32591d7d9c6a Mon Sep 17 00:00:00 2001 From: Wout Stiens <71498452+StiensWout@users.noreply.github.com> Date: Tue, 17 Nov 2026 08:42:34 +0100 Subject: [PATCH 03/10] test(server): stub the stored credential with Effect.succeedSome Co-authored-by: Claude Opus 5.5 --- apps/server/src/issue/IssueTrackerConnections.test.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/apps/server/src/issue/IssueTrackerConnections.test.ts b/apps/server/src/issue/IssueTrackerConnections.test.ts index a1b6b8fdf38b..dab108e471b0 100644 --- a/apps/server/src/issue/IssueTrackerConnections.test.ts +++ b/apps/server/src/issue/IssueTrackerConnections.test.ts @@ -1,7 +1,6 @@ import { describe, expect, it } from "@effect/vitest"; import * as Effect from "effect/Effect"; import * as Layer from "effect/Layer"; -import * as Option from "effect/Option"; import { IssueTrackerKind } from "@t3tools/contracts"; import { IssueTrackerError } from "@t3tools/source-control-core/server/IssueTracker"; @@ -64,7 +63,7 @@ const listWithProbeFailure = (reason: IssueTrackerError["reason"]) => IssueTrackerRegistry.fromTrackers([tracker]), ), Layer.mock(ServerSecretStore.ServerSecretStore)({ - get: () => Effect.succeed(Option.some(new TextEncoder().encode("saved-valid-key"))), + get: () => Effect.succeedSome(new TextEncoder().encode("saved-valid-key")), }), Layer.mock(IssueTrackerBindings.IssueTrackerBindingsRepository)({ list: Effect.succeed(new Map()), From 6b253007fd1843e141a03a03c678362680e3a3b7 Mon Sep 17 00:00:00 2001 From: Wout Stiens <71498452+StiensWout@users.noreply.github.com> Date: Tue, 17 Nov 2026 08:45:53 +0100 Subject: [PATCH 04/10] test(server): keep the repro's stored credential stub as written Co-authored-by: Claude Opus 5.5 --- apps/server/src/issue/IssueTrackerConnections.test.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/server/src/issue/IssueTrackerConnections.test.ts b/apps/server/src/issue/IssueTrackerConnections.test.ts index dab108e471b0..a1b6b8fdf38b 100644 --- a/apps/server/src/issue/IssueTrackerConnections.test.ts +++ b/apps/server/src/issue/IssueTrackerConnections.test.ts @@ -1,6 +1,7 @@ import { describe, expect, it } from "@effect/vitest"; import * as Effect from "effect/Effect"; import * as Layer from "effect/Layer"; +import * as Option from "effect/Option"; import { IssueTrackerKind } from "@t3tools/contracts"; import { IssueTrackerError } from "@t3tools/source-control-core/server/IssueTracker"; @@ -63,7 +64,7 @@ const listWithProbeFailure = (reason: IssueTrackerError["reason"]) => IssueTrackerRegistry.fromTrackers([tracker]), ), Layer.mock(ServerSecretStore.ServerSecretStore)({ - get: () => Effect.succeedSome(new TextEncoder().encode("saved-valid-key")), + get: () => Effect.succeed(Option.some(new TextEncoder().encode("saved-valid-key"))), }), Layer.mock(IssueTrackerBindings.IssueTrackerBindingsRepository)({ list: Effect.succeed(new Map()), From 56b31e7edb7d7aedc50513322992f2641ecd0167 Mon Sep 17 00:00:00 2001 From: Wout Stiens <71498452+StiensWout@users.noreply.github.com> Date: Tue, 17 Nov 2026 08:50:20 +0100 Subject: [PATCH 05/10] test(server): allow the repro's Option.some credential stub past the Effect diagnostic Co-authored-by: Claude Opus 5.5 --- apps/server/src/issue/IssueTrackerConnections.test.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/server/src/issue/IssueTrackerConnections.test.ts b/apps/server/src/issue/IssueTrackerConnections.test.ts index a1b6b8fdf38b..2126531bc59e 100644 --- a/apps/server/src/issue/IssueTrackerConnections.test.ts +++ b/apps/server/src/issue/IssueTrackerConnections.test.ts @@ -64,6 +64,7 @@ const listWithProbeFailure = (reason: IssueTrackerError["reason"]) => IssueTrackerRegistry.fromTrackers([tracker]), ), Layer.mock(ServerSecretStore.ServerSecretStore)({ + // @effect-diagnostics-next-line preferSucceedSomeOrNone:off -- kept as the repro wrote it. get: () => Effect.succeed(Option.some(new TextEncoder().encode("saved-valid-key"))), }), Layer.mock(IssueTrackerBindings.IssueTrackerBindingsRepository)({ From 213a2d53188272d013863842c466c62538462b1f Mon Sep 17 00:00:00 2001 From: Wout Stiens <71498452+StiensWout@users.noreply.github.com> Date: Tue, 17 Nov 2026 08:59:01 +0100 Subject: [PATCH 06/10] docs(server): clarify tracker probe failure tradeoff Co-authored-by: GPT 6.1 Sol --- apps/server/src/issue/IssueTrackerConnections.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/server/src/issue/IssueTrackerConnections.ts b/apps/server/src/issue/IssueTrackerConnections.ts index bd87994ade64..4e258ed029b1 100644 --- a/apps/server/src/issue/IssueTrackerConnections.ts +++ b/apps/server/src/issue/IssueTrackerConnections.ts @@ -91,8 +91,8 @@ const make = Effect.gen(function* () { }); /** - * The tracker's view of a stored credential. A refusal is status, not a failure; anything else - * (a rate limit, an outage) fails the listing so Settings offers a retry. + * The list contract has no unavailable status, so temporary probe failures use its error channel. + * Settings then hides all rows and bindings, including credential replacement and disconnect. */ const status = (api: StandaloneIssueTrackerApi, token: string) => api.probeCredential(token).pipe( From 8eb50bc73d2f190231292725ae4ec5d8a36e9eeb Mon Sep 17 00:00:00 2001 From: Wout Stiens <71498452+StiensWout@users.noreply.github.com> Date: Tue, 17 Nov 2026 09:02:07 +0100 Subject: [PATCH 07/10] chore: credit the models that worked on this change Co-authored-by: Grok 4.7 From 27d466e46c461acd35c2b45a8e26c8e9a5370e16 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Tue, 17 Nov 2026 08:15:43 +0000 Subject: [PATCH 08/10] test(server): stub the stored credential with Effect.succeedSome Co-Authored-By: Claude Opus 5.5 --- apps/server/src/issue/IssueTrackerConnections.test.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/apps/server/src/issue/IssueTrackerConnections.test.ts b/apps/server/src/issue/IssueTrackerConnections.test.ts index 2126531bc59e..b10d9cb17358 100644 --- a/apps/server/src/issue/IssueTrackerConnections.test.ts +++ b/apps/server/src/issue/IssueTrackerConnections.test.ts @@ -1,7 +1,6 @@ import { describe, expect, it } from "@effect/vitest"; import * as Effect from "effect/Effect"; import * as Layer from "effect/Layer"; -import * as Option from "effect/Option"; import { IssueTrackerKind } from "@t3tools/contracts"; import { IssueTrackerError } from "@t3tools/source-control-core/server/IssueTracker"; @@ -64,8 +63,7 @@ const listWithProbeFailure = (reason: IssueTrackerError["reason"]) => IssueTrackerRegistry.fromTrackers([tracker]), ), Layer.mock(ServerSecretStore.ServerSecretStore)({ - // @effect-diagnostics-next-line preferSucceedSomeOrNone:off -- kept as the repro wrote it. - get: () => Effect.succeed(Option.some(new TextEncoder().encode("saved-valid-key"))), + get: () => Effect.succeedSome(new TextEncoder().encode("saved-valid-key")), }), Layer.mock(IssueTrackerBindings.IssueTrackerBindingsRepository)({ list: Effect.succeed(new Map()), @@ -83,10 +81,7 @@ describe("IssueTrackerConnections", () => { (reason) => Effect.gen(function* () { const result = yield* listWithProbeFailure(reason); - expect( - result, - "temporary probe failures must reach the settings load-error and Retry state", - ).toMatchObject({ + expect(result).toMatchObject({ _tag: "Failure", failure: { reason: "failed" }, }); From a774c55f564cbd0514a39e46a018b670e92fb3a2 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Tue, 17 Nov 2026 08:30:34 +0000 Subject: [PATCH 09/10] fix(server): keep credential and team controls when the tracker is unreachable A temporary probe failure (rate limit, outage) no longer fails the whole connection listing. The tracker row stays connected with a new `unavailable` flag, its detail, and the scopes projects are already bound to, so Settings on web and mobile keeps the credential field, Disconnect and the project team pickers without showing the key as rejected. Co-Authored-By: Claude Opus 5.5 --- ...ettingsSourceControlDetailRouteScreens.tsx | 8 +- .../src/issue/IssueTrackerConnections.test.ts | 25 ++++-- .../src/issue/IssueTrackerConnections.ts | 77 +++++++++++-------- .../settings/IssueTrackerSettings.tsx | 10 ++- .../client-runtime/src/state/issueTrackers.ts | 10 +++ packages/contracts/src/issue.ts | 6 ++ 6 files changed, 92 insertions(+), 44 deletions(-) diff --git a/apps/mobile/src/features/settings/SettingsSourceControlDetailRouteScreens.tsx b/apps/mobile/src/features/settings/SettingsSourceControlDetailRouteScreens.tsx index 6b1c799476d7..80efffa5860c 100644 --- a/apps/mobile/src/features/settings/SettingsSourceControlDetailRouteScreens.tsx +++ b/apps/mobile/src/features/settings/SettingsSourceControlDetailRouteScreens.tsx @@ -1,6 +1,9 @@ import { useAtomValue } from "@effect/atom-react"; import type { StaticScreenProps } from "@react-navigation/native"; -import { issueTrackerSummary } from "@t3tools/client-runtime/state/issue-trackers"; +import { + issueTrackerBindable, + issueTrackerSummary, +} from "@t3tools/client-runtime/state/issue-trackers"; import { sourceControlClients } from "@t3tools/client-runtime/source-control-clients"; import { AuthSettingsWriteScope, @@ -159,7 +162,6 @@ export function SettingsIssueTrackerRouteScreen({ const canEdit = useAtomValue(issueTrackerEnvironment.connect.permissionAtom(environmentId)); const tracker = query.data?.trackers.find((entry) => entry.tracker === route.params.tracker); const disabled = !canWrite || !canEdit; - const usable = tracker?.connected === true && tracker.account !== null; return ( {!environment || !tracker ? ( @@ -176,7 +178,7 @@ export function SettingsIssueTrackerRouteScreen({ disabled={disabled} /> - {usable && tracker.scopes.length > 0 ? ( + {issueTrackerBindable(tracker) ? ( Effect.gen(function* () { @@ -66,7 +67,7 @@ const listWithProbeFailure = (reason: IssueTrackerError["reason"]) => get: () => Effect.succeedSome(new TextEncoder().encode("saved-valid-key")), }), Layer.mock(IssueTrackerBindings.IssueTrackerBindingsRepository)({ - list: Effect.succeed(new Map()), + list: Effect.succeed(new Map([[projectId, { tracker: linear, scope: "FAC" }]])), }), ), ), @@ -77,23 +78,33 @@ const listWithProbeFailure = (reason: IssueTrackerError["reason"]) => describe("IssueTrackerConnections", () => { it.effect.each(["rate-limited", "failed"] as const)( - "reports a %s probe as a retryable list failure instead of a rejected saved credential", + "lists a %s probe as unavailable, keeping the credential and bound scopes", (reason) => Effect.gen(function* () { const result = yield* listWithProbeFailure(reason); expect(result).toMatchObject({ - _tag: "Failure", - failure: { reason: "failed" }, + _tag: "Success", + success: { + trackers: [ + { + connected: true, + account: null, + unavailable: true, + scopes: [{ key: "FAC", name: "FAC" }], + }, + ], + bindings: { [projectId]: { tracker: linear, scope: "FAC" } }, + }, }); }), ); - it.effect("reports an actual authentication refusal as a rejected saved credential", () => + it.effect("lists an authentication refusal as a rejected saved credential", () => Effect.gen(function* () { const result = yield* listWithProbeFailure("unauthenticated"); expect(result).toMatchObject({ _tag: "Success", - success: { trackers: [{ connected: true, account: null }] }, + success: { trackers: [{ connected: true, account: null, unavailable: false, scopes: [] }] }, }); }), ); diff --git a/apps/server/src/issue/IssueTrackerConnections.ts b/apps/server/src/issue/IssueTrackerConnections.ts index 4e258ed029b1..a3e787b9f909 100644 --- a/apps/server/src/issue/IssueTrackerConnections.ts +++ b/apps/server/src/issue/IssueTrackerConnections.ts @@ -79,6 +79,7 @@ const make = Effect.gen(function* () { connected: false, account: null, detail: null, + unavailable: false, scopes: [], }); @@ -90,49 +91,62 @@ const make = Effect.gen(function* () { cause: error, }); - /** - * The list contract has no unavailable status, so temporary probe failures use its error channel. - * Settings then hides all rows and bindings, including credential replacement and disconnect. - */ - const status = (api: StandaloneIssueTrackerApi, token: string) => + /** The tracker's view of a stored credential; a refusal or an outage is status, not a failure. */ + const status = ( + api: StandaloneIssueTrackerApi, + token: string, + bound: IssueTrackerConnectionList["bindings"], + ) => api.probeCredential(token).pipe( Effect.map((probe): IssueTrackerConnection => ({ ...api.standalone, connected: true, account: probe.account, detail: null, + unavailable: false, scopes: probe.scopes, })), - Effect.catch((error) => - error.reason === "unauthenticated" - ? Effect.succeed({ - ...api.standalone, - connected: true, - account: null, - detail: IssueService.trackerDetail(error), - scopes: [], - }) - : Effect.fail(probeFailure(error)), - ), + Effect.catch((error) => { + const unavailable = error.reason !== "unauthenticated"; + // Scope names come only from the tracker, so bound projects keep their pickers by key. + const boundKeys = new Set( + Object.values(bound).flatMap((binding) => + binding.tracker === api.kind ? [binding.scope] : [], + ), + ); + return Effect.succeed({ + ...api.standalone, + connected: true, + account: null, + detail: IssueService.trackerDetail(error), + unavailable, + scopes: unavailable ? [...boundKeys].map((key) => ({ key, name: key })) : [], + }); + }), ); - const current = (api: StandaloneIssueTrackerApi) => - secrets.get(issueTrackerSecretName(api.kind)).pipe( - Effect.mapError(secretFailure(api.kind, "The stored credential could not be read.")), - Effect.flatMap((stored) => - Option.isNone(stored) - ? Effect.succeed(disconnected(api)) - : status(api, new TextDecoder().decode(stored.value)), + const current = + (bound: IssueTrackerConnectionList["bindings"]) => (api: StandaloneIssueTrackerApi) => + secrets.get(issueTrackerSecretName(api.kind)).pipe( + Effect.mapError(secretFailure(api.kind, "The stored credential could not be read.")), + Effect.flatMap((stored) => + Option.isNone(stored) + ? Effect.succeed(disconnected(api)) + : status(api, new TextDecoder().decode(stored.value), bound), + ), + ); + + const list: IssueTrackerConnections["Service"]["list"] = Effect.gen(function* () { + const bound = Object.fromEntries( + yield* bindings.list.pipe( + // No single tracker is at fault; the first registered one carries the report. + Effect.mapError(secretFailure(anyTracker, "The project bindings could not be read.")), ), ); - - const list: IssueTrackerConnections["Service"]["list"] = Effect.all({ - trackers: Effect.forEach(registry.standalone, current, { concurrency: 4 }), - bindings: bindings.list.pipe( - Effect.map((bound) => Object.fromEntries(bound)), - // No single tracker is at fault; the first registered one carries the report. - Effect.mapError(secretFailure(anyTracker, "The project bindings could not be read.")), - ), + const trackers = yield* Effect.forEach(registry.standalone, current(bound), { + concurrency: 4, + }); + return { trackers, bindings: bound }; }); const disconnect = Effect.fn("IssueTrackerConnections.disconnect")(function* ( @@ -162,6 +176,7 @@ const make = Effect.gen(function* () { connected: true, account: probe.account, detail: null, + unavailable: false, scopes: probe.scopes, }; }); diff --git a/apps/web/src/components/settings/IssueTrackerSettings.tsx b/apps/web/src/components/settings/IssueTrackerSettings.tsx index d82d9627d160..6209880eeded 100644 --- a/apps/web/src/components/settings/IssueTrackerSettings.tsx +++ b/apps/web/src/components/settings/IssueTrackerSettings.tsx @@ -1,5 +1,9 @@ import { useAtomValue } from "@effect/atom-react"; -import { issueTrackerSummary } from "@t3tools/client-runtime/state/issue-trackers"; +import { + issueTrackerBindable, + issueTrackerRejected, + issueTrackerSummary, +} from "@t3tools/client-runtime/state/issue-trackers"; import { squashAtomCommandFailure } from "@t3tools/client-runtime/state/runtime"; import { ChevronDownIcon, ExternalLinkIcon, XIcon } from "lucide-react"; import { useState, type ElementType } from "react"; @@ -139,7 +143,7 @@ function TrackerRow({ {tracker.displayName} - {tracker.connected && tracker.account === null ? ( + {issueTrackerRejected(tracker) ? ( Credential rejected @@ -215,7 +219,7 @@ function TrackerRow({ } /> - {usable ? ( + {issueTrackerBindable(tracker) ? ( ( * The line under a tracker's name. A connected tracker lists nothing until a project is linked * to one of its scopes, so the line says how many are, and what to do when none is. */ +/** The tracker refused the stored credential, as opposed to not being reachable to ask. */ +export const issueTrackerRejected = (tracker: IssueTrackerConnection): boolean => + tracker.connected && tracker.account === null && !tracker.unavailable; + +/** Projects can be bound: the credential works, or the tracker is only briefly unreachable. */ +export const issueTrackerBindable = (tracker: IssueTrackerConnection): boolean => + tracker.connected && + (tracker.account !== null || tracker.unavailable) && + tracker.scopes.length > 0; + export function issueTrackerSummary( tracker: IssueTrackerConnection, bindings: IssueTrackerConnectionList["bindings"], diff --git a/packages/contracts/src/issue.ts b/packages/contracts/src/issue.ts index b2fc5532dac4..ff16971aca15 100644 --- a/packages/contracts/src/issue.ts +++ b/packages/contracts/src/issue.ts @@ -1,4 +1,5 @@ import * as Schema from "effect/Schema"; +import * as Effect from "effect/Effect"; import * as HttpServerRespondable from "effect/http/HttpServerRespondable"; import * as HttpServerResponse from "effect/http/HttpServerResponse"; @@ -570,6 +571,11 @@ export const IssueTrackerConnection = Schema.Struct({ account: Schema.NullOr(TrimmedNonEmptyString), /** Why a stored credential did not work, when it did not. */ detail: Schema.NullOr(TrimmedNonEmptyString), + /** + * The tracker could not vet the stored credential just now (rate limit, outage), so it is not + * known to be rejected; `scopes` then holds only the scopes projects are bound to. + */ + unavailable: Schema.Boolean.pipe(Schema.withDecodingDefaultKey(Effect.succeed(false))), scopes: Schema.Array(IssueTrackerScope), }); export type IssueTrackerConnection = typeof IssueTrackerConnection.Type; From 499208d69a3c3361dccd0cb997c1ce42cacb5fbc Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Tue, 17 Nov 2026 09:54:02 +0000 Subject: [PATCH 10/10] fix(web,mobile): offer Retry when the issue tracker is unreachable The unavailable tracker row now has a Retry action that re-runs the connection listing, so a saved credential can be rechecked once the rate limit or outage ends, as #38000 expects. Co-Authored-By: Claude Opus 5.5 --- .../SettingsSourceControlDetailRouteScreens.tsx | 7 +++++++ .../src/components/settings/IssueTrackerSettings.tsx | 11 +++++++++++ 2 files changed, 18 insertions(+) diff --git a/apps/mobile/src/features/settings/SettingsSourceControlDetailRouteScreens.tsx b/apps/mobile/src/features/settings/SettingsSourceControlDetailRouteScreens.tsx index 80efffa5860c..42e2fb8c0781 100644 --- a/apps/mobile/src/features/settings/SettingsSourceControlDetailRouteScreens.tsx +++ b/apps/mobile/src/features/settings/SettingsSourceControlDetailRouteScreens.tsx @@ -13,8 +13,10 @@ import { import * as Option from "effect/Option"; import type { ReactNode } from "react"; import { useSafeAreaInsets } from "react-native-safe-area-context"; +import { View } from "react-native"; import { AppText as Text } from "../../components/ui/AppText"; +import { Button } from "../../components/ui/Button"; import { ScreenScrollView as ScrollView } from "../../components/ui/ScreenScrollView"; import { useEnvironments } from "../../state/environments"; import { issueTrackerEnvironment } from "../../state/issueTrackers"; @@ -171,6 +173,11 @@ export function SettingsIssueTrackerRouteScreen({ {issueTrackerSummary(tracker, query.data?.bindings ?? {})} + {tracker.unavailable ? ( + + + ) : null}