Repository navigation
trailview: an idle view waits for the meshes that count their calm frames - #3795
Merged
Merged
Conversation
…ames Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 12 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
timohueser
marked this pull request as ready for review
November 21, 2026 21:49
timohueser
enabled auto-merge
November 21, 2026 22:09
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Mode: fix
Requirements: none
Public docs: no
The fault
On the phone tier with
ground=plan,waitForIdle()can return before the road meshes near the eye draw. A gallery shot or a still then shows the road under the eye flat grey. This happens most often after a warm open, where the device cache holds the view.The cause: after a frame in which a mesh cell rests on a page coarser than level 17, the plan's meshes draw again only after
CALM(120) calm frames (meshLevelinplan/pieces.ts). On the phone the half-size terrain pool leaves pages out while it fills, so the first frames of a load rest, and the count starts over. At 30 fps the 120 frames take 4 s. With a warm cache, all other content settles in about 2.3 s.Terrain.workingalready keeps frames going while the meshes return (pieces.returning), butTerrain.idledid not wait for them. So the still view converged on its 16 jittered frames without the meshes. When the meshes came, the view started again and drew correctly, about a second later.A frame trace of one failed load (warm cache,
tier=phone): the still view converged at 2.8 s,waitForIdle()resolved at 3.9 s with the meshes' calm at 104 of 120, and the meshes drew after that.The fix
Terrain.idleis false whilepieces.returningis true. Frames already go on in that state, and the calm reachesCALMin a fixed number of frames, sowaitForIdle()cannot hang on it. On the phone tier a warm load now waits up to 4 s for its meshes.Measurements
M1 Pro, headless Chromium on Metal, 390 × 844 CSS pixels at DPR 2, the walk
lat=46.8205 lon=8.403 heading=160 eye=1.6 ground=plan, data from the PC data server. One fresh browser per run; "warm" loads the view once, then again in the same page. The grain of the bottom 200 rows (standard deviation of red) is 9.4 with the road's asphalt and 1.2 for the flat grey road.tier=phone, cold cachetier=phone, warm cachetier=phonetier=phone, warm cachetier=phoneBefore the fix, a reset of the accumulation in a bad state gave the right picture (3 of 3): the content was there, only the still view was stale. The phone's
terrainShare: 0.5is the tier value that exposed it: with the full share (1) the load lasts longer than the count, and no run failed (3 of 3).Checks
In
builder/web:npx vitest run src/lib/trailview(491 tests),npm run checkandnpm run check:wgslpass. No new unit test: a stub ofTerrain.idlewould only restate the getter. The existing test inplan/pieces.test.tsshows thatreturningends after exactlyCALMframes, sowaitForIdle()cannot hang on it; the runs above are the evidence for the fix.Left open
CALMcounts frames and the phone draws 30 a second. Whether the rests of a filling pool should restart the count is a design question for the owner, not part of this fix.nearReady()andeyeReady()do not wait for the returning meshes either. The planner opens TrailView oneyeReady(), so on the phone it can open on the flat grey road, and the meshes come about 1.7 s later.Review: one round; the comment on
Terrain.idlenow names the rest that restarts the count, and a thin test went out.Time spent measuring: about 35 minutes (the bisect by cache kind and tier value, the frame trace, the runs above).
🤖 Generated with Claude Code