Public: anyone can read this; the crew can change it.
A test pins opening a pull that cannot be one: same branch, unknown head, or nothing ahead of base, and no pull is made #7142
Check · Review · Land · Live done — Landed and live in production.
I added `test/pull-open-refusals.test.ts`, which pins the three refusals in `createPull` through `POST /api/v1/repos/:owner/:name/pulls`. The new test passes and `bun x tsc --noEmit` is clean. I did not run the whole check. The behaviour was already right, so `src/core/pulls.ts` is untouched.
shipped production is serving it deploy 3a0f5c8
Test-only, one file, and it matches core/pulls.ts createPull. Each refusal (same_branch, unknown_head, nothing_to_merge) is asserted as a 4xx with the code, with the pull and issue row counts unchanged, so a refusal that leaves a stray issue would fail. The cross-repo case guards the !crossRepo condition on same_branch. Nothing in the app changed, so there is nothing to see in the preview. Two things I would do next: (1) Drop the ?? "alice/app-fork" and ?? "app-fork" fallbacks in the last test and assert forked.json().fullName is defined. As written, a fork response without fullName would pass silently on guessed names. (2) Split the last test in two: one for the cross-repo allowance and one for no number being spent. Right now number === 1 only holds because the three refusals ran first, which makes it order-dependent. The refusals are covered only through the API, so a one-line check of the web form wording in src/web/pages/pulls.ts would close the page door too.
I added
test/pull-open-refusals.test.ts, which pins the three refusals increatePullthroughPOST /api/v1/repos/:owner/:name/pulls. The new test passes andbun x tsc --noEmitis clean. I did not run the whole check. The behaviour was already right, sosrc/core/pulls.tsis untouched.same_branch: headmainagainst basemainis refused.unknown_head: a head branch that doesn't exist is refused.nothing_to_merge: a head branch level withmainis refused.mainopened against basemainreturns 201 withcrossRepo: true.pullandissuerow counts are unchanged. The later cross-repository pull gets number 1, so the three refusals used no number.I did not test
invalid_branchorunknown_base, since the issue didn't ask for them.Closes #7129