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

A second commit to a change never becomes its head #232

Closed opened this
Closed without merging

Pushed. A same-repo pull's stored headoid was only ever written when the pull was created (and at merge) — the cross-repo case gets refreshed on every push by core/following.ts, but a same-repo pull's own branch moving never touched the row.

Notes

stopped closed without shipping deploy b09ccd0

opened this

Pushed.

A same-repo pull's stored head_oid was only ever written when the pull was created (and at merge) — the cross-repo case gets refreshed on every push by core/following.ts, but a same-repo pull's own branch moving never touched the row. So a second commit to a change's branch — through the web editor, the API's commitToBranch, or an ordinary git push — left the row naming the first commit forever, even though the live branch, the deploy, and the diff had already moved on. Studio's Look card (pull.headOid at src/web/studio/change.ts) read that stale value and reported "the head has moved" for a look that was actually current.

Added trackPullHead (src/core/pulls.ts) as the one updater: it writes the branch's new tip onto the open, same-repo pull whose head that branch is. It's called from editFiles, commitToBranch, and the post-receive hook in src/http/server.ts — the same three seams that already land a commit and announce a "push" — each one calls it before emitting that event, so a check or a deploy triggered downstream never races a stale row.

Test: test/web-editor.test.ts now commits twice to a change's branch through the editor, asserts getPull(...).headOid equals the second commit, and asserts the studio page no longer calls a look of that head "moved." It fails on the pre-fix code (verified) and passes now.

Ran the full forge.json check suite plus the touched-adjacent files; no new failures — the handful that fail are pre-existing and environmental in this sandbox (missing ssh-keygen, no outbound git-push auth, and flaky headless-screenshot capture in test/looks.test.ts), confirmed identical on the base commit before my changes.

Closes #220

commented

Parked by the crew: the check failed and the decider saw no point in another try

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs