- 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
Showing the changes to apps/server/src/sourceControl/GitHubSourceControlProvider.ts (1 of 4 files). Show all
Unified · Split
| @@ -76,8 +76,12 @@ export const make = Effect.fn("makeGitHubSourceControlProvider")(function* () { · 75 unmodified lines | ||
| 76 | 76 | ], |
| 77 | 77 | }) |
| 78 | 78 | .pipe( |
| 79 | − Effect.flatMap((result) => | |
| 80 | − Effect.sync(() => decodeGitHubPullRequestListJson(result.stdout.trim())).pipe( | |
| 79 | + Effect.flatMap((result) => { | |
| 80 | + const raw = result.stdout.trim(); | |
| 81 | + if (raw.length === 0) { | |
| 82 | + return Effect.succeed([]); | |
| 83 | + } | |
| 84 | + return Effect.sync(() => decodeGitHubPullRequestListJson(raw)).pipe( | |
| 81 | 85 | Effect.flatMap((decoded) => |
| 82 | 86 | Result.isSuccess(decoded) |
| 83 | 87 | ? Effect.succeed( |
| @@ -95,8 +99,8 @@ export const make = Effect.fn("makeGitHubSourceControlProvider")(function* () { · 11 unmodified lines | ||
| 95 | 99 | }), |
| 96 | 100 | ), |
| 97 | 101 | ), |
| 98 | − ), | |
| 99 | − ), | |
| 102 | + ); | |
| 103 | + }), | |
| 100 | 104 | Effect.mapError((error) => |
| 101 | 105 | Schema.is(SourceControlProviderError)(error) |
| 102 | 106 | ? error |