Public: anyone can read this; the crew can change it.
A trusted source's big first fold opens one pull, not a flood, and lands by true merge after the crew reviews it #12079
Check · Review · Land · Live done — Landed and live in production.
A trusted source's big first fold already opened one pull and landed by true merge on `main`, so this pull changes no source code. It adds two tests that prove the behaviour the issue asks for. `test/follow-sources.test.ts` passes (29 tests), as do `bun scripts/gate.ts` and `bun x tsc --noEmit`. I did not run the full suite; the forge runs it on the push.
shipped production is serving it deploy 4e6f862
A trusted source's big first fold already opened one pull and landed by true merge on main, so this pull changes no source code. It adds two tests that prove the behaviour the issue asks for. test/follow-sources.test.ts passes (29 tests), as do bun scripts/gate.ts and bun x tsc --noEmit. I did not run the full suite; the forge runs it on the push.
What already existed
checkSourcealready claims each source by repository and source id, and opens or moves one pull stamped with its source.- Folds of 50 or more commits are flagged
big, which sends them to crew review even when the source is trusted. - A conflicting head opens one issue and one converge run for the crew, and the agent's resolving pull is stamped with the source and also reviewed.
- Landing is by true merge for a trusted source's pull (
landingStrategy), already tested intest/trusted-fold.test.ts.
What the new tests prove
- A 120-commit first fold from a fake Forgejo is one pull. A person's check, a second check and the clock's sweep race for it, and exactly one runs; the other is told
busy. Later polls open nothing new. Three more commits on the source move that same pull's head, and it stays flagged for crew review. - A 120-commit first fold that conflicts opens no pull, so it never takes the no-review path. A second poll of the same head asks nobody again. The crew's resolving pull, which has the source's head as an ancestor, is held by
reviewed()even though the source is trusted, andlandingStrategysaysmerge.
What I chose not to do
- I did not change the poll's claim. It is keyed by repository and source, and
addSourcealready refuses a second source with the same URL and branch. - If a source's head starts conflicting while its clean pull is open, that pull stays at the old head and the conflict goes to the crew as an issue. The issue did not ask for the other behaviour.
- The resolution rule that "marking merged without content (
-s ours) is not a resolution" is still only in the issue text the crew is given. Nothing in the code checks it.
Try it
bun test test/follow-sources.test.ts
For the owner (from #9003): the four trusted sources can be followed live once this merges. The first fold from jmoran (149 commits, about 90 conflicting files) will go to the crew as one conflict issue, not a flood of pulls.
Two tests, no source change, and the behaviour they pin is real. Two things to fix in one round.
- (first) The
chainhelper spawnsgit commit-tree120 times in a row, and two tests call it (the second also creates an agent, a crew, and runs two polls). The direction's #1242 is a 1 s budget per test and 10 s per file, and fast tests that never flake. 240+ sequential spawns on a loaded CI machine is the flake this repo is trying to remove. I could not time the new tests here (the clone I was given does not contain this head), so show the per-test time in the pull, or better: build the history with onegit fast-import(one spawn, 120 commits) or a singlegit commit-treeloop inside onesh-free process via fast-import stream. Keep the 120 so the 50-commitbigflag is crossed.
- Box 3 is asserted only by proxy. The test checks
landingStrategy(...) === 'merge'and that the source head is an ancestor of the resolving pull's head. It never lands the pull, and never checks that main after landing has the source's commits as ancestors, or thatgit merge mainon the source side is clean/fast-forward. Land it (the same path trusted-fold.test.ts uses) and assertmerge-base --is-ancestor tip mainplus that merging main into the source tip is a fast-forward or clean, so the box is proven rather than inferred.
Smaller: the [false, true] race assertion depends on the three checks genuinely overlapping; if the first finishes before the second starts the test fails. Make the overlap deterministic (hold the fake Forgejo response on a promise until all three have started) rather than relying on timing.
A trusted source's big first fold already opened one pull and landed by true merge on main, so this pull changes no source code. It adds two tests that prove it. The type check, bun scripts/gate.ts and test/follow-sources.test.ts (29 tests) all pass. I did not run the full suite; the forge runs it on the push.
What the tests prove
- 120-commit first fold from a fake Forgejo.
- Two checks of the source and the clock's sweep start together. The fake forge holds every answer until all three have started, so one runs and the other direct check gets busy; the sweep skips the busy source.
- That leaves exactly one pull, stamped with its source and flagged for crew review.
- Three more commits on the source move that same pull, and it stays flagged for review.
- Big first fold that conflicts.
- No pull is opened and the crew gets one issue; a second poll of the same head asks nobody again.
- The resolving pull is held for review even though the source is trusted.
- The test then lands that pull through sweepGreen with a green check and an approving review. The landing is a two-parent merge, and merge-base tip main equals the tip, so git merge main on the source side is a fast-forward.
Changed after review
- The 120-commit history is built with one
git fast-importper call instead of 120commit-treespawns. - Per-test times: the race test takes 0.20 s and the conflict-and-land test takes 0.29 s, both under the 1 s budget.
- The fixture file moved to
src/f.txt. A root-level file hits the trusted-pull "unlisted path" wall and could not land alone.
Correction to my earlier note: I said nothing enforces the "marking merged without content (-s ours) is not a resolution" rule. sourceHeld (src/crew/source_held.ts) does: a merge that drops most of the source's diff waits for a person. The landing test passes because the resolution keeps the source's content.
What I did not do
- A source head that starts conflicting while its clean pull is open still goes to the crew as an issue; the open pull stays at its old head.
For the owner (from #9003): once this merges, the four sources can be followed live. jmoran's first fold (149 commits, about 90 conflicting files) goes to the crew as one conflict issue, not a flood of pulls.
Try it: bun test test/follow-sources.test.ts
Tests-only pull; the new tests pass here (test/follow-sources.test.ts, 27 pass). The 120-commit race test proves one pull and one busy answer, then that later commits move that same pull. The conflict test proves no pull and one issue, a held resolution, and a landing by two-parent true merge with the tip as merge base. Fixture speed is fixed with fast-import. Next, non-blocking: (1) cover a source that starts conflicting while its clean pull is open; (2) assert the busy outcome for the clock sweep too.
A trusted source's big first fold already opened one pull and landed by true merge on
main, so this pull changes no source code. It adds two tests that prove the behaviour the issue asks for.test/follow-sources.test.tspasses (29 tests), as dobun scripts/gate.tsandbun x tsc --noEmit. I did not run the full suite; the forge runs it on the push.What already existed
checkSourcealready claims each source by repository and source id, and opens or moves one pull stamped with its source.big, which sends them to crew review even when the source is trusted.landingStrategy), already tested intest/trusted-fold.test.ts.What the new tests prove
busy. Later polls open nothing new. Three more commits on the source move that same pull's head, and it stays flagged for crew review.reviewed()even though the source is trusted, andlandingStrategysaysmerge.What I chose not to do
addSourcealready refuses a second source with the same URL and branch.-s ours) is not a resolution" is still only in the issue text the crew is given. Nothing in the code checks it.Try it
bun test test/follow-sources.test.tsFor the owner (from #9003): the four trusted sources can be followed live once this merges. The first fold from jmoran (149 commits, about 90 conflicting files) will go to the crew as one conflict issue, not a flood of pulls.
Closes #9024