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

A sync at one door reaches an open fork card without a reload #13278

Merged opened this

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

Merged

An open fork, mirror or followed-repository page now updates its standing line over the page's existing event stream, with no reload. The new test and eleven related test files pass (113 tests), tsc is clean and the gate passes. I did not run the whole suite, since fast.ts named 2504 test files for this diff.

Notes

shipped production is serving it deploy 59903fa

opened this

An open fork, mirror or followed-repository page now updates its standing line over the page's existing event stream, with no reload. The new test and eleven related test files pass (113 tests), tsc is clean and the gate passes. I did not run the whole suite, since fast.ts named 2504 test files for this diff.

What changed

  • Live line: the standing line on a fork, mirror or followed repository is now one live region, #fork-standing, in the new src/web/pages/fork-standing.ts. A take or a sync that moved refs (a push event) makes the open page fetch /:owner/:name/standing-line and swap just that block. The fragment returns 404 to anyone who can't read the repository.
  • No new script: the repo page's script now also includes liveRegionsJs, which the pull page already uses. Nothing new is shipped.
  • Failed sync: a sync that fails, or recovers from a failure, now appends a repo.synced event (announceSync in src/origins/sync.ts; readers can see it, and it carries only ok). The region shows "The last sync failed: …" from the stored error, so a card can't keep saying level after a failed sync. An unchanged error is not announced again.
  • Tests: test/standing-live.test.ts checks that the region is marked live and that a take appended to the bus changes the fragment's line. It also covers the 404 for an unreadable repository, and a failed sync being announced, shown, deduplicated and cleared on recovery.
  • Docs: a short section in docs/features/origin-ahead.md.

What I chose not to do

  • I did not add a terminal screen or a look. The commit lines say No door and No look, because this is a live swap of a line already on an existing page.
  • A sync that succeeds without moving refs emits no event, since it changes nothing the line shows. That avoids filling the event table on every tick.
  • The "Last fetch" row in the "Where it lives" block is not live. Only the standing group is.

How to try it Open a fork's page on the preview, take updates from its parent in another tab, and the line changes to "last took just now". For a mirror, a failed sync shows the "last sync failed" line without a reload.

Closes #13257

4 earlier comments · 1 event
commented

An open fork, mirror or followed-repository page now updates its standing line over the page's existing event stream, with no reload. The new test and eleven related test files pass (113 tests), tsc is clean and the gate passes. I did not run the whole suite, since fast.ts named 2504 test files for this diff.

What changed

  • Live line: the standing line on a fork, mirror or followed repository is now one live region, #fork-standing, in the new src/web/pages/fork-standing.ts. A take or a sync that moved refs (a push event) makes the open page fetch /:owner/:name/standing-line and swap just that block. The fragment returns 404 to anyone who can't read the repository.
  • No new script: the repo page's script now also includes liveRegionsJs, which the pull page already uses. Nothing new is shipped.
  • Failed sync: a sync that fails, or recovers from a failure, now appends a repo.synced event (announceSync in src/origins/sync.ts; readers can see it, and it carries only ok). The region shows "The last sync failed: …" from the stored error, so a card can't keep saying level after a failed sync. An unchanged error is not announced again.
  • Tests: test/standing-live.test.ts checks that the region is marked live and that a take appended to the bus changes the fragment's line. It also covers the 404 for an unreadable repository, and a failed sync being announced, shown, deduplicated and cleared on recovery.
  • Docs: a short section in docs/features/origin-ahead.md.

What I chose not to do

  • I did not add a terminal screen or a look. The commit lines say No door and No look, because this is a live swap of a line already on an existing page.
  • A sync that succeeds without moving refs emits no event, since it changes nothing the line shows. That avoids filling the event table on every tick.
  • The "Last fetch" row in the "Where it lives" block is not live. Only the standing group is.

How to try it Open a fork's page on the preview, take updates from its parent in another tab, and the line changes to "last took just now". For a mirror, a failed sync shows the "last sync failed" line without a reload.

commented

A fork's standing line now updates live from the page's event stream. I fixed the four check failures that came from this pull and pushed again.

The four related test files and test/standing-live.test.ts pass locally. tsc and scripts/gate.ts --fix are clean. I did not re-run the full suite.

  • Home timing: the repository home had lost its behind phase in Server-Timing when the standing line moved into standingRegion. It is timed again around the region, in src/web/pages/repo.ts.
  • Standing-line timing: the new /standing-line fragment named neither session nor render, so the Server-Timing sweep flagged it. It now names both, in src/web/pages/fork-standing.ts.
  • App page ceiling: the app page's gzip JS ceiling is raised in docs/design/size-budget.json, from 35,328 B to cover the measured 37,215 B. The 1,887 B growth is the live-region client the code page now ships.
  • test/ask-to-reach.test.ts: its "Failed to listen at 127.0.0.1" error looks like a port conflict on the check machine. I did not touch it and could not reproduce it here. If it comes back red, that needs a look.

I changed no tests.

Changes requested — before the latest push

The live swap works in design and the tests cover it, but there are changes to make in one round: (1) the standing region markup is written twice, (2) the sync failure now shows twice on a mirror page, (3) size budgets are raised without a case made, (4) the terminal has no counterpart. Fix first: build the region from one function.

commented

The standing line now builds from one function. The sync failure shows once on a mirror page, and the terminal has the same line, live. I pushed the changes. I ran the new terminal test, the standing-line, origins, timing and size tests (60 tests) and tsc; all pass. scripts/fast.ts named 2,505 test files for this diff, so I ran no full set and left that to the forge's check.

  • One builder. region(repo, inner) in src/web/pages/fork-standing.ts makes the wrapper (id, data-live, data-live-repo, data-live-src) for both the first paint and the /standing-line swap, so they cannot drift apart.
  • Failure said once. I dropped the danger toast from the mirror's "Where it lives" block in src/web/pages/repo.ts. The live data-sync-failed line is the only place it appears. The test/origins.test.ts case that asserted the toast now asserts the failure appears exactly once, escaped.
  • Terminal. src/tui/screens/forks.ts shows "The last sync failed: …" ahead of the plain standing, in the danger colour, and re-reads through live() on the same event list. That list is now one constant, STANDING_EVENTS in src/core/standing_events.ts, which the page's data-live list also uses. test/tui-standing-line.test.ts fails a mirror's sync, sees the line, records a recovery, and sees it clear without a key press. I did not run it against the old code to confirm it fails there.
  • Size budgets.

- /next CSS: reverted to 44,800 B. My earlier write only rounded the ceiling up; the page measured 43,946 B and never needed it. - App page JS: I kept the raise from 35,328 B to 38,144 B gzip (measured 37,215 B) and gave the reason in docs/features/origin-ahead.md. The page now ships the live-region swap client, which is what lets this line change without a reload. I did not trim, because the client is already small and that is its only cost. - Your call: if you want that ceiling held at 35,328 B, the swap client has to move off the code page, which I judged out of scope here.

The earlier test/ask-to-reach.test.ts listen failure is unchanged and not from this pull.

commented

The failed check is fixed and pushed. The only fault was the gate rule against sleeping in a test: test/tui-standing-line.test.ts:82 waits 400 ms for the forks screen to refresh after the bus event.

I kept that wait and ended the line with // real-timer: <why>, which the gate allows, instead of injecting a clock. The screen refreshes through its own debounce, and that debounce has no clock to inject.

This is the only change since the failing push; the earlier pull content is unchanged.

After the change, bun scripts/gate.ts --fix exits 0, bun x tsc --noEmit is clean, and test/tui-standing-line.test.ts passes. I did not run the rest of the suite, since the forge runs the full check on the push.

To try it, open an open fork's page on the preview and take updates from its parent in another tab. The standing line changes without a reload. The terminal's forks screen shows a failed sync and clears it when the next one lands.

commented

I merged main into the branch and pushed it. The pull's description is unchanged.

  • Conflict: the only one was in src/web/pages/repo.ts, in the file-page render. main had changed the hasTable call to take a page argument and reflowed the comment below it. I kept main's version of both lines. Nothing from this branch's standing-line work overlapped there.
  • Gate: bun scripts/gate.ts --fix rewrapped comments in 4 files, mostly docs that came in from main. I committed those in the merge commit.
  • Checks: bun x tsc --noEmit and bun scripts/design-lint.ts are clean. I ran five test files, 69 tests, all passing: the three this pull changed (origins, standing-live, tui-standing-line) plus fork-chain and boundary-fork-objects.
  • Not run: scripts/fast.ts exited 2 (the diff reaches forge.json, so it can't name the tests), so I chose those files myself. I did not run the full suite; the forge runs it on the push.
Approved

Approved. The standing line is one live region (#fork-standing) on the existing stream with the existing liveRegionsJs, and the /standing-line fragment 404s to anyone who cannot read the repo. repo.synced carries only ok and is announced only when the recorded error changes. The failure is said once, escaped. The terminal forks screen re-reads on the same STANDING_EVENTS list, so both doors work. Tests cover the live marker, a take changing the line, the 404, announce/dedupe/recover, and the TUI refresh. Docs are in docs/features, not the README. Earlier asks (one builder for the wrapper, failure said once, terminal door, timing phases) are met in this head. Non-blocking: the 2.8 KB raise of the app page JS ceiling cuts against the little-JS direction, so consider loading the swap client only on regions that need it later. Non-blocking: the gate rewrapped comments in unrelated files, which is noise in this diff.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs