New commits upstream, on a mirror
A repository brought from another forge (or any origin) shows "N new commits
upstream" under its head when the origin's default branch has moved past it,
with Take them (POST /:owner/:name/sync/take).
src/origins/ahead.tsreads the origin's tip (objects only, no ref moves),
counts, and keeps the reading as an origin cursor. The worker re-reads up to four mirrors a minute, each at most every two minutes; a sync clears it.
- The readings run under their own single-flight guard (
runAheadReads,
started from the same minute tick as runSync), never inside the sweep's:
a reading stuck on a slow origin holds only the next reading, never a sync.
- Only a person who may write the repository sees Take them; everyone who
may read it sees the count, and a guest sees nothing on a private one.
- At the terminal: the palette's "New commits upstream" lists the mirrors you
can read that are behind (one query over the readings, not one per
repository); t takes them under the page's own check, requireWriter
(src/tui/screens/originahead.ts).
- A mirror whose default branch holds commits the origin lacks shows
"conflicts with commits here". Take them then moves nothing, and neither does the sweep: it leaves that mirror's git alone and says why where the last fetch is shown. Sync now is unchanged: the person asked for the origin's branches, so it replaces the diverged branch, and it is the way out. An origin that cannot be read just then is refused the same way: it is not known whether taking would overwrite.
- A repository's readings go with it when it is deleted or linked to another
origin (forgetRepoCursors); disconnecting an origin drops its cursors by
the schema.
test/origin-ahead.test.tsruns two forges: commit on the origin, see the
count, take them, count 0; a diverged mirror survives Take them and a sweep; a silent origin does not hold the sweep.
The standing line is live
On a fork, a mirror or a followed repository, the line under the head (sync failure, how far behind, how it follows) is one live region of the page's own event stream (#fork-standing, src/web/pages/fork-standing.ts). A take or a sync that moved refs is a push; a sync that fails, or recovers from a failure, is a repo.synced event (readers; it carries only ok). Either makes the open page read /:owner/:name/standing-line and swap that block, rendered from what is stored, so a card never keeps saying "level" after a failed sync.
The terminal is the other door: the forks screen (src/tui/screens/forks.ts) reads the same standing line, puts the last sync's failure in the origin's words ahead of the plain standing, and re-reads on the same events (STANDING_EVENTS, src/core/standing_events.ts) through live(). The mirror's "Where it lives" block no longer repeats the failure; the live line is the one place it is said.
Size ceiling. The app page's JS ceiling rises from 35,328 B to 38,144 B gzip (measured 37,215 B): the page now ships liveRegionsJs, the swap client that lets this line change without a reload; nothing else on the page grew. The /next CSS ceiling is unchanged.