Public: anyone can read this; the crew can change it.
A test proves a failed recombine shows its sentence on the combined card and clears once main is fixed #10093
Check · Review · Land · Live done — Landed and live in production.
mason/forge:mason/10076-a-test-proves-a-failed-recombine-shows-i → main 1 commit fork
1 file
changed +31
−0
test/combined-recombine.test.ts +31
| @@ -209,3 +209,34 @@ test("a failed rebuild is worded on the pull's combined card, and any good rebui | ||
| 209 | 209 | expect(fixed).not.toContain(sentence); |
| 210 | 210 | expect(fixed).not.toContain("stale"); |
| 211 | 211 | }); |
| 212 | ||
| 213 | test("a main git cannot merge puts its sentence on the combined card, and a fixed main clears it", async () => { | |
| 214 | const card = async (): Promise<string> => | |
| 215 | (await (await call(`/alice/app/pulls/${first}`, alice)).text()).replace(/'/g, "'"); | |
| 216 | const sentence = "The rebuild failed: git could not merge main into the pull's head."; | |
| 217 | const good = await git(["rev-parse", "refs/heads/main"], bare); | |
| 218 | const head = await git(["rev-parse", "refs/pull/" + first + "/head"], bare); | |
| 219 | // Start from a combined branch that is current, so the card has nothing to say yet. | |
| 220 | expect(await recombine(forge(), repoId)).toBeGreaterThan(0); | |
| 221 | expect(await card()).not.toContain(sentence); | |
| 222 | // Main becomes a history unrelated to the pull's: merge-tree refuses it. | |
| 223 | const empty = await git(["hash-object", "-t", "tree", "-w", "/dev/null"], bare); | |
| 224 | const stranger = await git(["commit-tree", empty, "-m", "unrelated root"], bare); | |
| 225 | await git(["update-ref", "refs/heads/main", stranger], bare); | |
| 226 | await recombine(forge(), repoId); | |
| 227 | const failed = await card(); | |
| 228 | expect(failed).toContain("Combined with main"); | |
| 229 | expect(failed).toContain("stale"); | |
| 230 | expect(failed).toContain(sentence); | |
| 231 | expect(await readFailure(bare, first)).toContain("git could not merge"); | |
| 232 | // Main is fixed: a commit on the old main, pushed back as the tip. The next pass rebuilds. | |
| 233 | const fixed = await git(["commit-tree", `${good}^{tree}`, "-p", good, "-m", "main fixed"], bare); | |
| 234 | await git(["update-ref", "refs/heads/main", fixed], bare); | |
| 235 | await recombine(forge(), repoId); | |
| 236 | const after = await card(); | |
| 237 | expect(after).not.toContain(sentence); | |
| 238 | expect(after).not.toContain("stale"); | |
| 239 | expect(await readFailure(bare, first)).toBeUndefined(); | |
| 240 | expect((await parents(`refs/heads/combined/${first}`))[1]).toBe(fixed); | |
| 241 | expect(head).toBe(await git(["rev-parse", "refs/pull/" + first + "/head"], bare)); | |
| 242 | }); |