Smooth nav: build notes for view transitions (left out) and Back
Build note 61: cross-document view transitions were built and measured, then left out: Chromium drops clicks for the first ~50ms of every arrival and sometimes logs an uncaught InvalidStateError that gate 7 catches, for a 100ms crossfade that paint holding nearly gives already. Build note 62: the back/forward and landing audit.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+3
−1
docs/superpowers/specs/2026-11-14-mapa-level-up.md+3 −1
CI passed — run details
CI log
=== editor === cd editor && npm ci --no-audit --no-fund --loglevel=error added 16 packages in 649ms cd editor && node build-bundles.mjs wrote internal/mapa/static/editor.1fe02276881d1b28.js (300064 bytes, 93.7KB gzipped; L12 budget 120KB) cd editor && node --test ✔ L1: mounting then serialising gives cleanBody(body), byte for byte (39.755037ms) ℹ 758 bodies ✔ L1: mounting a stored body adds nothing, and saving it writes nothing new (57.150783ms) ✔ L2: one edited block changes only that block's bytes; undo gives the body back (135.60444ms) ℹ 746 single-block edits ✔ L2: inserting or deleting a block changes bytes only at the new seams, by Join (117.897508ms) ℹ 753 inserts, 713 deletes ✔ L3: seeded edits keep the document and its Markdown saying the same thing (3124.206848ms) ℹ 18192 edits over 758 bodies ✔ golden file has bodies (0.661115ms) ✔ markup.mjs parses every body into Go's blocks, byte offsets and all (12.125173ms) ✔ markup.mjs strips and spans every block as Go does (20.640007ms) ✔ the schema's toDOM draws every body as Go renders it (43.474748ms) ✔ emphasis draws the four pinned outputs (13.365791ms) ✔ a body ends in the editor's empty paragraph (0.281101ms) ✔ autosave sends only what differs, and the tab owns the draft it wrote (7.3895ms) ✔ an offered draft never commits by itself; Save commits it (0.741233ms) ✔ reload, then close: sessionStorage says the draft is this tab's own (0.379794ms) ✔ closing carries text not yet sent, and the cap leaves it out (15.759996ms) ✔ clean rebase: applied, the caret survives, the base moves by the rebase POST (3.003204ms) ✔ the block under the caret is the teammate's too, and undo brings back yours (2.204494ms) ✔ typing mid-flight: the merge is not applied and the base does not move (0.84778ms) ✔ a merge the editor cannot represent stops after three tries (2.743112ms) ✔ a conflict is shown, locks the editor's own commits, and Resolve settles it (0.972742ms) ✔ leaving: a conflict stays with the choice; a failed flush offers Leave anyway; a stored draft leaves (1.644868ms) ✔ a stale tab shows the newer draft, offered, and never overwrites it (0.82094ms) ✔ the first scratch commit: empty creates nothing, then one page, then drafts on it (0.801164ms) ✔ noBase and gone lead to the existing choices (0.7452ms) ✔ a commit that merged is applied when nothing was typed since (4.595864ms) ✔ back from the cache: nothing unsaved reloads, unsaved text autosaves at once (6.941739ms) ✔ an own draft committed meanwhile goes on as a new draft (0.985245ms) ✔ a reload keeps a stored draft; unsent text still commits (0.431409ms) ✔ marks: em outside strong, bold reopened around italics, edges outside (4.542686ms) ✔ marks close before code, links and atoms, and reopen after (0.35594ms) ✔ untouched blocks and atoms re-emit their source; edited atoms are written from attributes (5.050045ms) ✔ empty blocks are written as nothing (5.213217ms) ✔ an unclosed fence that is no longer last gets its closing fence (1.813689ms) ✔ the structure check puts Join's seam where a kept one would merge two blocks (2.179147ms) ✔ prepareSave adopts the parse when no seam or rewrite can save the document (4.15148ms) ✔ reparse: typed emphasis becomes a mark, "- " after a break becomes an item (1.807107ms) ✔ a trailing hard break stays on screen and is written as nothing (0.465242ms) ✔ the reparse waits while an IME is composing (0.54513ms) ✔ copied blocks paste with their bytes and seams; a cut and paste gives the body back (2.866561ms) ✔ a forged x-mapa slice is refused, and text from outside is read as Markdown (0.589803ms) ✔ rebuild changes origins only, outside undo history (1.204411ms) ✔ applyBody takes a teammate's block, keeps the caret, and ends untouched (0.969456ms) ℹ tests 42 ℹ suites 0 ℹ pass 42 ℹ fail 0 ℹ cancelled 0 ℹ skipped 0 ℹ todo 0 ℹ duration_ms 3595.241921 === vet === go vet ./... go vet -tags browser ./internal/mapatest/ === fmt === === code === go tool rastrillo budget code The base has no .rastrillo/code.txt: skipping the check that records only go down. budget code: within the limits. === test === CGO_ENABLED=0 go test ./... ? amadan.net/oficina/mapa/cmd/mapa [no test files] ok amadan.net/oficina/mapa/internal/mapa 0.555s ? amadan.net/oficina/mapa/internal/mapa/icons [no test files] ok amadan.net/oficina/mapa/internal/mapa/markup 0.057s ok amadan.net/oficina/mapa/internal/mapa/seal 0.002s ok amadan.net/oficina/mapa/internal/mapatest 8.594s ? amadan.net/oficina/mapa/scripts/mutate [no test files] ? amadan.net/oficina/mapa/scripts/preview [no test files] === migration-check === go tool rastrillo migration check rastrillo migration check: models and migrations agree === credits-check === python3 scripts/credits.py --check credits: checked
diff --git a/docs/superpowers/specs/2026-11-14-mapa-level-up.md b/docs/superpowers/specs/2026-11-14-mapa-level-up.md| index 08eb184..551e206 100644 |
| --- a/docs/superpowers/specs/2026-11-14-mapa-level-up.md |
| +++ b/docs/superpowers/specs/2026-11-14-mapa-level-up.md |
| @@ -1112,9 +1112,11 @@ Phase 1's choices where this spec was silent, or where the build chose different |
| **Smooth navigation** (Paul, 14 November: "clicking links should feel very smooth and solid"; §6.9): |
| -58. **A block link lands without a jump, and without script.** A block chip's address is `/p/{id}#b-…`, and the browser's own fragment scroll used to put the block at the window's top edge, under the 56px sticky bar, with nothing to say why the page had moved. Now `html` has `scroll-padding-block-start` of the bar plus 16px, so any in-page target (`#main`, a heading) clears the bar, and a block (`[id^="b-"]` in the page's body, so pages, days, scratch pages and History's versions alike) has a `scroll-margin-block-start` that puts its top 40% of the way down the view the bar leaves: 353px of a 1280×800 window, 389px of a 390×844 phone. 40% because a block starting there or above in the first screen (a page's title and its first few blocks, the usual target on Mapa's short pages) is not scrolled to at all, while a deep block still arrives in the upper part of the view, with what leads to it above and room for what follows; a page too short to scroll never moves. CSS cannot say "only if it is not already in view": a fragment always aligns the start, so a block starting between 40% and the first screen's foot is still moved up to 40%, by less than the screen. The block is tinted with the accent's soft fill, which holds and then fades over 1.8s; under `prefers-reduced-motion` it holds 1.5s and goes, without a fade. The tint is a box shadow (inset for the fill, spread 4px for its rim), so nothing is laid out again and a code block's own background stays under it. The editor draws the block anew as it mounts (here the server's `<ul>` is replaced before first paint); in Chromium and WebKit the new element does not match `:target` at `DOMContentLoaded`, but both match it again by the end of the load, and the tint's animation starts then, once (measured: one `mapa-arrive` animation, current time equal to the time since load). The gate (`TestABlockLinkLandsWithoutAJump`, `make browser`) clicks a chip to an early and a deep block at 1280×800 and 390×844, scripts off and on: the early one scrolls nothing, the deep one's top is within 2px of the 40% line, and both match `:target` and are tinted. Without the change it lands every block 0px under the bar's edge, which the gate catches. |
| +58. **A block link lands without a jump, and without script.** A block chip's address is `/p/{id}#b-…`, and the browser's own fragment scroll used to put the block at the window's top edge, under the 56px sticky bar, with nothing to say why the page had moved. Now `html` has `scroll-padding-block-start` of the bar plus 16px, so any in-page target (`#main`, a heading) clears the bar, and a block (`[id^="b-"]` in the page's body, so pages, days, scratch pages and History's versions alike) has a `scroll-margin-block-start` that puts its top 40% of the way down the view the bar leaves: 353px of a 1280×800 window, 389px of a 390×844 phone. 40% because a block starting there or above in the first screen (a page's title and its first few blocks, the usual target on Mapa's short pages) is not scrolled to at all, while a deep block still arrives in the upper part of the view, with what leads to it above and room for what follows; a page too short to scroll never moves. CSS cannot say "only if it is not already in view": a fragment always aligns the start, so a block starting between 40% and the first screen's foot is still moved up to 40%, by less than the screen. The block is tinted with the accent's soft fill, which holds and then fades over 1.8s; under `prefers-reduced-motion` it holds 1.5s and goes, without a fade. The tint is a box shadow (inset for the fill, spread 4px for its rim), so nothing is laid out again and a code block's own background stays under it. The editor draws the block anew as it mounts (here the server's `<ul>` is replaced before first paint); in Chromium and WebKit the new element does not match `:target` at `DOMContentLoaded`, but both match it again by the end of the load, and the tint's animation starts then, once (measured: one `mapa-arrive` animation, current time equal to the time since load). The gate (`TestABlockLinkLandsWithoutAJump`, `make browser`) clicks a chip to an early and a deep block at 1280×800 and 390×844, scripts off and on: the early one scrolls nothing, the deep one's top is within 2px of the 40% line, and both match `:target` and are tinted. Without the block's margin it fails: both blocks land 16px under the bar, from the padding alone. |
| 59. **No screen scrolls by a stray pixel.** `[mapa-sr]` (the visually hidden class) was absolutely positioned at its static place, so the editor's two live regions (the `[[` and `/` lists'), appended to `<body>`, hung 1px below the page's end and every page with the editor scrolled by that pixel (`scrollHeight` was the window's plus one). It is now pinned to its containing block's corner (`inset-block-start: 0; inset-inline-start: 0`), as well as clipped. The gate (`TestNoScreenScrollsByAStrayPixel`) loads a day, an unwritten day, a short page, its History, Scratch, New scratch page, Search with and without a query, Settings and All pages at 390, 800 and 1280px wide and 800px tall, scripts off and on (after the mount), and requires `scrollHeight` to be no more than the window or the body's own flow, whichever is taller: a short page cannot scroll at all. |
| 60. **A page is fetched when the pointer rests on its link.** Every shell page's response names Mapa's speculation ruleset in a `Speculation-Rules` header (`"/speculation-rules"`, served from `internal/mapa/speculation.json` as `application/speculationrules+json`, which a file under `/static/` would not be). It is one rule: prefetch, never prerender, so no script of the next page runs before it is opened; document links matching `/p/:page` or `/d/:day`; eagerness `moderate` (on a desktop about 200ms of hover, or pointer-down). No inline `<script type="speculationrules">`: the CSP refuses inline scripts, and a ruleset by header is not a script. Mapa's header replaces rastrillo's default one, whose prerender rules select rastrillo's own shell sidebar, which Mapa does not draw (build note 9), so it matched nothing. A prefetch is a GET, so it writes nothing (gate 10); `TestAPrefetchWritesNothing` sends `Sec-Purpose: prefetch` GETs for a page, two days and Today as a teammate who has never written, and no row changes, drafts and events included. Measured in Chromium: the page is answered from the prefetch (`deliveryType` is `navigational-prefetch`) although it is `Cache-Control: no-store`. One case would show a stale page: the editor commits the tab's text as it leaves (§6.5, build note 43), after the hover fetched the next page, so that page would not show the commit (its Recently edited, its Linked from). So while the tab holds text that leaving would commit, `editor/page.mjs` sets `<html data-mapa-uncommitted>`, the rule's `not selector_matches` stops matching, and Chromium evicts what it fetched (`PrefetchEvictedAfterCandidateRemoved`); the click then goes to the network after the commit. `TestHoveringALinkPrefetchesThePage` (`make browser`, a hovering mouse) checks both halves, and fails without the guard. Browsers without speculation rules (Safari, Firefox) ignore the header. |
| +61. **Cross-document view transitions were tried and left out.** `@view-transition { navigation: auto }` with the bar, the sidebar and the Links panel named, swapped in place with no animation, and only the page crossfading in 100ms (none under reduced motion) worked as designed in Chromium and Playwright's WebKit, with no measurable delay to first paint, the glass panel unchanged, and the frame's pixels the same mid-transition as after. But it cost two things the brief rules out. Chromium takes no input while a transition runs: a click 0 to 50ms after a page arrives was dropped every time (75ms and later landed), with `::view-transition { pointer-events: none }` too, and `TestAPostHoldsAndAViewSwitchDoesNot` failed on it. And when a navigation starts while the previous one's transition is still running, Chromium sometimes rejects the new page's transition with an uncaught `InvalidStateError: Transition was aborted because of invalid state. Page already revealed`, which no page script can catch (it is rejected after `pagereveal`, scripts off too), so gate 7's no-console-error walk with scripts off failed in 2 of 4 runs, and a loop of its first three steps in 1 of about 100. The race is in the browser, so a real person's console would show it too. What it would have added is small: a same-origin navigation already keeps the old frame on screen until the new page paints (paint holding), and a screencast of four navigations without transitions shows no blank or partial frame; the bar and the sidebar are the same pixels before and after. A same-document transition would need a client-side router, which is not Mapa's shape. Worth trying again when Chromium lets input through during a transition. |
| +62. **Back and forward, and where a move lands** (an audit, no change). Chromium (Chrome's back/forward cache for `Cache-Control: no-store` pages, measured with the cache enabled) restores a screen without the editor, such as All pages, from the back/forward cache: `pageshow` with `persisted` true and no request. `no-store` stays on every signed-in page, as it should. A page with the editor is restored too, and then reloads itself on purpose (`Saver.shown`, §6.5: with nothing unsaved, the page is loaded again, since a teammate or the commit made on leaving may have changed it). A screencast of going back to a long page scrolled 1500px down shows no blank frame: the restored page, then the reloaded one, the same pixels, still at 1500px. It costs a full load on every Back to an editor page; asking the server by GET whether the revision moved, and reloading only then, would make Back instant there, and is left as a follow-up. No script has an `unload` handler (estilo's busy.js adds a `beforeunload` only while a held POST is in flight, which does not stop the cache). Safari's back/forward cache was not checked: Playwright's WebKit restored nothing, for any page. Where a move lands: from a page scrolled 1200px down, a sidebar item, a Links-panel chip and a ⌘K result each open the next page at the top, and a day-strip day and the day pill's step do too, with `scrollY` 0 on every frame for 1.2s after load. New scratch page (1440 and 390 wide) and a new team page take the caret at mount (build note 57) and do not scroll: ProseMirror focuses with `preventScroll`. |
| ## 14. Findings and what changed |