Repository navigation
Description
Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area
apps/server
Steps to reproduce
- Start the T3 Code desktop app.
- Add a project with Add project, if the app does not already have one.
- Open Settings, then Source control & issues.
- Under Issue trackers, expand Linear, paste a valid Linear personal API key into Personal API key, and click away so it saves. Linear should show as connected, with your account name.
- In that Linear section, under Projects, choose a Linear team for the project.
- Quit the app completely.
- Block this computer from reaching api.linear.app, for example with a firewall rule or a hosts entry that sends that name nowhere. Leave the app able to reach its own server.
- Start the app again.
- Open Settings, then Source control & issues, and expand Linear.
Expected behavior
A temporary service error that Linear could not be reached, with a way to retry checking the saved credential. The saved key is not shown as rejected, and the project team selectors stay available.
Actual behavior
Linear shows a Credential rejected badge, and the line under its name says Linear could not be reached. The project team selectors are gone. There is no Retry control for the failed status check.
Impact
Major degradation or frequent failure. Users with a valid saved Linear key see a false credential rejection and lose access to team binding controls whenever the settings status check encounters a rate limit or temporary outage.
Version or commit
main at c2eb8f3369. The cause is at apps/server/src/issue/IssueTrackerConnections.ts:92.
Environment
Linux x64, the repository's own tests.
Logs or stack traces
temporary probe failures must reach the settings load-error and Retry stateAutomated repro
Fails in 2 of 2 runs on main: apply the patch with git apply, then run the command.
diff --git a/apps/server/src/issue/IssueTrackerConnections.test.ts b/apps/server/src/issue/IssueTrackerConnections.test.ts
new file mode 100644
index 0000000000..5f77d1e759
--- /dev/null
+++ b/apps/server/src/issue/IssueTrackerConnections.test.ts
@@ -0,0 +1,106 @@
+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", () => {
+ for (const reason of ["rate-limited", "failed"] as const) {
+ it.effect(
+ `reports a ${reason} probe as a retryable list failure instead of a rejected saved credential`,
+ () =>
+ 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 }] },
+ });
+ }),
+ );
+});cd apps/server && pnpm exec vp test run src/issue/IssueTrackerConnections.test.tsWorkaround
No response
Activity
fix(web,mobile): offer Retry when the issue tracker is unreachable