Skip to content

Commit 53554e6

Browse files
fix(issues): preserve continuation cursors for retry
1 parent 2702072 commit 53554e6

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

‎apps/server/src/issue/IssueService.test.ts‎

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ describe("IssueService", () => {
277277
it.effect("deduplicates and pages repositories despite partial failures", () =>
278278
Effect.gen(function* () {
279279
const listed: string[] = [];
280+
let failContinuation = true;
280281
const service = yield* makeService({
281282
projects: [
282283
project({ id: "web", repository: "acme/web" }),
@@ -305,6 +306,15 @@ describe("IssueService", () => {
305306
});
306307
if (input.scope === "acme/docs")
307308
return { items: [issue("3", "2026-07-04T00:00:00Z")], nextCursor: null };
309+
if (input.cursor === "next" && failContinuation) {
310+
failContinuation = false;
311+
return yield* new IssueTrackerError({
312+
tracker: GITHUB,
313+
operation: "listIssues",
314+
reason: "failed",
315+
detail: "try again",
316+
});
317+
}
308318
if (input.cursor === "next")
309319
return { items: [issue("4", "2026-07-01T00:00:00Z")], nextCursor: null };
310320
return {
@@ -338,11 +348,16 @@ describe("IssueService", () => {
338348

339349
// A continuation only reads the scopes it names.
340350
listed.length = 0;
341-
const next = yield* service.list({
351+
const failed = yield* service.list({
342352
state: "open",
343-
cursors: { "github.com acme/web": "next" },
353+
cursors: result.nextCursors,
344354
});
345355
expect(listed).toEqual(["acme/web"]);
356+
expect(failed.nextCursors).toEqual(result.nextCursors);
357+
expect(failed.errors).toEqual([
358+
{ projectId: "web", projectTitle: "web", message: "try again" },
359+
]);
360+
const next = yield* service.list({ state: "open", cursors: failed.nextCursors });
346361
expect(next.entries.map((entry) => [entry.projectId, entry.key])).toEqual([["web", "4"]]);
347362
expect(next.nextCursors).toEqual({});
348363
expect(next.errors).toEqual([]);

‎apps/server/src/issue/IssueService.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ const make = Effect.gen(function* () {
305305
Effect.result,
306306
);
307307
if (page._tag === "Failure") {
308+
if (cursor !== undefined) nextCursors[key] = cursor;
308309
recordFailure(project, page.failure);
309310
errors.push({
310311
projectId: project.project.id,

0 commit comments

Comments
 (0)