- 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 | .pipe( | 78 | .pipe( |
| 79 | Effect.flatMap((result) => | 79 | Effect.flatMap((result) => { |
| 80 | Effect.sync(() => decodeGitHubPullRequestListJson(result.stdout.trim())).pipe( | 80 | const raw = result.stdout.trim(); |
| 81 | if (raw.length === 0) { | ||
| 82 | return Effect.succeed([]); | ||
| 83 | } | ||
| 84 | return Effect.sync(() => decodeGitHubPullRequestListJson(raw)).pipe( | ||
| 81 | Effect.flatMap((decoded) => | 85 | Effect.flatMap((decoded) => |
| 82 | Result.isSuccess(decoded) | 86 | Result.isSuccess(decoded) |
| 83 | ? Effect.succeed( | 87 | ? Effect.succeed( |
| @@ -95,8 +99,8 @@ export const make = Effect.fn("makeGitHubSourceControlProvider")(function* () { · 11 unmodified lines | |||
| 95 | }), | 99 | }), |
| 96 | ), | 100 | ), |
| 97 | ), | 101 | ), |
| 98 | ), | 102 | ); |
| 99 | ), | 103 | }), |
| 100 | Effect.mapError((error) => | 104 | Effect.mapError((error) => |
| 101 | Schema.is(SourceControlProviderError)(error) | 105 | Schema.is(SourceControlProviderError)(error) |
| 102 | ? error | 106 | ? error |