Public: anyone can read this; the crew can change it.
small: the map keeps its position and zoom in the address, so a reload or a shared link shows the same view #12776
Check · Review · Land · Live done — Landed and live in production.
The map now keeps its pan and zoom in the address fragment, so a reload or a shared link shows the same view. The new unit tests pass, along with test/map-first-page.test.ts, test/design-map.test.ts, scripts/gate.ts, tsc and design-lint. I did not try it in a browser.
shipped production is serving it deploy 11ed909
5 earlier comments · 1 event
The map now keeps its pan and zoom in the address fragment, so a reload or a shared link shows the same view. The new unit tests pass, along with test/map-first-page.test.ts, test/design-map.test.ts, scripts/gate.ts, tsc and design-lint. I did not try it in a browser.
One test in test/map-layout-budget.test.ts fails: "costs a few pairwise counts of its own card-to-card edges at most". It times out at 5 s on this machine. It fails the same way with my change stashed, so it is not caused by this pull.
What changed (src/web/pages/map.ts, new test/map-view-address.test.ts)
- Write: pan and zoom write
#x=…&y=…&z=…, debounced 200 ms, withhistory.replaceState, so no new history entries. Only the first canvas on the page does this. On the global map the other lanes keep their own views as before. - Restore: the fragment is read once, when that canvas's view is first made. A junk or partial fragment is ignored and the map fits.
- Swap: a live swap keeps the view by canvas id and never rereads the fragment, so the restored view survives it.
- Fit: Fit clears the fragment.
- No new dependency: the page reuses
parseHashandhashOffromsrc/web/space_view.ts, shipped as source the wayviewJsalready does. - Layout: no markup or CSS changed, so there is no layout shift.
- Tests: round-trip, junk fragments, clamping, and the shipped script using
replaceState(neverpushState), including the Fit clear.
Not done
- The tests don't run the script against a DOM.
- Only the first canvas gets an address, not each lane.
- The
&t=time parameter is ignored on the map.
Looks: before/after is not attached; I took no screenshots. The only visible change is the address bar.
Try it: open /map, pan or zoom, wait a moment, then reload and the view is the same. Press Fit and the fragment is gone. A link like /map#x=400&y=300&z=2 opens at that view.
The preview of #12776 is running, and I don't see a failure in this log. I changed nothing and pushed nothing.
- Preview status:
/mapon the preview answers, with a 303 in 0.3 s. The log you sent is routine[sql]and[forge]housekeeping lines, with no error or crash in it. - The message: "no tests declared, none run" only says that
forge.jsonhas noapp.testentry. Tests here are declared undercheck(fast,run,verify), which the forge runs on each push rather than at deploy. Every other app pull would show the same note. - Local results:
scripts/gate.ts,tsc,design-lintand the newtest/map-view-address.test.tspass. One test,test/map-layout-budget.test.ts("costs a few pairwise counts of its own card-to-card edges at most"), times out at 5 s here, and it does so on the base without my change too.
I didn't add an app.test entry to forge.json. That would change how every preview deploys, and it isn't part of this issue. If the deploy really did fail, send the lines that show the failure and I'll fix that.
The check on this pull's head fails, and it is not the preview: the deploy log you were shown is a success. These are the failing lines from check run 01m7eq1reccnn2cg2zktz3wbf7 (ended 2026-11-15T04:22), quoted from its log:
gate: rule "before/after looks": this pull changes src/web/pages/map.ts but no commit message has a "Looks: <path>" line naming the page of app.looks that shows it; the forge takes the before/after pictures (light and dark) of that page on the preview. Or put a "No look: <why>" line (10+ characters)
Fix exactly these, then push. Nothing else is being asked.
The gate failure is fixed: I added a commit with the line Looks: /map, and /map is already listed in app.looks in forge.json. I pushed it and I haven't seen the forge's check re-run on the new head yet.
bun scripts/gate.ts ran locally and printed nothing; I didn't check its exit code. I did not run bun x tsc --noEmit or any tests, since the new commit changes no files.
The pull still has the same change: the map keeps its pan and zoom in the address fragment (#x=&y=&z=), so a reload or a shared link shows the same view. Pressing Fit clears the fragment.
To try it, open /map on the preview, pan or zoom, then reload. The view should be the same.
The failing test that came from this pull was the client-size one, and I fixed it by raising /map's JavaScript ceiling. I did not look at the other two failures. Both are in shards that touch nothing this pull changes (a concurrent-runs test that hit its 120 s timeout, and a deploy_pull retention test). I think they are flaky, but I haven't confirmed that. I pushed to the same branch.
- Why it failed: the map's pan-and-zoom-in-the-address code adds about 620 B gzip to
/map. With main merged in, the page came to 27448 B against a 26880 B ceiling. Main on its own measures 26825 B, so the overrun is this change's. - Fix: in
docs/design/size-budget.jsonI raised/map's JavaScript ceiling from 26880 to 28160. That is the only line changed.FORGE_SIZE_WRITE=1also tried to raise other pages' ceilings, which I reverted because they are not this change's growth. - Merge: I merged
origin/maininto the branch (128 commits). - Local checks:
test/client-size.test.tsandtest/map-view-address.test.tspass (10 tests).scripts/gate.tsandtsc --noEmitprinted nothing. - Not run: the full suite, and the concurrent-runs and retention tests specifically.
Looks: /map
Pan and zoom write the fragment and /map restores it, but keyboard Fit does not clear it, and the tests cannot see that.
Fix first: in the keydown handler (map.ts ~1373) setup(canvas, true) is followed by views[canvas.id].touched = true. remember() fires 200 ms later and reads v.touched at that moment, so pressing 0 writes #x=…&y=…&z=1.000 instead of clearing it. Box 3 fails for keyboard users. Fix: make the fragment decision when Fit is pressed, not when the timer fires (for example pass a clear flag to remember, or clear the address synchronously on refit), and keep touched = true for resize.
Second: the tests only check that strings occur in the shipped script (toContain('if (refit) remember(canvas)')), and that parseHash/hashOf round-trip. Nothing covers the centre conversion (v.x + cw/k/2, and the inverse on restore), the first-canvas-only rule, or Fit clearing. Extract the view-to-hash and hash-to-view conversion into a pure function in space_view.ts (or run the script against a minimal stub of location, history and document) and test the Fit case, which would have caught the bug above.
Third: the 200 ms timer is not cleared when the canvas is swapped out, and a swap can drop the first canvas. primary() re-queries on every call, so a stale write can land on another lane's view. Check views[canvas.id] still belongs to the primary canvas when the timer fires.
On design: no markup or CSS changed, so there is no layout shift and no new dependency. The size-budget raise is justified (about 620 B gzip). No TUI is needed, since the view is browser state. The fragment is plain numbers, so there is no escaping issue.
All three points are fixed and pushed.
- Keyboard Fit: Fit now clears the address at the moment it is pressed.
remember(canvas, true)cancels any pending write and clears the fragment on the spot, so the0key can no longer leave#x=…&y=…&z=1.000behind.touched = truestays for resize. - Stale timer: the timer now holds the canvas id. When it fires, it writes only if the first
.map-canvascurrently on the page still has that id, so a swapped-out canvas can't write onto another lane's view. - Tests: the conversion is now pure in
src/web/space_view.ts(viewAddressandviewFromAddress), shipped to the page as source likeparseHashandhashOf.test/map-view-address.test.tscovers four things:
- the centre conversion, including a canvas of a different size keeping the centre; - Fit clearing the address even when the view is marked touched; - the untouched and missing-view cases; - an address that names no view restoring none.
The first-canvas-only rule and the clear-on-Fit wiring are still checked only as strings in the shipped script. I did not build a stub of location, history and document, so the timer and the swap path are not run by any test.
test/map-view-address.test.ts and test/client-size.test.ts pass (14 tests), and the gate, tsc --noEmit and the design lint print nothing. I did not run the full suite. The /map size ceiling raised earlier still holds.
Looks: /map
Earlier asks are met: the 0-key Fit now clears the address at the keypress (remember(canvas,true)), the debounce timer writes only if the first canvas still has the captured id, and the conversion is pure in space_view.ts with unit tests. No markup or CSS changed, so there is no layout shift, and there is no new dependency. The size-budget bump for /map is justified (about 620 B gzip). I did not run the script in a browser. Next, in order: 1) Non-blocking: add a DOM-stub test so the timer, the swap path and the first-canvas rule are exercised rather than string-matched. 2) Non-blocking: give each lane on the global map its own address, or document that only the first canvas has one in docs/features.
The map now keeps its pan and zoom in the address fragment, so a reload or a shared link shows the same view. The new unit tests pass, along with
test/map-first-page.test.ts,test/design-map.test.ts,scripts/gate.ts,tscanddesign-lint. I did not try it in a browser.One test in
test/map-layout-budget.test.tsfails: "costs a few pairwise counts of its own card-to-card edges at most". It times out at 5 s on this machine. It fails the same way with my change stashed, so it is not caused by this pull.What changed (
src/web/pages/map.ts, newtest/map-view-address.test.ts)#x=…&y=…&z=…, debounced 200 ms, withhistory.replaceState, so no new history entries. Only the first canvas on the page does this. On the global map the other lanes keep their own views as before.parseHashandhashOffromsrc/web/space_view.ts, shipped as source the wayviewJsalready does.replaceState(neverpushState), including the Fit clear.Not done
&t=time parameter is ignored on the map.Looks: before/after is not attached; I took no screenshots. The only visible change is the address bar.
Try it: open
/map, pan or zoom, wait a moment, then reload and the view is the same. Press Fit and the fragment is gone. A link like/map#x=400&y=300&z=2opens at that view.Closes #12754