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
Check · Review · Land · Live done — Landed and live in production.
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.
-
Reviews
Changes requested — before the latest pushThe core logic reads right: a clean merge writes upstream/<tip7> at the fetched head, a planted branch fails the check as
squattedand is left alone, and a conflict opens nothing. I read the diff and the repo; I did not exercise the preview. Two things block it.- Fix first: the README. Nothing documents following an upstream,
refs/upstream-follow/*or theupstream/<tip7>proposal, and README.md has no mention of the newsquattedrefusal. Add a short section saying what a check does on a clean merge, a conflict and a planted branch, that a closed proposal is not reopened, and how a person triggers or sees a check. The rubric says the README states how to use it. - The test for moving an open pull does not check the move. "a later tip moves the open pull" asserts only that the pull number is unchanged and the new branch exists. Assert the pull's head_branch and head_oid now equal upstream/<next7> and refs/pull/N/head equals next, and that the title/body were rewritten. The dead
base/expect(base).not.toBe(next)lines assert nothing about the change and should go. Also add a test that a closed proposal for the same tip is not reopened, since the code comments promise it.
Smaller: the imports in upstream_follow.ts are out of order (
../core/issues.tsand./pulls.tsland between unrelated modules). When the pull is retargeted, the old upstream/<old7> branch is left behind; say in the README that it stays, or delete it.ApprovedDoes what the issue asks: a clean merge writes upstream/<tip7> at the fetched head and opens one pull as the person who turned following on. A repeat check opens nothing. A planted branch fails the check as squatted and is left alone. A conflict is noted and opens nothing. Tests cover each of these, including the closed-proposal case. The README section is accurate, and it says there is no button or page for this yet. I read the diff and did not exercise the preview. This change adds no new route or write door, so the page-versus-terminal parity check has nothing to compare.
Two things I would do next:
- Check the return value of the writeRef call for refs/pull/N/head in the retarget path in src/actions/upstream_follow.ts. Today a failed write leaves the pull row pointing at a head ref that was not updated. Fail with failed("git") as the branch write above it does.
- Give the follow row a visible place: a page or tty line showing the tip, the commits behind, the pull and the error. Until then the README sends people to the database row to see what a check did.
- Fix first: the README. Nothing documents following an upstream,
-
Checks
shipped production is serving it deploy c1c75da
-
History
- Document following an upstream; test the move and the closed proposal; order imports a2b290e
- A clean upstream merge opens one pull from upstream/<tip7>; a planted branch of that name fails the check and opens nothing a84bc59
- The merge queue gates in parallel: bisect a red batch two halves at once, and speculatively gate the next batch on top of the current one (#4058) bc6bb89
- Design: the make-it-yours page's key and value list uses the design system, and kv leaves §5d (#3896) 44f94c4
- GET /metrics serves forge_http_request_duration_seconds to an admin or an admin's token, listed as not-a-page (#3883) 7b7a9d5
- The terminal lists, grants and revokes an app's private destinations, through the same actions as the page (#3882) f8d4648
- An agent run reuses its repository's bun install cache from the run before, instead of downloading every package again (#3738) 6869110
- Sentinel: queue:check was degraded 75 minutes today: 9 checks wait behind one lane; the oldest since 04:44; the lane runs #4032 for 2 min (limit 60). (#4062) 31ac3e3
- Design: the quiet disclosure becomes a §5 component used by its four pages, and quiet-details leaves §5d (#3933) 7c9233d
- On a client's first screen each app row says "Working on: …" or "Last change: …, 3 days ago" (#4056) b101086
- MCP `pulls`: list a repository's open pulls, briefly, with each one's check and review state (#4055) 70c9dc3
- Sentinel: shared:01m23vygyffx5hg2f5vm8r74sr:39d89j4f7b is past its budget: trevato/forge: "a pull whose review loop is spent is the planner's (#1655) > the planner is asked for it and its brief … (#4054) cc1a58e
- Design: the home KPIs are §5 stat tiles, and the kpi* classes leave §5d (#4048) 89d8dcc
- Checking an upstream fetches only the vetted address, sends a token only to its exact https origin, and runs one check at a time (#4046) eb96540
- forge_http_request_duration_seconds only grows, so rate() and histogram_quantile() read it correctly (#4034) 9633874
- Design: a run's summary line and cancel actions use §5's text and bar, and run-summary/run-actions leave §5d (#4032) 66746d9
- The API's issue list names its Server-Timing phases: session, list, labels, render (#4014) d1b51cf
- A test fails when a GET page answers without named Server-Timing phases, and its allowlist only shrinks (#3990) 15dced1
- The API's board panel read names its Server-Timing phases: session, board, query, render (#3928) b9d470e
- The API's search names its Server-Timing phases: session, search, render (#3927) 620d1de
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 inopened. - Second check, nothing new: it finds the existing pull for that branch, opens nothing, and
openedstays 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 andresolveOiddoesn't equal the fetched head, the check fails with a newsquattederror and notes it on the row. It opens no pull and leaves the branch untouched. - Conflict: the row's
erroris set to"conflict", and no branch or pull is created. - Result shape:
Checkedgainsoutcome(none,proposedorconflict) and an optionalpullnumber. - 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.
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 oldupstream/<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
headBranchandheadOid, thatrefs/pull/N/headequals the new tip, and that the title and body were rewritten. The deadbaselines are gone. - Closed-proposal test: a new test closes the pull and checks again. It asserts the same pull number,
openedstill 1, and only one pull in the repository in any state. - Imports:
upstream_follow.tsimports are now in order.
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 --noEmitandbun test test/upstream_follow.test.tspass (23 tests); I did not run the rest of the suite.What changed (
src/actions/upstream_follow.ts, plus a smallretargetPullinsrc/core/pulls.ts):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 inopened.openedstays at 1. It also opens nothing if a person closed that pull.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.upstream/<tip7>exists andresolveOiddoesn't equal the fetched head, the check fails with a newsquattederror and notes it on the row. It opens no pull and leaves the branch untouched.erroris set to"conflict", and no branch or pull is created.Checkedgainsoutcome(none,proposedorconflict) and an optionalpullnumber.Left out:
Environment:
bun xandbun installfirst failed with a read-only tempdir error in this sandbox. SettingBUN_TMPDIR=$TMPDIRworked around it. Nothing was wrong in the change.Closes #3978