@devries-cameron20 / t3code Mirror · read-only / commits / 8a7035ffb5
Fork 0

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

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

fix(gitlab): load issue details where GitLab has no Note.awardEmoji (#39621)

Julius Marminge committed Nov 20, 2026 at 01:37 UTC 8a7035ffb527528a6f28fd699b38498afb83284b
2 files changed +40 -3
packages/source-control-gitlab/src/server/GitLabIssueTracker.test.ts
+31
@@ -217,6 +217,37 @@ describe("GitLabIssueTracker", () => {
217 }),
218 );
219
220 + it.effect("loads the detail without comment reactions where GitLab has no Note.awardEmoji", () =>
221 + Effect.gen(function* () {
222 + // GitLab before 16.1 has no `Note.awardEmoji`; glab exits 1 on any query naming it.
223 + const api = yield* GitLabIssueTracker.make.pipe(
224 + Effect.provide(
225 + Layer.mock(GitLabCli.GitLabCli)({
226 + execute: (input) =>
227 + input.args[1] === "graphql"
228 + ? Effect.fail(
229 + new GitLabCli.GitLabCliCommandError({
230 + operation: "execute",
231 + command: "glab",
232 + cwd: input.cwd,
233 + cause: new Error("glab: Field 'awardEmoji' doesn't exist on type 'Note'"),
234 + }),
235 + )
236 + : Effect.succeed(TestSourceControlHost.processOutput(answer(input.args[1]!))),
237 + }),
238 + ),
239 + );
240 + const target = { cwd: "/w", host: "gitlab.example.com", scope: "acme/web", key: "42" };
241 + const issue = yield* api.getIssue(target);
242 + expect(issue.comments.map((comment) => [comment.id, comment.reactions])).toEqual([["7", []]]);
243 + expect(issue.reactions).toEqual([
244 + { content: "eyes", count: 1, actors: ["theo"], viewerHasReacted: false },
245 + ]);
246 + const later = yield* api.getComments({ ...target, cursor: "2:after-100" });
247 + expect(later.comments.map((comment) => comment.reactions)).toEqual([[]]);
248 + }),
249 + );
250 +
251 it.effect("keeps system events after the first hundred notes in the issue timeline", () =>
252 Effect.gen(function* () {
253 const firstPage = Array.from({ length: 100 }, (_, index) => ({
packages/source-control-gitlab/src/server/GitLabIssueTracker.ts
+9 -3
@@ -402,7 +402,13 @@ export const make: Effect.Effect<IssueTrackerApi, never, GitLabCli.GitLabCli> =
402 },
403 },
404 decode: decodeAwardEmojiJson,
405 - });
405 + }).pipe(
406 + // GitLab before 16.1 has no `Note.awardEmoji`; comments then load without reactions.
407 + Effect.catchIf(
408 + (error) => error.reason === "failed",
409 + () => Effect.succeed(null),
410 + ),
411 + );
412
413 const linked = (input: {
414 readonly cwd: string;
@@ -567,9 +573,9 @@ export const make: Effect.Effect<IssueTrackerApi, never, GitLabCli.GitLabCli> =
573 reactions: awardReactions(issueAwards, viewerLogin),
574 comments: notes.comments.map((comment) => ({
575 ...comment,
570 - reactions: awardPage.reactionsByNoteId.get(comment.id) ?? [],
576 + reactions: awardPage?.reactionsByNoteId.get(comment.id) ?? [],
577 })),
572 - commentsCursor: commentsCursor(notes.nextCursor, awardPage.nextCursor),
578 + commentsCursor: commentsCursor(notes.nextCursor, awardPage?.nextCursor ?? null),
579 events: [...systemEvents, ...labelEvents].sort((left, right) =>
580 left.createdAt.localeCompare(right.createdAt),
581 ),