History

Handle empty GitHub PR listings and fallback branch lookup

- Treat empty `gh pr list` output as no results - Fall back to `main` when provider default-branch detection fails - Add coverage for PR creation fallback behavior

Julius Marminge committed 6 months ago

Commit a73408c1 parent 1e0a7594 files · +72 −7Browse files

Showing the changes to apps/server/src/sourceControl/GitHubSourceControlProvider.test.ts (1 of 4 files). Show all

Unified · Split

apps/server/src/sourceControl/GitHubSourceControlProvider.test.ts+17−0
@@ -106,6 +106,23 @@ it.effect("uses gh json listing for non-open change request state queries", () = · 105 unmodified lines
106106 }),
107107 );
108108
109+it.effect("treats empty non-open change request listing output as no results", () =>
110+ Effect.gen(function* () {
111+ const provider = yield* makeProvider({
112+ execute: () => Effect.succeed(processResult("")),
113+ });
114+
115+ const changeRequests = yield* provider.listChangeRequests({
116+ cwd: "/repo",
117+ headSelector: "feature/empty",
118+ state: "all",
119+ limit: 10,
120+ });
121+
122+ assert.deepStrictEqual(changeRequests, []);
123+ }),
124+);
125+
109126 it.effect("creates GitHub PRs through provider-neutral input names", () =>
110127 Effect.gen(function* () {
111128 let createInput: Parameters<GitHubCliShape["createPullRequest"]>[0] | null = null;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t