GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(gitlab): preserve rate limits when reading thread refs · pingdotgg/t3code@8a773f0

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages/source-control-gitlab/src/server
    • GitLabPullRequestCli.test.ts
    • GitLabPullRequestCli.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/source-control-gitlab/src/server/GitLabPullRequestCli.test.ts‎

Copy file name to clipboardExpand all lines: packages/source-control-gitlab/src/server/GitLabPullRequestCli.test.ts
+24-1Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,7 @@ layer("GitLabPullRequestCli.layer", (it) => {
930930
);
931931

932932
it.effect(
933-
"keeps discussions current when the merge request's diff refs are missing or unreadable",
933+
"keeps discussions current for unreadable refs but propagates CLI requirements and rate limits",
934934
() =>
935935
Effect.gen(function* () {
936936
const cli = yield* GitLabPullRequestCli.GitLabPullRequestCli;
@@ -971,6 +971,29 @@ layer("GitLabPullRequestCli.layer", (it) => {
971971

972972
expect(threads.map((thread) => [thread.id, thread.isOutdated])).toEqual([["abc", false]]);
973973
}
974+
const context = {
975+
operation: "execute" as const,
976+
command: "glab" as const,
977+
cwd: "/w",
978+
cause: new Error("unavailable"),
979+
};
980+
for (const error of [
981+
new GitLabCli.GitLabCliUnavailableError(context),
982+
new GitLabCli.GitLabCliAuthenticationError(context),
983+
new GitLabCli.GitLabCliRateLimitError(context),
984+
]) {
985+
mockedExecute.mockImplementation(({ args }) =>
986+
args[1]?.includes("/discussions") ? Effect.succeed(output("[]")) : Effect.fail(error),
987+
);
988+
expect(
989+
yield* Effect.result(
990+
cli.listDiscussions({ cwd: "/w", repository: "acme/web", number: 7 }),
991+
),
992+
).toMatchObject({
993+
_tag: "Failure",
994+
failure: error,
995+
});
996+
}
974997
}),
975998
);
976999

Collapse file

‎packages/source-control-gitlab/src/server/GitLabPullRequestCli.ts‎

Copy file name to clipboardExpand all lines: packages/source-control-gitlab/src/server/GitLabPullRequestCli.ts
+10-1Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1731,7 +1731,16 @@ export const make = Effect.gen(function* () {
17311731
discussionsPage({ ...input, page: 1, collected: [], diffRefsByThreadId: new Map() }),
17321732
// Fresh beside the discussions: cached refs from before a push would invert every flag.
17331733
// Unreadable refs leave threads current rather than hiding them.
1734-
getDiffRefs(input).pipe(Effect.orElseSucceed(() => null)),
1734+
getDiffRefs(input).pipe(
1735+
Effect.catchTags(
1736+
{
1737+
GitLabCliUnavailableError: (error) => Effect.fail(error),
1738+
GitLabCliAuthenticationError: (error) => Effect.fail(error),
1739+
GitLabCliRateLimitError: (error) => Effect.fail(error),
1740+
},
1741+
() => Effect.succeed(null),
1742+
),
1743+
),
17351744
],
17361745
{ concurrency: 2 },
17371746
);

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.