Repository navigation
fix(render): a streamed soft visit holds to the page on screen - #1358
Conversation
🟡 Reviewed (latest push only: 1 commit(s) since
|
There was a problem hiding this comment.
Verdict: Commented. This review is not an approval.
Review summary: 22 file(s), 16 finding(s).
Critical 0 · Major 1 · Minor 14 · Nit 1
The PR changes streamed navigation cancellation, recovery and fragment scrolling. A newer visit that never swaps can strand the visible shell, and a late stream failure can override a pending browser load. The PR changes streamed navigation recovery and late fragment scrolling.
| File | Findings |
|---|---|
packages/cli/e2e/stream-hole-fixture.ts |
1 minor |
packages/cli/e2e/stream-hole-recovery.e2e.test.ts |
2 minor |
packages/cli/e2e/stream-hole.e2e.test.ts |
3 minor |
packages/render/src/navigation-history.ts |
1 minor |
packages/render/src/navigation-stream.test.ts |
3 minor |
packages/render/src/navigation-stream.ts |
2 minor |
packages/render/src/navigation.ts |
1 major, 1 minor, 1 nit |
wiki/Client-Navigation.md |
1 minor |
Reviewed with gpt-6.2-sol
9909b47 to
523acee
Compare
There was a problem hiding this comment.
Verdict: Commented. This review is not an approval.
Review summary: 24 file(s), 10 finding(s).
Critical 0 · Major 1 · Minor 9 · Nit 0
The PR updates cancellation, recovery and fragment scrolling for streamed soft visits. A newer visit can still strand the visible shell, a stale failure can interrupt the newer page, and fragment recovery can reload a native POST entry.
| File | Findings |
|---|---|
packages/cli/e2e/stream-hole-recovery.e2e.test.ts |
2 minor |
packages/render/src/navigation-history.ts |
2 minor |
packages/render/src/navigation-stream-recovery.test.ts |
1 minor |
packages/render/src/navigation.ts |
1 major, 2 minor |
wiki/Client-Navigation.md |
1 minor |
8 non-blocking finding(s) below major (no thread on a re-review, only blocking findings open threads)
packages/cli/e2e/stream-hole-recovery.e2e.test.ts:55minor · test The fragment test passes iflateFragmentignores visitor scroll and hash changes, because neither changes before the hole is released. Add cases that scroll or change the hash while the hole is held, then assert the reveal does not jump to the old target.packages/cli/e2e/stream-hole-recovery.e2e.test.ts:130minor · test If the/before?holdrequest reaches the server after the 300 ms sleep,wire.release()calls the old resolver and the healthy router never receives its answer. Have the fixture signal whenserveinstalls the current resolver, and await that signal before breaking the stream.packages/render/src/navigation-history.ts:89minor · bug If a soft swap to/page#newthrows before recording history while/page#oldis current,loadForRealreloads#oldand never reaches the requested fragment. Preserve the requested fragment before forcing the document load.packages/render/src/navigation-history.ts:109minor · bug A visitor who scrolls away and back before the hole arrives matches the saved coordinates again and is pulled to the late fragment. Latch cancellation on the first scroll away from the landing position or hash change and clean up the listeners when filling ends.packages/render/src/navigation-stream-recovery.test.ts:33minor · testbreakIt()sends a complete frame and relies on the fake DOM parser to reject it, so the deferred recovery cases still pass ifrest.next()starts swallowing reader errors. HavebreakIt()error the stream controller so the tests exercise the body-read rejection.packages/render/src/navigation.ts:416minor · bug If a modal opens over a fragmentless streamed page while its recovery is deferred,recover()loads the original fragmentless URL and closes the newly opened modal. When the current URL still names the streamed document, recover at that URL so the modal or a newer fragment survives.packages/render/src/navigation.ts:482minor · docs The comment promises no mutations afterstop(), but stopping while shell scripts are pending still letslandFocus,ultimate:navigatedandreconcile()run at lines 366-368 before the abort check. Limit the comment to the cancellation behavior this line guarantees.wiki/Client-Navigation.md:512minor · docs The event row saysultimate:navigatedfires after scrolling, but for a fragment inside a pending hole the final scroll happens after that event. Say the event follows the initial scroll, not a late fragment scroll.
1 finding(s) outside this pull request's change (reported, not holding the merge)
packages/render/src/navigation-stream.ts:60minor · performance When a read ends with a complete hole chunk followed by keep-alives, the saved suffix retains those comments until another read resolves, which can be much later for a hole with no deadline. Strip leading keep-alives from the suffix before returning the chunk.
These sit on code this pull request did not change, so they do not hold the merge.
Reviewed with gpt-6.2-sol
523acee to
7a7a35b
Compare
There was a problem hiding this comment.
Verdict: Commented. This review is not an approval.
Review summary: 24 file(s), 10 finding(s).
Critical 0 · Major 1 · Minor 9 · Nit 0
The PR changes streamed navigation recovery, cancellation, and fragment scrolling. The router can discard holes from the page still on screen, start a modal fetch after stop(), or reload the wrong fragment. The PR adds recovery, cancellation and late fragment scrolling for streamed visits.
| File | Findings |
|---|---|
CHANGELOG.md |
1 minor |
packages/cli/e2e/stream-hole-recovery.e2e.test.ts |
2 minor |
packages/render/src/navigation-history.ts |
1 major, 1 minor |
packages/render/src/navigation-stream-recovery.test.ts |
2 minor |
packages/render/src/navigation.ts |
2 minor |
wiki/Routes-And-Render-Modes.md |
1 minor |
9 non-blocking finding(s) below major (no thread on a re-review, only blocking findings open threads)
CHANGELOG.md:48minor · docs This entry andwiki/Known-Gaps.md:171say a newer navigation cancels the request, but a visit that starts after hole filling begins and returns an empty 204 leaves the old stream running. State that cancellation normally happens when the next page replaces the current one, not when its request st…packages/cli/e2e/stream-hole-recovery.e2e.test.ts:56minor · test The late-fragment test leaves scroll and hash unchanged, so it still passes if the router always jumps to the target and interrupts a visitor who already scrolled or changed the hash. Add held-hole cases that move the viewport or change the hash before release and verify the late target does not ta…packages/cli/e2e/stream-hole-recovery.e2e.test.ts:130minor · test If/before?holdreaches the fixture after the 300 ms window,wire.release()runs before the fixture installs its resolver and the test times out on a healthy router. Await a fixture signal that the held request arrived before breaking the old body or releasing the new one.packages/render/src/navigation-history.ts:109minor · bug If the visitor scrolls down and back to the starting offset before the first hole lands, the coordinate snapshot still matches and the late fragment jumps the page despite that interaction. Latch intervening scroll or hash changes while waiting and dispose the listeners when the wait ends.packages/render/src/navigation-stream-recovery.test.ts:33minor · testbreakIt()enqueues markup the fake parser does not know instead of rejecting the body read, so these recovery tests can pass on a parse failure without exercising a rejectedreader.read(). Error the stream controller directly while the held fetch is still pending.packages/render/src/navigation-stream-recovery.test.ts:34minor · testbreakIt()enqueues markup instead of rejecting the pending read, so the deferred recovery tests can pass on a fake DOM failure even if the router mishandles a network body rejection. Error the stream controller directly.packages/render/src/navigation.ts:372minor · bug On Back to a streamed page with a modal hash, a listener can callstop()atultimate:navigated, butreconcile()runs before this guard and starts a new modal request on the stopped router. Check for cancellation before reconciling the hash.packages/render/src/navigation.ts:417minor · bug If a visitor changes/streamedto/streamed#sectionwhile a hole is open, a later body failure loads the captured/streamedand drops the visitor's fragment. Recover the current history URL when it still names the same document, including a modal hash opened while the stream was pending.wiki/Routes-And-Render-Modes.md:345minor · docs The client-router row promises a shell swap as soon as it arrives but lists only the prefetch exception, so readers choosing a streamed route modal expect progressive paint even thoughnavigatedrains its holes before showing it. State that a streamed modal waits for the whole answer too.
Reviewed with gpt-6.2-sol
95b87b1 to
02585b0
Compare
- A newer navigation or `stop()` that lands while the shell's scripts run, an `ultimate:navigated` listener included, cancels the answer before any hole is filled; `stop()` also cancels the answer still being read. - A stream that breaks while the next visit is on its way waits for it and recovers only if that visit never took the tab. - A broken stream, and `ultimate:navigation-error`'s default, on a URL with a fragment reload the page: `assign` there only scrolled. - A fragment inside a hole is scrolled to when the hole lands, unless the visitor moved first. - Keep-alive frames are dropped as they arrive instead of held until the next chunk. Tests: e2e cases for each of the above in Chrome, a hole's signal observed on cancel, `ultimate:navigated` seen with the hole still open, a POST whose body dies is reported and never re-sent, a byte-split UTF-8 read, and a pin that no escaped value can spell the flush mark. Docs state that cancellation aborts the hole's signal, that a reused prefetch waits for the whole answer, and when `ultimate:navigated` fires on a stream page. Router: 31,904 -> 32,620 B minified (+716 B), 11,507 -> 11,765 B gzip. Six reference-app route budgets raised by their measured totals. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`location.hash` is the URL fragment, compared to tell whether the visitor moved before a hole brought the fragment's element. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lock waits but Chrome's The recovery cases move to stream-hole-recovery.e2e.test.ts over a shared stream-hole-fixture.ts, keeping each file under the line ceiling. The hole's signal is awaited on its abort event; the two remaining waits watch Chrome for a load that must not start and say so. The fragment comparison's pin states why it is new. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…om filling Review round on this branch: - the tab handed to the browser (a real load, the error event's default reload, a failed swap's reload, a non-download hand-over) cancels the page being left, so its stream breaking later cannot load it over the pending load - a stop while a hole's scripts run ends the fill before the fragment scroll - the late-fragment baseline is taken right after the swap's own scroll, before any script or listener moves the visitor - `/a#` counts as a fragment URL for the reload - keep-alives between two chunks of one read are dropped too - `STREAM_FLUSH_MARK` is exported from `@ultimat3/render/server` for readers of a stream; the e2e fixture uses it Tests: a fake-DOM suite for broken-stream recovery (nothing pending, a newer visit that lands, one that stays, a load already handed over), multibyte cuts in every character, keep-alives inside one read, the empty fragment, and e2e assertions on the event, the abort reason and the recovered fragment. Router: 31,904 -> 32,699 B minified (+795 B), 11,809 B gzip. Budgets re-measured. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…loads Back to `/page#part` whose soft fetch fails handed the browser `location.assign` of the URL it already showed: a same-document fragment navigation, so the page being left stayed on screen. `loadInstead` now goes through `loadForReal`, which reloads when the target differs from the address bar only by its fragment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…aches it
`loadForReal('/a#new')` with `/a#old` in the address bar reloaded `/a#old`: the requested anchor
was never reached. A target that differs from the address bar only by its fragment, and is not it,
is now pushed first, as `assign` would, then reloaded.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…'s budget re-measured on main (router 31,904 → 32,727) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
02585b0 to
8eb62da
Compare
There was a problem hiding this comment.
Verdict: Commented. This review is not an approval.
Review summary: 24 file(s), 10 finding(s).
Critical 0 · Major 1 · Minor 8 · Nit 1
The PR updates streamed navigation, fragment scrolling and recovery. A newer visit can strand the visible page’s holes, and a browser handoff can still be overridden by a stream that starts filling afterward. The PR changes streamed navigation recovery, cancellation, and fragment scrolling.
| File | Findings |
|---|---|
CHANGELOG.md |
1 minor |
packages/cli/e2e/stream-hole-recovery.e2e.test.ts |
2 minor |
packages/render/src/navigation-history.ts |
1 minor |
packages/render/src/navigation-stream-recovery.test.ts |
2 minor |
packages/render/src/navigation-stream.ts |
1 minor |
packages/render/src/navigation.ts |
1 major, 1 minor, 1 nit |
9 non-blocking finding(s) below major (no thread on a re-review, only blocking findings open threads)
CHANGELOG.md:62minor · docs The changelog and wiki/Client-Navigation.md:70-71 report 32,699 B (+795 B), but the budget notes under examples/dummy/apps/web/app/ report 32,727 B (+823 B) at feed/page.tsx:259-260, posts/board/page.tsx:119-120, posts/new/page.tsx:130-131, runs/health/page.tsx:74-75, runs/page.tsx:226-227 and sett…packages/cli/e2e/stream-hole-recovery.e2e.test.ts:57minor · test This case starts at scroll zero and never moves before releasing the hole, so it still passes iflateFragmentignores user scrolling and jumps to the target every time. Add a held-hole case that scrolls before release and asserts the offset is preserved after the target appears.packages/cli/e2e/stream-hole-recovery.e2e.test.ts:130minor · test If/before?holdreaches the fixture after the 300 ms sleep,wire.release()runs before that request installs its resolver and the test times out on a healthy router. Have the fixture signal when it installs the resolver and await that signal before breaking the stream.packages/render/src/navigation-history.ts:111minor · bug If the visitor scrolls down and back to the original offset while a hole is held, the snapshot still matches and the late fragment jumps the viewport despite the documented scroll opt-out. Latch scroll or hash changes while waiting and remove the listeners when filling ends or is cancelled.packages/render/src/navigation-stream-recovery.test.ts:33minor · testbreakIt()delivers a complete frame and relies on the fake DOM parser to reject it, so the deferred recovery tests pass even if a rejected body read is swallowed. Error the stream controller while the next response is held so the tests exercise a rejectedreader.read().packages/render/src/navigation-stream-recovery.test.ts:34minor · testbreakIt()enqueues a marked chunk without rejecting the body, so these tests can pass on a fake DOM parsing failure even if reader rejection no longer triggers recovery. Callcontroller.error()after the shell lands to exercise the same failure as a dropped connection.packages/render/src/navigation-stream.ts:55minor · performance When one read ends with a complete hole chunk followed by a batch of keep-alives,restOfretains every trailing frame while scripts run or the next read waits. ApplywithoutKeepAlivesto the suffix at line 60 before returning the chunk.packages/render/src/navigation.ts:370minor · bug If anultimate:navigatedlistener callsstop()on a page whose hash names a modal,reconcile()still runs before the abort check and can start a modal fetch on the stopped router. Check for abort immediately after dispatch, before reconciling the hash.packages/render/src/navigation.ts:483nit · docs The comment promises no mutation afterstop(), but when anultimate:navigatedlistener calls it,navigate()still reachesfinallyand removesdata-x-navigatingafterstop()returns. Describe the narrower guarantee that stopping aborts pending navigation and hole filling.
Reviewed with gpt-6.2-sol
|
Needs a human: developerz-ai/ultimate #1358: no machine has picked up the fix for this change. The fix round for this PR has waited in the queue far past the CI window and no machine has picked it up: either no box enrolled for this account is online and able to run it (the details name any capability or service it is missing), or every box that can is busy. Nothing moves the PR until one takes it. Bring a box online that can run this repository, free one up, or take the fix over by hand. |
…T's unread holes After a streamed POST answered for another principal, the tab is no longer trusted to swap, so a GET an `ultimate:navigated` listener starts goes straight to the browser. That handoff never aborted the POST's own visit: its unread holes started filling after the tab was handed over, and a body that broke then reloaded the old page over the new destination. `loadInstead` now aborts the visit in flight before handing over. Router 32,727 → 32,738 B (+11): every dummy route re-measured; `/posts/board` raised 121.4kb → 121.5kb (124,319 B), the rest still fit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Verdict: Approved.
Review summary: 10 file(s), 2 finding(s).
Critical 0 · Major 0 · Minor 2 · Nit 0
The router now cancels unread POST content when a navigation listener hands the tab to the browser. The PR description understates the measured router growth. The new regression test verifies cancellation but does not check that an already buffered hole stays off screen.
2 non-blocking finding(s) below major (no thread on a re-review, only blocking findings open threads)
CHANGELOG.md:62minor · docs The PR’s Size section understates the per-route minified cost by 118 B: it reports 32,620 B (+716 B), while the updated changelog and route budgets record 32,738 B (+834 B). Update the PR description to match the measurements at this commit.packages/render/src/navigation-stream-recovery.test.ts:161minor · test The fixture sends only the shell, andbreakIt()does nothing after the test confirms cancellation, so the test passes even if the router processes buffered holes before cancelling. Queue a valid hole with the shell and assert that its content or script never lands when the listener hands off the…
Reviewed with gpt-6.2-sol
Follow-up to the review threads left open on #1319.
Fixed
ultimate:navigated, the swap checks it still owns the tab before filling; otherwise the unread answer is cancelledstop()from a navigated listenerstop()also aborts the answer still being read. e2e: the stopped router cancels the request and fills nothingloadForReal: a URL that differs from the page on screen only by its fragment is reloaded. Used by the broken-stream GET recovery, the failed-swap GET recovery andultimate:navigation-error's defaultultimate:navigatedcarries the URL while the hole is still held?breakfixture: a GET is loaded for real (with a fragment: reloaded), a POST raisesultimate:navigation-errorand is sent onceSTREAM_KEEPALIVE_CHUNKnow lives beside the flush mark instream-scripts.tsand is re-exported fromrender-stream.tslateFragment: retried after each chunk until the element exists, unless the visitor scrolled or changed the hash; never on Back/ForwardNot changed
<!--x:flush-->. Text and attributes go throughescapeHtml, script and style bodies throughescapeRawTextContent(<!--→<\!--), JSON blocks throughescapeJsonContent(<→\u003c). Only an author's owninnerHTMLemits raw markup, and that is already full HTML control. A new test pins the property for all three escapers.Size
Router 31,904 → 32,620 B minified (+716 B), 11,507 → 11,765 B gzip, stated in
wiki/Client-Navigation.mdand the changelog. Sixexamples/dummyroute budgets raised to their measured totals (x build --target static), each with ameasured:comment.budget-raisesand the budgets step pass.Checks run
bun teston navigation-stream, navigation, render-stream (57 pass) and the stream-hole e2e in Chrome (10 pass). The new e2e cases and the fragment unit test were red before the fix.tsc -b packages/renderis clean. No full local verify; CI is the gate.🤖 Generated with Claude Code