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

Landing never drops a contributor's reviewed lines: a combined build that had… #12119

Merged opened this in answer to

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

Merged

A combined build no longer lands with a side picked: two sides that only add lines at the same place keep both, and any other overlap holds the pull. Pushed. tsc and scripts/gate.ts are clean.

Notes

opened this

A combined build no longer lands with a side picked: two sides that only add lines at the same place keep both, and any other overlap holds the pull. Pushed. tsc and scripts/gate.ts are clean. I ran the 81 merge, combined, conflict and pull test files and the rest of the suite is left to the forge's check. Two failures there were timing assertions in the pull-page tests, which pass alone. I also ran the MCP merge tests.

What changed

  • Pure additions: new src/git/union.ts settles a conflict whose every block has an empty base, writing main's lines first and then the pull's. combine and the plain merge path in src/git/merge.ts both use it.
  • Overlaps: combine makes no combined commit and mergePull answers conflict. The pull page shows one sentence naming the files and saying nothing was dropped. A tip carrying an old Combined-Kept: main trailer is ignored, so nothing with that trailer lands, and no new commit writes the trailer.
  • Crew run: sweepConflicts now picks up a held kept-fork pull and starts a run on it from the repository's builder. It never closes or releases a person's pull. I did not add a "next: builder" path of my own.
  • Merge reply (your message): a repeated merge on a landed pull now answers {merged: true, mergeOid, repeated: true} over the API and merged: true over MCP.
    • I changed one assertion in test/mcp-merge.test.ts: it expected already_merged on the repeat, which contradicts the new rule.
  • Tests: test/union-merge.test.ts appends a test to the same file from two pulls, in either order, and main holds both. combined-fork.test.ts checks the held overlap with its sentence and a crew run started. The repeat-merge assertion is there too.

Not done

  • test/landsim.test.ts isn't on this branch, so I haven't run it. It should pass if its known violation is the held case plus the repeat merge.
  • Non-text conflicts and files both sides added whole are held, not unioned.

Try it: run bun test test/union-merge.test.ts test/combined-fork.test.ts.

🤖 Generated with Claude Code

Closes #12104

Show 8 earlier items

7 earlier comments · 1 event
commented

Pure additions at the same place now keep both sides when a kept fork's pull lands. Any other overlap holds the pull instead of picking a side (#12104). This push takes out the extra scope the review named.

  • SLOW: scripts/gate.ts is back to empty.
    • combined-fork is fast again: the repeat-merge and crew-sweep parts of its tests are gone, and it runs about 2 s.
    • landsim is not fast. Its corpus test takes about 6.5 s on main with SLOW empty, so I left it as it is on main. The only change is dropping .failing from the #12104 reproducer. Splitting it by seed made single seeds take 3–13 s, so I didn't keep that. If you want the corpus itself shrunk, that is a follow-up.
  • Unrelated edits: the repeat-merge reply in api.ts and the MCP merge tool is dropped, along with its mcp-merge.test.ts change. The retry-after.test.ts exemption and the /feed#crew-key-note fixture edit are also reverted.
    • retry-after.test.ts and first-ask-new-app.test.ts fail again locally. They were red on main before this pull and are not caused by it.
  • Crew sweep: my sweepConflicts and bringUpToDate changes in autonomy.ts are reverted. The cost is that a held kept-fork pull is not brought up to date by the crew. It waits for its author to merge main in. That should be its own small pull.
  • Design and both doors: pull-combined.ts is back to main's version. combinedView already makes a "Not combined with main" card from a failure sentence alone, so the hand-rolled <p> was redundant.
    • combinedWords now makes the held sentence the card's single line.
    • The terminal draws the same words through combinedLines, which I exported for the new test/combined-held-words.test.ts.
  • Performance: combinedTip no longer runs git log --grep. The dropped-side check now runs only inside combine(), which every landing and rebuild goes through.
    • A reader can still see an old dropped-side tip until the next rebuild replaces it. The test in combined-git.test.ts now checks that combining does not build on it.

bun scripts/gate.ts, bun x tsc --noEmit and bun scripts/design-lint.ts are clean. The tests covering this change pass (136).

commented

I merged main into this branch and pushed it. src/core/pulls.ts was the only conflict.

main added a fast-forward landing path (landsAsIs / fastForward). This branch holds a pull when the combined fork branch has overlapping edits. I kept both. A held combined branch still returns the conflict error before anything lands. The fast-forward now runs only when no combined branch was built (combined === undefined), so it can't skip the combined tip.

bun x tsc --noEmit and scripts/gate.ts showed no errors in the output I read. The tests I ran passed: test/combined-fork.test.ts and test/pulls*.test.ts, 21 tests across 7 files. I did not run the full suite; the forge's check does that on the push.

the crew's run was interrupted: restart, resumes on the next pass — cancelled
commented

Landing no longer drops a contributor's lines when a kept fork pull and main both add lines at the same place in a file. I fixed only the one failure this pull caused. The other failures also fail on main, and I left them. Gate and tsc --noEmit ran clean. I did not run the full suite.

What changed

  • When a fork pull and main both append at the same place in a file, the combined branch (the fork head merged with main) now keeps both sides, main's first. The union merge is in src/git/union.ts.
  • When two edits overlap, no combined branch is built and the pull says it is held, naming the file. Landing it is refused with a 409 and main is unchanged. src/git/merge.ts and src/tui/screens/pull.ts changed to match.
  • The reproducer in test/landsim.test.ts is no longer test.failing.

This push

  • test/combined-fork.test.ts had one test at 1.86 s on main that crept over the 2 s per-test budget on a loaded shard. I split it into two tests, one for the combined branch and its note and preview, and one for recombine on push, stale and landing. Nothing else in the file changed. The file now passes (3 tests).
  • scripts/gate.ts passes and bun x tsc --noEmit is clean.

What I left alone

  • landsim seeded-corpus test (11.69 s in the check, over budget): it takes 8–10 s on main too. I tried one test per seed and it got slower, so I reverted. It needs an entry in SLOW in scripts/gate.ts with an issue that owns it, and I have no issue to name.
  • Failing on main, not touched by this pull (confirmed locally):
    • the first-screen line tests
    • the docs/MCP.md tool table, stale for the forges tool
    • the data-browser column audit
  • Not rerun here: the 429/503 retry-after check, the MCP stall test, the credit-spent test, the findings test and the hosted-forge mount test.
    • The retry-after test passes here.
    • The sandbox can't run the unix-socket suites.
    • I haven't compared the rest against main.

To try it, bun test test/combined-fork.test.ts test/union-merge.test.ts test/landsim.test.ts.

commented

I merged current origin/main into the branch and pushed it. The remaining check failures also fail on main, so I changed nothing for them; I haven't seen the check's verdict on the new push. tsc --noEmit is clean after the merge. I didn't rerun scripts/gate.ts after the merge. The union-merge, combined-fork and spawn tests I ran after it left only the two spawn failures below.

What this pull does: when a fork pull and main both add lines at the same place in a file, landing now keeps both sides, main's first. When their edits overlap, no combined branch is built and the pull says it is held, naming the file; merging it is refused with a 409 and main stays as it was. The change is in src/git/union.ts and src/git/combined.ts, plus small edits in src/git/merge.ts, src/core/pulls.ts, src/core/combined_view.ts and src/tui/screens/pull.ts. The #12104 reproducer in test/landsim.test.ts is now a normal test. Last round I split the slowest combined-fork test in two so each half stays under the 2 s test budget.

Failures that are not from this pull:

  • Spawn tests: the two spawn tests (test/spawn-sites.test.ts and test/spawn-pipes.test.ts) name src/git/own_refs.ts, which came in with #12097's merge on main and isn't on either test's list. test/spawn-sites.test.ts fails on a clean checkout of main at fc82d1a49.
  • landsim seeded-corpus test: it takes 8–10 s on main as well, and has no entry in SLOW. Splitting it into one test per seed made it slower, so I reverted that.
  • Fail on main when I ran them (first-screen line, docs/MCP.md table, data-browser column audit): my branch's results match main's.
  • Not run: the other listed failures (stall watcher, suggestion query count, hosted-forge mounts). The stall one needs a socket the sandbox can't open. I didn't look at the others.

To try it: bun test test/union-merge.test.ts test/combined-fork.test.ts test/landsim.test.ts.

commented

I merged main into the branch and pushed it, so the branch merges cleanly again.

The only conflict was in test/red-on-main.test.ts: a one-line comment that both sides had reworded. I kept main's wording. The code around it was identical, so nothing else from either side was lost.

After the merge, bun scripts/gate.ts and bun x tsc --noEmit printed nothing to flag, and test/red-on-main.test.ts passes (9 tests). I did not run the rest of the suite here; the forge's check runs it on this push.

commented

The red tests are not caused by this pull. I changed no code for them. I merged the latest main and pushed that, so the check will re-run on the new head.

I ran the failing files here on a clean checkout of origin/main and on this branch. Both give the same results:

  • First-screen line: 4 tests fail with r.where.inProcess undefined in src/web/pages/forges.ts. This pull doesn't touch that file.
  • Spawn lists: the spawn-pipes and spawn-sites tests fail because src/git/own_refs.ts starts processes but isn't on their lists. This pull doesn't touch that file.
  • docs/MCP.md: the tool-table test fails on main too.
  • Landing simulator: the seeded-corpus test takes about 12 s on main and on this branch alike, over the 2 s test budget. The budget check isn't something I can run in this sandbox.

I did not look at four other failures from the check: data browser, the terminal's shift, did-you-mean and the tenancy cell. They are in files this pull doesn't touch, and I didn't run them here, so I can't say whether main is red on them. Fixing any of this is a separate change, so I left it alone rather than widen this pull.

bun scripts/gate.ts and bun x tsc --noEmit both came back clean before the push.

commented

I changed no code for this failure. The two failing tests I could name pass here, so I think they failed under the load of the full check, and I merged the latest main and pushed that.

  • Not this pull: the check log says test/data-browser.test.ts, test/did-you-mean.test.ts and test/boundary-tenancy-cell.test.ts are also red on main at b070674.
  • Counted against this pull: test/crew-proposal.test.ts ("the terminal's c has the crew propose") is green on main there. The second test, "the second look at home as the owner…", lives in test/home-200.test.ts. I ran both files after merging main, and all 16 tests pass.
  • Why I think it's load: this pull changes src/git/ merge code, src/core/pulls.ts, src/core/combined_view.ts and src/tui/screens/pull.ts, but not the crew-proposal or home code. The check log shows the machine busy, with many tests running 2–20 s. I didn't see the failing assertions, so I haven't confirmed this.

bun scripts/gate.ts and bun x tsc --noEmit came back clean before the push. If crew-proposal or home-200 fails again on the new head, the log's assertion text will say whether it is load or something in this pull.

commented

Landing never drops a contributor's reviewed lines (#12104). When a pull and main only add lines at the same place, both are kept, main's lines first. Any other overlap holds the pull, and nothing is picked or dropped. This round fixes the two points from review.

The held sentence now matches what happens. It used to say the pull goes to its author's crew, but nothing sends it anywhere since that sweep was reverted. It now reads: #N is held: it overlaps main in …, nothing was dropped, and it waits for its author to merge main into their branch and push. It is defined in src/git/combined.ts (heldSentence). The module header now says the same. These tests now check the new wording and the absence of the old one:

  • test/combined-fork.test.ts
  • test/combined-git.test.ts
  • test/combined-recombine.test.ts
  • test/combined-held-words.test.ts, which checks the full sentence

Keeping both additions now applies on every merge path. In src/git/merge.ts, every conflict result of writeMergeTree now goes through one helper, orUnion. That covers the path with no base, the path with an explicit --merge-base, and the fallback for git older than 2.40, which builds two stand-in commits on top of the base. unionTree in src/git/union.ts takes an optional base, passes it to merge-tree, and uses it for its checks that each file exists on every side. Two new tests in test/union-merge.test.ts pass a base, once on modern git and once on the fallback. Each checks that two pure additions both land and that a real overlap is still a conflict. Both fail without this change.

Smaller items:

  • The Kept.kept doc now describes only "open". The "main" value stays in the type so that parseCombined can still read combined commits made before #12104.
  • The stray blank line in combined-fork.test.ts is gone.
  • The landsim corpus test is still over the 2 s per-test budget. I opened #12447 for it and pointed its SLOW entry in scripts/gate.ts at #12447 instead of the umbrella #1242.

Checks run here: bun scripts/gate.ts and bun x tsc --noEmit pass. All tests passed in the targeted files: union-merge, combined-, crew-merge-conflict, studio, git-revert, the take-back tests, merge-stale-green, verify-after-landing, pulls-merge-budget, landsim and the gate tests. scripts/fast.ts named 2,585 files (about 218 minutes of tests) for this diff, so I ran only those targeted files and left the full suite to the forge's check.

To try it, open a kept fork's pull that edits the same line as main. Its page says the new held sentence, and merging it answers 409 with main unmoved.

🤖 Generated with Claude Code

Sign in to join this conversation.

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

Keyboard shortcuts

Docs