| ... | ... | @@ -4,6 +4,7 @@ import * as Schema from "effect/Schema"; |
| 4 | 4 | import { |
| 5 | 5 | VcsCreateWorktreeInput, |
| 6 | 6 | GitPreparePullRequestThreadInput, |
| 7 | GitPreparePullRequestThreadResult, |
| 7 | 8 | GitRunStackedActionResult, |
| 8 | 9 | GitRunStackedActionInput, |
| 9 | 10 | GitResolvePullRequestResult, |
| ... | ... | @@ -13,6 +14,9 @@ const decodeCreateWorktreeInput = Schema.decodeUnknownSync(VcsCreateWorktreeInpu |
| 13 | 14 | const decodePreparePullRequestThreadInput = Schema.decodeUnknownSync( |
| 14 | 15 | GitPreparePullRequestThreadInput, |
| 15 | 16 | ); |
| 17 | const decodePreparePullRequestThreadResult = Schema.decodeUnknownSync( |
| 18 | GitPreparePullRequestThreadResult, |
| 19 | ); |
| 16 | 20 | const decodeRunStackedActionInput = Schema.decodeUnknownSync(GitRunStackedActionInput); |
| 17 | 21 | const decodeRunStackedActionResult = Schema.decodeUnknownSync(GitRunStackedActionResult); |
| 18 | 22 | const decodeResolvePullRequestResult = Schema.decodeUnknownSync(GitResolvePullRequestResult); |
| ... | ... | @@ -55,6 +59,43 @@ describe("GitPreparePullRequestThreadInput", () => { |
| 55 | 59 | }); |
| 56 | 60 | }); |
| 57 | 61 | |
| 62 | describe("GitPreparePullRequestThreadResult", () => { |
| 63 | it("defaults legacy responses to the pull request head", () => { |
| 64 | const parsed = decodePreparePullRequestThreadResult({ |
| 65 | pullRequest: { |
| 66 | number: 42, |
| 67 | title: "PR threads", |
| 68 | url: "https://github.com/pingdotgg/codething-mvp/pull/42", |
| 69 | baseBranch: "main", |
| 70 | headBranch: "feature/pr-threads", |
| 71 | state: "open", |
| 72 | }, |
| 73 | branch: "feature/pr-threads", |
| 74 | worktreePath: "/tmp/pr-threads", |
| 75 | }); |
| 76 | |
| 77 | expect(parsed.isOnPullRequestHead).toBe(true); |
| 78 | }); |
| 79 | |
| 80 | it("preserves an explicit stale pull request checkout result", () => { |
| 81 | const parsed = decodePreparePullRequestThreadResult({ |
| 82 | pullRequest: { |
| 83 | number: 42, |
| 84 | title: "PR threads", |
| 85 | url: "https://github.com/pingdotgg/codething-mvp/pull/42", |
| 86 | baseBranch: "main", |
| 87 | headBranch: "feature/pr-threads", |
| 88 | state: "open", |
| 89 | }, |
| 90 | branch: "feature/pr-threads", |
| 91 | worktreePath: "/tmp/pr-threads", |
| 92 | isOnPullRequestHead: false, |
| 93 | }); |
| 94 | |
| 95 | expect(parsed.isOnPullRequestHead).toBe(false); |
| 96 | }); |
| 97 | }); |
| 98 | |
| 58 | 99 | describe("GitResolvePullRequestResult", () => { |
| 59 | 100 | it("decodes resolved pull request metadata", () => { |
| 60 | 101 | const parsed = decodeResolvePullRequestResult({ |