@devries-cameron20 / t3code-1 / commits / b78914e4f3
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(client-runtime): Linear filters keep their choices when a search has no matches (#37971)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

Wout Stiens committed Nov 17, 2026 at 09:56 UTC b78914e4f3d4813990014316c3f8d1f902a75d6d
5 files changed +46 -14
apps/server/src/issue/IssueService.test.ts
+6
@@ -467,6 +467,12 @@ describe("IssueService with a standalone tracker", () => {
467 ["github", "github.com"],
468 ["linear", "linear.app"],
469 ]);
470 + expect(result.scopes).toContainEqual({
471 + projectId: "web",
472 + tracker: "linear",
473 + host: "linear.app",
474 + scope: "ENG",
475 + });
476 // A reference picks the project's tracker by kind; both are the project's own, so writable.
477 const linearRef = {
478 projectId: "web" as ProjectId,
apps/server/src/issue/IssueService.ts
+6
@@ -424,6 +424,12 @@ const make = Effect.gen(function* () {
424 entries,
425 errors,
426 nextCursors,
427 + scopes: [...scopes.values()].map((project) => ({
428 + projectId: project.project.id,
429 + tracker: project.tracker,
430 + host: project.host,
431 + scope: project.scope,
432 + })),
433 };
434 });
435
packages/client-runtime/src/issueList.test.ts
+13
@@ -130,6 +130,19 @@ describe("issueFilterScopes", () => {
130 ]);
131 });
132
133 + it("offers a bound tracker's scope the answer names when a search matches nothing", () => {
134 + const scope = {
135 + projectId: api,
136 + tracker: "linear" as IssueTrackerKind,
137 + host: "linear.app",
138 + scope: "ENG",
139 + };
140 + const held = new Map([
141 + [environmentId, hold(answer({ trackers: [tracker({})], entries: [], scopes: [scope] }))],
142 + ]);
143 + expect(issueFilterScopes(held, [])).toEqual([{ environmentId, input: scope }]);
144 + });
145 +
146 it("skips a tracker that cannot be read", () => {
147 const held = new Map([
148 [
packages/client-runtime/src/issueList.ts
+16 -14
@@ -189,30 +189,32 @@ export function issueFilterScopes(
189 input: { projectId: project.id, tracker: tracker.tracker, host, scope },
190 });
191 }
192 - // A tracker bound in settings (a Linear team) is no repository's; its rows name its scope.
193 - for (const entry of page.entries) {
192 + // A tracker bound in settings (a Linear team) is no repository's; the answer names its scope,
193 + // matched or not. Older servers do not, so their rows stand in.
194 + const covered: ReadonlyArray<IssueScopeRef> =
195 + page.answer.scopes ??
196 + page.entries.map(({ projectId, tracker, host, scope }) => ({
197 + projectId,
198 + tracker,
199 + host,
200 + scope,
201 + }));
202 + for (const input of covered) {
203 + const host = input.host?.toLowerCase();
204 const tracker = page.answer.trackers.find(
195 - (t) => t.tracker === entry.tracker && t.host.toLowerCase() === entry.host.toLowerCase(),
205 + (t) => t.tracker === input.tracker && t.host.toLowerCase() === host,
206 );
207 if (!tracker?.configured) continue;
208 if (!tracker.capabilities?.labels && !tracker.capabilities?.assignees) continue;
209 if (
210 scopes.some(
211 (s) =>
202 - s.input.scope.toLowerCase() === entry.scope.toLowerCase() &&
203 - s.input.host?.toLowerCase() === entry.host.toLowerCase(),
212 + s.input.scope.toLowerCase() === input.scope.toLowerCase() &&
213 + s.input.host?.toLowerCase() === host,
214 )
215 )
216 continue;
207 - scopes.push({
208 - environmentId,
209 - input: {
210 - projectId: entry.projectId,
211 - tracker: entry.tracker,
212 - host: entry.host,
213 - scope: entry.scope,
214 - },
215 - });
217 + scopes.push({ environmentId, input });
218 }
219 }
220 return scopes;
packages/contracts/src/issue.ts
+5
@@ -308,6 +308,11 @@ export const IssueListResult = Schema.Struct({
308 errors: Schema.Array(IssueListProjectError),
309 /** Where each scope carries on, sent straight back as `cursors`. Absent once a scope is done. */
310 nextCursors: IssueListCursors,
311 + /**
312 + * Every scope the listing covers, matched or not, with one project that reads it. A Linear team
313 + * bound in settings is named nowhere else. Absent from servers that predate it.
314 + */
315 + scopes: Schema.optional(Schema.Array(IssueScopeRef)),
316 });
317 export type IssueListResult = typeof IssueListResult.Type;
318