Public: anyone can read this; the crew can change it.

An upstream that merges cleanly opens one pull from upstream/<tip7>, and a branch someone planted there opens nothing #4067

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

A check that finds new upstream commits merging cleanly now pushes upstream/ at the fetched head and opens one pull from it. bun x tsc --noEmit and bun test test/upstreamfollow.test.ts pass (23 tests); I did not run the rest of the suite.

Notes

opened this

A check that finds new upstream commits merging cleanly now pushes upstream/<tip7> at the fetched head and opens one pull from it. bun x tsc --noEmit and bun test test/upstream_follow.test.ts pass (23 tests); I did not run the rest of the suite.

What changed (src/actions/upstream_follow.ts, plus a small retargetPull in src/core/pulls.ts):

  • Clean merge: the check writes refs/heads/upstream/<tip7> and opens the pull as the person who turned following on. It records the pull on the follow row and counts it in opened.
  • Second check, nothing new: it finds the existing pull for that branch, opens nothing, and opened stays at 1. It also opens nothing if a person closed that pull.
  • Upstream moves on while a pull is open: the open pull is moved to the new upstream/<tip7> and its title and body are rewritten, rather than opening a second one. This is how I read "or updates the open one". Say so if you meant something else.
  • Planted branch: if upstream/<tip7> exists and resolveOid doesn't equal the fetched head, the check fails with a new squatted error and notes it on the row. It opens no pull and leaves the branch untouched.
  • Conflict: the row's error is set to "conflict", and no branch or pull is created.
  • Result shape: Checked gains outcome (none, proposed or conflict) and an optional pull number.
  • Existing test changed: the layer-2 test "records the tip … without opening anything" was wrong under the new behaviour. Its fixture is one clean commit behind, so it now opens a pull, and I changed its expectations to match.
  • New tests: I added clean merge plus a second check, moving an open pull, the squat (all three claims), and conflict.

Left out:

  • The converge run for conflicts is the next layer.
  • The branch is written straight into the repository, so no push event or hook fires.

Environment: bun x and bun install first failed with a read-only tempdir error in this sandbox. Setting BUN_TMPDIR=$TMPDIR worked around it. Nothing was wrong in the change.

Closes #3978

commented

A check that finds new upstream commits merging cleanly now pushes upstream/<tip7> at the fetched head and opens one pull from it. bun x tsc --noEmit and bun test test/upstream_follow.test.ts pass (23 tests); I did not run the rest of the suite.

What changed (src/actions/upstream_follow.ts, plus a small retargetPull in src/core/pulls.ts):

  • Clean merge: the check writes refs/heads/upstream/<tip7> and opens the pull as the person who turned following on. It records the pull on the follow row and counts it in opened.
  • Second check, nothing new: it finds the existing pull for that branch, opens nothing, and opened stays at 1. It also opens nothing if a person closed that pull.
  • Upstream moves on while a pull is open: the open pull is moved to the new upstream/<tip7> and its title and body are rewritten, rather than opening a second one. This is how I read "or updates the open one". Say so if you meant something else.
  • Planted branch: if upstream/<tip7> exists and resolveOid doesn't equal the fetched head, the check fails with a new squatted error and notes it on the row. It opens no pull and leaves the branch untouched.
  • Conflict: the row's error is set to "conflict", and no branch or pull is created.
  • Result shape: Checked gains outcome (none, proposed or conflict) and an optional pull number.
  • Existing test changed: the layer-2 test "records the tip … without opening anything" was wrong under the new behaviour. Its fixture is one clean commit behind, so it now opens a pull, and I changed its expectations to match.
  • New tests: I added clean merge plus a second check, moving an open pull, the squat (all three claims), and conflict.

Left out:

  • The converge run for conflicts is the next layer.
  • The branch is written straight into the repository, so no push event or hook fires.

Environment: bun x and bun install first failed with a read-only tempdir error in this sandbox. Setting BUN_TMPDIR=$TMPDIR worked around it. Nothing was wrong in the change.

commented

I've addressed both blockers and the smaller points, and pushed to the same branch. bun test test/upstream_follow.test.ts passes (24 tests) and bun x tsc --noEmit is clean.

  • README: there's a new "Following an upstream" section. It covers nothing new, a clean merge, a newer tip while a pull is open, a conflict and a planted branch (squatted). It says a closed proposal is not reopened. It also says the old upstream/<old7> branch stays when a pull is retargeted. I kept the branch, in case a person built on it.
  • How a check is seen: only the 30-minute clock triggers a check, and the follow row is where its result shows. The README says there is no button or page for it yet, because there isn't one.
  • Move test: the test for moving an open pull now asserts the new headBranch and headOid, that refs/pull/N/head equals the new tip, and that the title and body were rewritten. The dead base lines are gone.
  • Closed-proposal test: a new test closes the pull and checks again. It asserts the same pull number, opened still 1, and only one pull in the repository in any state.
  • Imports: upstream_follow.ts imports are now in order.
Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs