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

A push to main alone rebuilds combined/N for every open kept-fork pull into it #10003

Parked opened this
Closed without merging

A push to the default branch now rebuilds combined/N for every open pull from a kept fork into it. The four combined test files and bun x tsc --noEmit pass. I did not run scripts/gate.ts, scripts/fast.ts or the full suite.

Notes

stopped parked by the crew deploy 05bcc0d

opened this

A push to the default branch now rebuilds combined/N for every open pull from a kept fork into it. The four combined test files and bun x tsc --noEmit pass. I did not run scripts/gate.ts, scripts/fast.ts or the full suite.

  • New src/core/recombine.ts: recombine(app, repo) runs one pass at a time per repository. A pass combines each open, non-sealed, kept-fork pull into the default branch using the base tip as it stands then and the pull's snapshot head. Requests that arrive during a pass set a flag, so they coalesce into one more pass. It also exports recombinePasses(repoId), which the test reads to count passes.
  • src/http/server.ts: the post-receive handler starts recombine after the hook has answered. It does so only for an update to refs/heads/<default> that is not a delete, so nothing runs on the request path.
  • New test/combined-recombine.test.ts: one case pushes to main alone and asserts combined/N has the new main as a parent. The other pushes twice in quick succession and asserts 1 or 2 passes ran. Both fail without the handler change.

Changed an existing test. test/combined-fork.test.ts used to push to main alone and assert the card then says "Stale: main has moved". That is the behaviour this issue removes, so I changed the test, not the code. It now waits for the recombine and asserts the card is not stale. The stale state can still show briefly during a pass.

Left out, as the issue says: the card's failure sentence and the docs.

To try it, push to main of a repo that has an open pull from a kept fork. combined/N gains the new main as a parent within moments.

Closes #9994

3 earlier comments
commented

A push to the default branch now rebuilds combined/N for every open pull from a kept fork into it. The four combined test files and bun x tsc --noEmit pass. I did not run scripts/gate.ts, scripts/fast.ts or the full suite.

  • New src/core/recombine.ts: recombine(app, repo) runs one pass at a time per repository. A pass combines each open, non-sealed, kept-fork pull into the default branch using the base tip as it stands then and the pull's snapshot head. Requests that arrive during a pass set a flag, so they coalesce into one more pass. It also exports recombinePasses(repoId), which the test reads to count passes.
  • src/http/server.ts: the post-receive handler starts recombine after the hook has answered. It does so only for an update to refs/heads/<default> that is not a delete, so nothing runs on the request path.
  • New test/combined-recombine.test.ts: one case pushes to main alone and asserts combined/N has the new main as a parent. The other pushes twice in quick succession and asserts 1 or 2 passes ran. Both fail without the handler change.

Changed an existing test. test/combined-fork.test.ts used to push to main alone and assert the card then says "Stale: main has moved". That is the behaviour this issue removes, so I changed the test, not the code. It now waits for the recombine and asserts the card is not stale. The stale state can still show briefly during a pass.

Left out, as the issue says: the card's failure sentence and the docs.

To try it, push to main of a repo that has an open pull from a kept fork. combined/N gains the new main as a parent within moments.

commented

A push to the default branch now rebuilds combined/N for every open pull from a kept fork into it. The check failed only on the gate rule that wants a "Try:" line, and I've fixed that. I haven't seen the forge's check run again on the new push.

The first push passed the four combined test files and bun x tsc --noEmit. The new commit is empty: its message adds Try: push a commit to main of a repo with an open pull from a kept fork, then open that pull and see combined/N carry the new main as a parent. bun scripts/gate.ts ran clean here before the push. I did not re-run the tests, since only the commit message changed.

  • Change: the new src/core/recombine.ts runs one pass at a time per repository. Pushes that arrive during a pass coalesce into one more pass. The post-receive handler in src/http/server.ts starts it after the hook has answered, and only for a non-delete push to the default branch.
  • Tests: test/combined-recombine.test.ts has both cases from the issue and fails without the handler change. I also changed test/combined-fork.test.ts: it used to assert that the card says "Stale: main has moved" after a push to main alone, which this change removes. It now waits for the recombine and asserts the card is not stale.
  • Left out, as the issue says: the card's failure sentence and the docs.

To try it, push a commit to main of a repo with an open pull from a kept fork. Within moments combined/N has the new main as a parent.

commented

A push to main alone now recombines every open kept-fork pull into it, so combined/N follows main instead of going stale. This update fixes the two failures the check reported. Those tests and test/combined-fork.test.ts pass here, three runs in a row. tsc is clean and the design lint reports nothing. I did not run the full suite; the forge runs it on this push.

What changed in the recombine

  • src/core/recombine.ts runs one pass at a time per repository. Pushes that arrive during a pass coalesce into one more pass.
  • The push hook in src/http/server.ts starts a pass whenever the default branch moves.
  • In test/combined-fork.test.ts, the old assertion expected the card to read "stale" after main moved alone. That was the behaviour this change removes, so I rewrote the test to expect no stale note. The rewrite was in the earlier commit.

The two failures

  • combined-recombine: the test's parents() threw when combined/N had not been written yet, so it failed on the first poll. It now returns an empty list and keeps waiting.
  • pull-slices ("each slice…"): the pull page's "N commits left to land" counted commits from main to the combined tip. Once main moves, the recombine adds a merge commit to that range, so it showed 3 instead of 2. The page now counts the author's commits (sliceEnds), falling back to the old count when there are none. This is a one-line change at src/web/pages/pull.ts:1057. That test was right, so I left it alone.

Left out

  • No retry or backoff when a recombine pass fails. A failure is logged and the next push to main tries again.
  • Passes are in memory only, so a restart does not catch up on pushes it missed. The next push to main does.

Try it Fork a repo, open a pull from the fork, then push to the base's main. refs/heads/combined/<N> gets main's new tip as a parent, and the pull page no longer says "Stale: main has moved".

commented

Parked by the crew: the check stayed red through 2 automatic tries

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs