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

One call rebuilds combined/N for every open kept-fork pull into the default branch #10039

shipped production is serving it opened this has it
opened this

For: a kept fork's combined preview can be brought up to date with main by one function, before anything calls it on a push. First half of #9994, which went red twice as one change.

Done when:

  • [x] A new src/core/recombine.ts exports recombine(forge, repoId). It lists the open pulls from a kept fork (fromKeptFork in src/core/pulls.ts) into the default branch, and calls combine (src/git/combined.ts) for each one with the base tip read at the start of the pass and the pull's refs/pull/N/head.
  • [x] Only one pass runs per repository at a time. A call made during a pass sets one "again" flag, and when the pass ends exactly one more pass runs, reading the tip at that point. It returns how many passes ran, so a test can count them.
  • [x] One pull that fails to combine (a conflict, a missing ref) is logged and skipped. The other pulls are still rebuilt.
  • [x] A new test/combined-recombine.test.ts uses the fixtures from test/combined-git.test.ts. It moves main and calls recombine directly, then asserts that combined/N has the new main as a parent. It calls recombine three times at once and asserts that at most two passes ran. Nothing is wired to a hook yet.
  • [x] bun test test/combined-fork.test.ts test/combined-check.test.ts test/combined-git.test.ts test/combined-recombine.test.ts and bun x tsc --noEmit pass before the push. If the check goes red, the pull names the failing test.

Files: src/core/recombine.ts (new), test/combined-recombine.test.ts (new). No other file changes.

commented

Reviewed pull #10053 at its head: ticked A new src/core/recombine.ts exports recombine(forge, repoId). It lists the open pulls from a kept fork (fromKeptFork in src/core/pulls.ts) into the default branch, and calls combine (src/git/combined.ts) for each one with the base tip read at the start of the pass and the pull's refs/pull/N/head.; Only one pass runs per repository at a time. A call made during a pass sets one "again" flag, and when the pass ends exactly one more pass runs, reading the tip at that point. It returns how many passes ran, so a test can count them.; One pull that fails to combine (a conflict, a missing ref) is logged and skipped. The other pulls are still rebuilt.; A new test/combined-recombine.test.ts uses the fixtures from test/combined-git.test.ts. It moves main and calls recombine directly, then asserts that combined/N has the new main as a parent. It calls recombine three times at once and asserts that at most two passes ran. Nothing is wired to a hook yet.; bun test test/combined-fork.test.ts test/combined-check.test.ts test/combined-git.test.ts test/combined-recombine.test.ts and bun x tsc --noEmit pass before the push. If the check goes red, the pull names the failing test..

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs