BM1 rebased #819

Closed
kayg wants to merge 0 commits from train/bm1-rebased into dev
Owner

Rebases the BM1 train from #756 (source head 3685f29a) onto current dev, which was 6b37e9a8 when this rebase began. The branch also includes the clean current-dev merge at a55521f9. This supersedes #756.

Plan and complexity

  • Bundle and first-use loading: keep the main screen small; load split UI after first paint, warm a control when the person signals intent, cache resolved screens, and keep Undo toasts eager. The idle warm set is fixed-size (O(m) in the known lazy modules); the first-use path does not scan notes.
  • Phone cards: retain the frosted note card, shared list/card edges, and the approved phone geometry. This is CSS material and layout work per visible surface, with no new note traversal.
  • Trash and Undo: opening a trashed note reads it in a read-only preview with inert note links; Restore is an explicit action. Trash loading is O(n) over n entries, fetched in pages of 500. Bulk delete/restore is O(k) for k selected ids, in batches of at most six jobs concurrently. On partial failure, failed ids remain recoverable and the retry targets only those ids; successful jobs retain one Undo toast.
  • Settings durability: preserve raw settings values and recoverable exact-byte swaps. Work is bounded to the fixed settings paths and I/O proportional to the settings bytes (O(B)); ambiguous recovery stays read-only rather than overwriting data.

The Brotli bundle gate remains 240 KB first-paint JS and 315 KB total JS. Final measurement: 244,913 / 245,760 bytes first-paint and 318,911 / 322,560 bytes total, leaving 847 and 3,649 bytes of headroom.

Failure handling

Failure Effect Detection Recovery Test
A lazy UI chunk is unavailable during an offline or stale-cache load The requested split surface cannot open Chunk recovery hook and lazy-load browser specs Retry through the generated recovery URL after the chunk is available lazy-offline.spec.ts, lazy-ui.spec.ts, preload.spec.ts
Some Trash delete or restore jobs fail in a bulk action Only part of the selection changes Result jobs and a failure toast report the remaining count Keep failed ids in the original list/Trash and retry only them; successful jobs keep one Undo action trash.spec.ts, trash-search.spec.ts, toast-bar.spec.ts
A settings swap is interrupted or an outside edit conflicts with it A save may stop between file exchanges Exact base/save bytes and recovery intent are checked before reads Restore displaced bytes; leave unresolved state read-only without discarding data FSIO/prefs recovery tests in cargo test --workspace
Phone frost geometry differs between browser engines Card edges or controls can shift or clip Phone card, edge, and bar geometry specs Correct the shared CSS edge/gutter tokens; no stored data is involved Chromium and WebKit phone-card specs

Merge conflicts and resolutions

  1. apps/web/playwright.config.ts — combined BM1 Appearance projects with dev's sidebar-band projects and ignore rules; retained the shared binary fallback and removed the duplicate bin declaration.
  2. apps/web/src/components/ListSearch.svelte — kept dev's dense-glass treatment alongside BM1's list-search preload marker and read-only Trash result path.
  3. apps/web/src/components/PhoneStack.svelte — kept BM1's frosted card and Trash-preview behavior; retained dev's due-only InstallHint loading.
  4. apps/web/src/lib/editing.svelte.ts — kept dev's newBlockId behavior and restored BM1's look import.
  5. apps/web/src/lib/lazy-ui.svelte.ts — kept BM1's cached loaders and placed InstallHint outside generic idle warming.
  6. apps/web/src/lib/lazy.ts — honored BM1's deletion of this module; ported dev's due-only hint behavior to lazy-ui.svelte.ts and PhoneStack.svelte.
  7. crates/fsio/src/swap.rs — kept dev's displaced-file retention path and restored BM1's exact, recoverable settings swaps.

The later dev swipe-rows update at a55521f9 merged cleanly.

Verification on dev-01

Commands ran inside the VM's Nix dev shell through ~/bin/slot:

  • cargo fmt --all -- --check — passed.
  • cargo clippy --workspace --all-targets -j4 -- -D warnings — passed.
  • cargo test --workspace -j4 — 1,178 passed, 0 failed, 20 ignored.
  • cargo build -p calternal --bin calternal -j4 — passed.
  • bun run build plus scripts/bundle-size.mjs dist --json budget checks — passed at the byte counts above.
  • Targeted Playwright command, covering Trash, bulk Undo/toasts, phone cards, editing, and preload in Chromium and WebKit (four projects, one worker):
    export PATH=/nix/var/nix/profiles/default/bin:$PATH
    cd "$HOME/Developer/Worktrees/bm1-rebased"
    git fetch origin
    git checkout origin/infra/nix-devshell -- flake.nix flake.lock
    git restore --staged flake.nix flake.lock
    git add -N flake.nix flake.lock
    nix develop -c bash -c '
      set -e
      cd "$HOME/Developer/Worktrees/bm1-rebased"
      ~/bin/slot cargo build -p calternal --bin calternal -j4
      ~/bin/slot bun install --frozen-lockfile
      cd "$HOME/Developer/Worktrees/bm1-rebased/apps/web"
      CALTERNAL_BIN="$HOME/Developer/Worktrees/bm1-rebased/target/debug/calternal" ~/bin/slot bunx playwright test \
        e2e/trash.spec.ts e2e/trash-search.spec.ts e2e/trash-header-geometry.spec.ts \
        e2e/toast-bar.spec.ts e2e/phone-card-geometry.spec.ts e2e/phone-bars.spec.ts \
        e2e/phone-edges.spec.ts e2e/block-no-text-sel.spec.ts e2e/editor.spec.ts \
        e2e/preload.spec.ts \
        --project=chromium-1440 --project=chromium-390 \
        --project=webkit-1440 --project=webkit-390 --workers=1
    '
    
    Combined run: 929 passed, 806 skipped, 1 failed (45.0 min). The single failure was WebKit 1440, toast-bar.spec.ts test “a toast never breaks inside a word (375 px, light)”: it timed out waiting for the Note info dialog after the test's programmatic HTMLElement.click(). The original failure is unreproduced. Follow-ups passed: isolated 375 px WebKit light/dark (2 passed), full toast-bar.spec.ts in WebKit 1440 (8 passed, 1 skipped), and three repeated runs each of the 375 px light/dark cases (6 passed). No fix was made; the broad Playwright result retains one unresolved intermittent timeout.

Mac first-open evidence

The Mac measurement in the final #756 comment used the BM1 head 3685f29a; cold first-note p95s stayed within the Chromium/WebKit/Safari targets, including the blur-disabled comparison. Chromium with blur measured 338/569 ms (10k/100k notes), WebKit 247/367 ms, and Safari's p95 range was 436–2,549 ms. No pre-blurred fallback is needed. No new Mac measurement was run for this rebase.

Rebases the BM1 train from #756 (source head `3685f29a`) onto current `dev`, which was `6b37e9a8` when this rebase began. The branch also includes the clean current-`dev` merge at `a55521f9`. This supersedes #756. ## Plan and complexity - **Bundle and first-use loading:** keep the main screen small; load split UI after first paint, warm a control when the person signals intent, cache resolved screens, and keep Undo toasts eager. The idle warm set is fixed-size (O(m) in the known lazy modules); the first-use path does not scan notes. - **Phone cards:** retain the frosted note card, shared list/card edges, and the approved phone geometry. This is CSS material and layout work per visible surface, with no new note traversal. - **Trash and Undo:** opening a trashed note reads it in a read-only preview with inert note links; Restore is an explicit action. Trash loading is O(n) over n entries, fetched in pages of 500. Bulk delete/restore is O(k) for k selected ids, in batches of at most six jobs concurrently. On partial failure, failed ids remain recoverable and the retry targets only those ids; successful jobs retain one Undo toast. - **Settings durability:** preserve raw settings values and recoverable exact-byte swaps. Work is bounded to the fixed settings paths and I/O proportional to the settings bytes (O(B)); ambiguous recovery stays read-only rather than overwriting data. The Brotli bundle gate remains 240 KB first-paint JS and 315 KB total JS. Final measurement: **244,913 / 245,760 bytes first-paint** and **318,911 / 322,560 bytes total**, leaving 847 and 3,649 bytes of headroom. ## Failure handling | Failure | Effect | Detection | Recovery | Test | |---|---|---|---|---| | A lazy UI chunk is unavailable during an offline or stale-cache load | The requested split surface cannot open | Chunk recovery hook and lazy-load browser specs | Retry through the generated recovery URL after the chunk is available | `lazy-offline.spec.ts`, `lazy-ui.spec.ts`, `preload.spec.ts` | | Some Trash delete or restore jobs fail in a bulk action | Only part of the selection changes | Result jobs and a failure toast report the remaining count | Keep failed ids in the original list/Trash and retry only them; successful jobs keep one Undo action | `trash.spec.ts`, `trash-search.spec.ts`, `toast-bar.spec.ts` | | A settings swap is interrupted or an outside edit conflicts with it | A save may stop between file exchanges | Exact base/save bytes and recovery intent are checked before reads | Restore displaced bytes; leave unresolved state read-only without discarding data | FSIO/prefs recovery tests in `cargo test --workspace` | | Phone frost geometry differs between browser engines | Card edges or controls can shift or clip | Phone card, edge, and bar geometry specs | Correct the shared CSS edge/gutter tokens; no stored data is involved | Chromium and WebKit phone-card specs | ## Merge conflicts and resolutions 1. `apps/web/playwright.config.ts` — combined BM1 Appearance projects with dev's sidebar-band projects and ignore rules; retained the shared binary fallback and removed the duplicate `bin` declaration. 2. `apps/web/src/components/ListSearch.svelte` — kept dev's dense-glass treatment alongside BM1's list-search preload marker and read-only Trash result path. 3. `apps/web/src/components/PhoneStack.svelte` — kept BM1's frosted card and Trash-preview behavior; retained dev's due-only `InstallHint` loading. 4. `apps/web/src/lib/editing.svelte.ts` — kept dev's `newBlockId` behavior and restored BM1's `look` import. 5. `apps/web/src/lib/lazy-ui.svelte.ts` — kept BM1's cached loaders and placed `InstallHint` outside generic idle warming. 6. `apps/web/src/lib/lazy.ts` — honored BM1's deletion of this module; ported dev's due-only hint behavior to `lazy-ui.svelte.ts` and `PhoneStack.svelte`. 7. `crates/fsio/src/swap.rs` — kept dev's displaced-file retention path and restored BM1's exact, recoverable settings swaps. The later dev swipe-rows update at `a55521f9` merged cleanly. ## Verification on dev-01 Commands ran inside the VM's Nix dev shell through `~/bin/slot`: - `cargo fmt --all -- --check` — passed. - `cargo clippy --workspace --all-targets -j4 -- -D warnings` — passed. - `cargo test --workspace -j4` — 1,178 passed, 0 failed, 20 ignored. - `cargo build -p calternal --bin calternal -j4` — passed. - `bun run build` plus `scripts/bundle-size.mjs dist --json` budget checks — passed at the byte counts above. - Targeted Playwright command, covering Trash, bulk Undo/toasts, phone cards, editing, and preload in Chromium and WebKit (four projects, one worker): ```sh export PATH=/nix/var/nix/profiles/default/bin:$PATH cd "$HOME/Developer/Worktrees/bm1-rebased" git fetch origin git checkout origin/infra/nix-devshell -- flake.nix flake.lock git restore --staged flake.nix flake.lock git add -N flake.nix flake.lock nix develop -c bash -c ' set -e cd "$HOME/Developer/Worktrees/bm1-rebased" ~/bin/slot cargo build -p calternal --bin calternal -j4 ~/bin/slot bun install --frozen-lockfile cd "$HOME/Developer/Worktrees/bm1-rebased/apps/web" CALTERNAL_BIN="$HOME/Developer/Worktrees/bm1-rebased/target/debug/calternal" ~/bin/slot bunx playwright test \ e2e/trash.spec.ts e2e/trash-search.spec.ts e2e/trash-header-geometry.spec.ts \ e2e/toast-bar.spec.ts e2e/phone-card-geometry.spec.ts e2e/phone-bars.spec.ts \ e2e/phone-edges.spec.ts e2e/block-no-text-sel.spec.ts e2e/editor.spec.ts \ e2e/preload.spec.ts \ --project=chromium-1440 --project=chromium-390 \ --project=webkit-1440 --project=webkit-390 --workers=1 ' ``` Combined run: **929 passed, 806 skipped, 1 failed** (45.0 min). The single failure was WebKit 1440, toast-bar.spec.ts test “a toast never breaks inside a word (375 px, light)”: it timed out waiting for the Note info dialog after the test's programmatic HTMLElement.click(). The original failure is unreproduced. Follow-ups passed: isolated 375 px WebKit light/dark (2 passed), full toast-bar.spec.ts in WebKit 1440 (8 passed, 1 skipped), and three repeated runs each of the 375 px light/dark cases (6 passed). No fix was made; the broad Playwright result retains one unresolved intermittent timeout. ## Mac first-open evidence The Mac measurement in the final #756 comment used the BM1 head `3685f29a`; cold first-note p95s stayed within the Chromium/WebKit/Safari targets, including the blur-disabled comparison. Chromium with blur measured 338/569 ms (10k/100k notes), WebKit 247/367 ms, and Safari's p95 range was 436–2,549 ms. No pre-blurred fallback is needed. No new Mac measurement was run for this rebase.
kayg added 53 commits 2026-10-31 22:43:07 +00:00
The prefs store now writes users/<id>/.calternal/settings.json: a format version, then the settings sorted by name, with any other field a newer client or a hand edit added kept on every save. A home that only has prefs.json is read from it until its first change, which brings every old value across; the old file is never touched. A damaged file is still never overwritten.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U5oTUycqAh7DT72mdSUztk
- Account look (page see-through and frost, backdrop frost and dim) saved as ui.look.* and shown on the real backdrop, the preview and the notes that don't choose their own.
- Tick rows that open into sliders (the value and chevron are one tap target), under Backdrop | Page tabs with a live preview, one reset that becomes Undo.
- Drawn gradient and colour backdrops (art:<id>) that follow the accent; photos from Mountains, Unsplash (credited) and uploads in one grid.
- Every setting has a link (#/settings/<section>/<setting>) and a copy-link icon; Show settings file.
- Animations: strong ease-out, under 300 ms, origin-aware, press 0.97.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U5oTUycqAh7DT72mdSUztk
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U5oTUycqAh7DT72mdSUztk
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U5oTUycqAh7DT72mdSUztk
- Appearance: top-to-bottom on every width (no side-by-side); the phone keeps the preview and tabs fixed while the controls scroll under them; Backdrop & page is built only while Settings is on screen (no early fetches).
- 44 px targets: copy-link icons only on a long press on touch; reset and chevrons are not there when idle; larger Shuffle photos.
- The page defaults to a light frost (0.8); Show settings file removed.
- Prefs: a newer settings.json version is neither read nor rewritten, a rollback's prefs.json changes are merged, per-user lock and cache, damaged file reads as defaults and refuses saves.
- Tests: settings-fit (no clipped controls at 320/390/1440, scroll at once, sticky preview), solid-page pins where tests assumed solid.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U5oTUycqAh7DT72mdSUztk
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U5oTUycqAh7DT72mdSUztk
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U5oTUycqAh7DT72mdSUztk
Validate cached state against file contents, place saves only over their
expected bytes, and merge unrelated concurrent changes. Keep unknown JSON
values raw and classify malformed envelopes and directories consistently.
Add review reproductions and generated save/edit/rollback interleavings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U5oTUycqAh7DT72mdSUztk
Publish an intent with exact base and save bytes before exchanging settings.
Recover it before reads, restoring conflicting outside files and dropping
interrupted saves. Keep unresolved recovery read-only without discarding data.

Treat duplicate envelope and settings members as read-only, retain last-value
reads and preserve their original bytes. Cover both fixes with permanent
regressions, including a signalled child killed after exchange and a fresh
process restart.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U5oTUycqAh7DT72mdSUztk
On a phone the note fills the screen under bars painted in the page's own colour, so a see-through default page showed the picture under plain-paper bars (phone-edges, phone-bars). The default frost (0.8) now applies on wider windows; on a phone a frost you choose applies everywhere. block-no-text-sel pins its note solid: it checks that only the tint shows past the text, which needs a flat page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U5oTUycqAh7DT72mdSUztk
The phone's default page is the light frost again (no solid page on narrow screens). A full-width note on a phone is a card on the frosted backdrop as in the approved mockup (inset 10 pt, below the pills), with the glass edge and top strip the lists have, so the bars above it are the glass's colour and not paper. The strip and the glass under it now meet: the backdrop melts into the saturated edge colour (it melted into the raw one, a duller band), and the edge is the sky's top as the blur leaves it (the mockup's frostTop). Specs for phone edges, bars and safe areas follow the card model (as port/note's do).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Cj2Q1hCskP8Frsk6X7EHw
Cover Trash Restore and Undo on desktop and phone
Some checks failed
CI / web (pull_request) Failing after 48s
CI / server (pull_request) Successful in 1m6s
CI / rust (pull_request) Successful in 11m46s
39bc79b4f0
The Trash preview now draws the note with the note editor in preview mode (the H1 is the title, once) in the note pane / pushed phone screen, with a quiet In Trash line, a Back pill and an accent Restore pill. Escape closes it. Sonner toasts stack apart (expand) and a new bar toast takes the place of the one showing.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Cj2Q1hCskP8Frsk6X7EHw
The bottom of every phone list and card note is now the mockup's Frost: the baked sky carries its ridges (the picture's foot, blurred
as the mockup blurs it, no clouds or glow in the frost), and the old bottom fade into the top's colour is gone. One strip behind Safari's
toolbar (PhoneStack `.strip.bottom`, `--edge-bottom-shown` in base.css, `--edge-glass-bottom` worked out once in theme.svelte.ts from
glass-edge.ts `bottomKey`) serves the lists and the note card; a photo's foot is sampled from the photo. The top ramp is the mockup's
(solid strip, eased over 64 px). Glass tokens follow the mockup at look v2, light and dark (frost blur/saturation, floating glass, photo
backdrop); the pane tint and the deeper dark dim keep their reasons (contrast gate, #660).

Also: the two filter transitions the filter-motion lint flagged (Backdrop, ArtStack) now ease scale only. phone-edges, phone-bars and
opacity specs follow the new bottom strip.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Cj2Q1hCskP8Frsk6X7EHw
Header is the list screens row (round chevron, quiet line, accent Restore). Plain keys no longer reach app shortcuts. A new toast replaces the one showing in the bar and in the stack; a replaced Sonner toast is cut at once. Toast glass is dense.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Cj2Q1hCskP8Frsk6X7EHw
- The top pills' round button (`.round`, TopPills) is one column the button's width, as the mockup's. With an auto column the hidden
  "Select all" face made the column wider than the button and centred the chevron about 11 pt right of the button's middle.
- The phone card's text gutter is one set of values on `.card .note-body` (PhoneStack): --card-gutter-start 40, --card-gutter-end 18
  (the mockup's paper: 40 left, 18 right) and --card-gutter-top 31.5, used by the title and the body alike (both are lines of one column).
- The phone list's title starts 66 pt under the safe area, as the mockup's (was 64).
- e2e/phone-card-geometry.spec.ts holds the invariants (chevron and dots centred, gutters, title gap) on chromium-390 and webkit-390.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Cj2Q1hCskP8Frsk6X7EHw
perf: make room under unchanged JS budgets
Some checks failed
CI / server (pull_request) Successful in 1m18s
CI / rust (pull_request) Failing after 3m54s
CI / web (pull_request) Failing after 2h38m29s
150ec3758d
perf: keep notifications eager and warm note sheets on open
Some checks failed
CI / server (pull_request) Successful in 55s
CI / rust (pull_request) Successful in 20m34s
CI / web (pull_request) Has been cancelled
49207e1c77
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Cj2Q1hCskP8Frsk6X7EHw
Prioritize each control's own preload on intent
Some checks failed
CI / server (pull_request) Successful in 1m32s
CI / rust (pull_request) Successful in 14m29s
CI / web (pull_request) Has been cancelled
8e1ae65092
Prepare Palette on keyboard intent before first use
Some checks failed
CI / server (pull_request) Successful in 1m21s
CI / rust (pull_request) Failing after 3m16s
CI / web (pull_request) Has been cancelled
c760aa00f7
Align train browser checks with shared UI and stable fixtures
Some checks failed
CI / server (pull_request) Successful in 2m6s
CI / rust (pull_request) Successful in 27m49s
CI / web (pull_request) Failing after 51s
040074a3be
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Cj2Q1hCskP8Frsk6X7EHw
Settings can render before the inactive phone stack mounts on idle.
Wait for its paper edge before settling animations so bottom pixels
are sampled after the floor fade. Keep the existing pixel bounds.
Preserve dev's note-save retention and phone install-hint loading while restoring BM1's exact settings swap, lazy surfaces, phone cards, Trash preview and bulk Undo.
Merge remote-tracking branch 'origin/dev' into train/bm1-rebased
Some checks failed
CI / server (pull_request) Has been cancelled
CI / rust (pull_request) Has been cancelled
CI / web (pull_request) Has been cancelled
6e5d96f9bc
Author
Owner

Independent review: conflict resolutions

Verdict: approve within the conflict-resolution scope at 6e5d96f9bc6e56cc5f1bef2753e6de9ad0a7ab6a. Both sides’ intent survives in all seven resolutions. No P0–P3 findings in this scope.

Conflict Status Both sides checked
apps/web/playwright.config.ts ok BM1’s four Appearance projects and backdrop-page exclusion coexist with dev’s two serial QUIET sidebar-band projects, exclusions and throttled dependencies. One bin declaration remains; dev’s shared calternalBinary(env) propagates the fallback to isolated fixtures and preserves remote mode.
apps/web/src/components/ListSearch.svelte ok Dev’s dense Glass, shared radius and glass accent remain. BM1’s preload marker and openTrashed(t) read-only result path remain; no restore-on-open call survives.
apps/web/src/components/PhoneStack.svelte ok BM1’s frosted card geometry, edge/strip state, Trash preview and dock hiding remain. Dev’s hint loads only when hintVisible() becomes true, then renders the cached component. Its eager import and old loader call are gone.
apps/web/src/lib/editing.svelte.ts ok Dev’s newBlockId() and visibleText() block-link behavior remain alongside BM1’s look defaults and exports used by split commands. Both imports are used.
apps/web/src/lib/lazy-ui.svelte.ts ok BM1’s reactive resolved-component cache, single pending promise, failure recovery and intent warming remain. The new InstallHint loader is deliberately absent from resources, so generic idle/intent warming does not fetch it.
apps/web/src/lib/lazy.ts ok BM1’s deletion stands; no old loader imports/calls remain in web source. Dev’s only added loader, InstallHint, is ported to the cached loader and PhoneStack; 16bdbfc2 also adds its recovery URL rewrite.
crates/fsio/src/swap.rs ok Dev’s displaced-inode retention implementation remains unchanged. BM1’s exact-byte/missing-destination checks, durable intent and recovery remain on the ordinary put path. Actual callers remain separate: note saves use retention plus place; settings use place_exact_recoverable without retention.

Comparison evidence:

  • git range-diff d83e54db..3685f29a 6b37e9a8..6e5d96f9: all 39 original BM1 commits match unchanged. This is a merge-based integration; range-diff omits its merge resolution, so I also inspected git show --remerge-diff 9215b7dc, both parents’ changes in these files, and the three integration follow-ups. The final dev merge has an empty remerge diff.
  • Dev changes checked against their originating hunks include d7660f4f (sidebar isolation), 09982195 (binary resolver), 04a69711/c40cf0e9 (search glass), a4514d4a (due-only hint), 93ed3fa5 (block identity/visible text), and 02c762ac (retained files).

Bundle check: no accidental duplicate module/import found in these resolutions. InstallHint has one dynamic source import and remains its own emitted chunk. The additional eager @calternal/ui/lib/keyboard.svelte import resolves to the same module used by Composer/ContextMenu, moving the shared detector into the entry graph rather than copying it; the similarly named app module handles viewport/phone keyboard layout and is different code. Reading the existing dev-01 build at this exact HEAD confirms that HTML requests only index-CgS2qSoq.js, which has no static JS imports, and its .br file is 244,913 bytes. Emitted non-Vim JS totals 318,911 bytes, matching the description. First paint is 25 bytes smaller than #756’s final recorded 244,938 bytes. The 847-byte headroom remains tight, but is not a new defect.

Validation limits: source/history review and read-only inspection of the existing VM build/log; no new builds or tests, no code changes or pushes. This verdict does not expand to the original BM1 changes or waive the description’s unresolved intermittent WebKit timeout.

## Independent review: conflict resolutions Verdict: **approve within the conflict-resolution scope** at `6e5d96f9bc6e56cc5f1bef2753e6de9ad0a7ab6a`. Both sides’ intent survives in all seven resolutions. No P0–P3 findings in this scope. | Conflict | Status | Both sides checked | |---|---|---| | `apps/web/playwright.config.ts` | ok | BM1’s four Appearance projects and backdrop-page exclusion coexist with dev’s two serial QUIET sidebar-band projects, exclusions and throttled dependencies. One `bin` declaration remains; dev’s shared `calternalBinary(env)` propagates the fallback to isolated fixtures and preserves remote mode. | | `apps/web/src/components/ListSearch.svelte` | ok | Dev’s dense Glass, shared radius and glass accent remain. BM1’s preload marker and `openTrashed(t)` read-only result path remain; no restore-on-open call survives. | | `apps/web/src/components/PhoneStack.svelte` | ok | BM1’s frosted card geometry, edge/strip state, Trash preview and dock hiding remain. Dev’s hint loads only when `hintVisible()` becomes true, then renders the cached component. Its eager import and old loader call are gone. | | `apps/web/src/lib/editing.svelte.ts` | ok | Dev’s `newBlockId()` and `visibleText()` block-link behavior remain alongside BM1’s `look` defaults and exports used by split commands. Both imports are used. | | `apps/web/src/lib/lazy-ui.svelte.ts` | ok | BM1’s reactive resolved-component cache, single pending promise, failure recovery and intent warming remain. The new InstallHint loader is deliberately absent from `resources`, so generic idle/intent warming does not fetch it. | | `apps/web/src/lib/lazy.ts` | ok | BM1’s deletion stands; no old loader imports/calls remain in web source. Dev’s only added loader, InstallHint, is ported to the cached loader and PhoneStack; `16bdbfc2` also adds its recovery URL rewrite. | | `crates/fsio/src/swap.rs` | ok | Dev’s displaced-inode retention implementation remains unchanged. BM1’s exact-byte/missing-destination checks, durable intent and recovery remain on the ordinary `put` path. Actual callers remain separate: note saves use retention plus `place`; settings use `place_exact_recoverable` without retention. | Comparison evidence: - `git range-diff d83e54db..3685f29a 6b37e9a8..6e5d96f9`: all 39 original BM1 commits match unchanged. This is a merge-based integration; range-diff omits its merge resolution, so I also inspected `git show --remerge-diff 9215b7dc`, both parents’ changes in these files, and the three integration follow-ups. The final dev merge has an empty remerge diff. - Dev changes checked against their originating hunks include `d7660f4f` (sidebar isolation), `09982195` (binary resolver), `04a69711`/`c40cf0e9` (search glass), `a4514d4a` (due-only hint), `93ed3fa5` (block identity/visible text), and `02c762ac` (retained files). Bundle check: no accidental duplicate module/import found in these resolutions. InstallHint has one dynamic source import and remains its own emitted chunk. The additional eager `@calternal/ui/lib/keyboard.svelte` import resolves to the same module used by Composer/ContextMenu, moving the shared detector into the entry graph rather than copying it; the similarly named app module handles viewport/phone keyboard layout and is different code. Reading the existing dev-01 build at this exact HEAD confirms that HTML requests only `index-CgS2qSoq.js`, which has no static JS imports, and its `.br` file is **244,913 bytes**. Emitted non-Vim JS totals **318,911 bytes**, matching the description. First paint is 25 bytes smaller than #756’s final recorded 244,938 bytes. The 847-byte headroom remains tight, but is not a new defect. Validation limits: source/history review and read-only inspection of the existing VM build/log; no new builds or tests, no code changes or pushes. This verdict does not expand to the original BM1 changes or waive the description’s unresolved intermittent WebKit timeout.
Author
Owner

Flake fix: WebKit 1440, toast spec, 375 px light (Note info dialog never ready)

Cause. The Note info sheet's content comes from the lazy idle-screens chunk. One failed fetch of that chunk leaves the sheet open and empty for good: lazy() keeps the failed import until a fresh document, and recovery only ran when the tab became visible again. Reproduced on demand by aborting that one request: the dialog appears but "Delete" never does, the same signature as the failed run. The original failure came from a 45 min broad run; I could not reproduce it by load alone (30x on dev-01 under CPU load: 30 passed; 120 cases on dev-02 with the CPU throttled: 120 passed), so the exact trigger of the dropped fetch there is inferred, not proven.

Fix (added commits on train/bm1-rebased, no rewrite): a sheet that was asked for and failed to load now takes fresh chunk URLs at once (recoverChunks() in pwa.svelte.ts, used by Sheet.svelte), once per 15 s and only when nothing is unsaved. The existing tab-visible/online recovery uses the same function. New test e2e/lazy-sheet-recovery.spec.ts aborts the chunk once and expects the sheet to fill. No timeouts or retries changed.

Open risk. In Chromium, the same injected failure still leaves the sheet empty after the reload (JS chunk is not requested again). Not the browser that flaked and not a regression, so the new test is WebKit-only. Needs a follow-up.

Gates (head 1b5ce153, webkit-1440, 0 failures):

  • dev-01 (x86_64): cd apps/web && CALTERNAL_BIN=<wt>/target/debug/calternal ~/bin/slot bunx playwright test e2e/toast-bar.spec.ts e2e/lazy-sheet-recovery.spec.ts --project=webkit-1440 --workers=1 --repeat-each=30 --reporter=line -> 270 passed, 30 skipped (the phone-only toast case skips at 1440), 29.5 min.
  • dev-02 (aarch64): same command -> 270 passed, 30 skipped, 11.7 min.
  • Both inside nix develop -c.

🤖 Generated with Claude Code

**Flake fix: WebKit 1440, toast spec, 375 px light (Note info dialog never ready)** **Cause.** The Note info sheet's content comes from the lazy `idle-screens` chunk. One failed fetch of that chunk leaves the sheet open and empty for good: `lazy()` keeps the failed import until a fresh document, and recovery only ran when the tab became visible again. Reproduced on demand by aborting that one request: the dialog appears but "Delete" never does, the same signature as the failed run. The original failure came from a 45 min broad run; I could not reproduce it by load alone (30x on dev-01 under CPU load: 30 passed; 120 cases on dev-02 with the CPU throttled: 120 passed), so the exact trigger of the dropped fetch there is inferred, not proven. **Fix** (added commits on `train/bm1-rebased`, no rewrite): a sheet that was asked for and failed to load now takes fresh chunk URLs at once (`recoverChunks()` in `pwa.svelte.ts`, used by `Sheet.svelte`), once per 15 s and only when nothing is unsaved. The existing tab-visible/online recovery uses the same function. New test `e2e/lazy-sheet-recovery.spec.ts` aborts the chunk once and expects the sheet to fill. No timeouts or retries changed. **Open risk.** In Chromium, the same injected failure still leaves the sheet empty after the reload (JS chunk is not requested again). Not the browser that flaked and not a regression, so the new test is WebKit-only. Needs a follow-up. **Gates** (head `1b5ce153`, `webkit-1440`, 0 failures): - dev-01 (x86_64): `cd apps/web && CALTERNAL_BIN=<wt>/target/debug/calternal ~/bin/slot bunx playwright test e2e/toast-bar.spec.ts e2e/lazy-sheet-recovery.spec.ts --project=webkit-1440 --workers=1 --repeat-each=30 --reporter=line` -> 270 passed, 30 skipped (the phone-only toast case skips at 1440), 29.5 min. - dev-02 (aarch64): same command -> 270 passed, 30 skipped, 11.7 min. - Both inside `nix develop -c`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Owner

Lazy sheet chunk: retry in place instead of reloading the page

Mechanism. The page reload (recoverChunks()) is gone; pwa.svelte.ts is back to dev's. lazy() in lazy-ui.svelte.ts now loads through fetchChunk() (chunk-retry.ts): on failure it waits 250/500/750 ms and tries again, up to 3 more times. Each retry sets the existing calternal.chunk-retry key while the import runs, so the build's URL rewrite (lazy-ui-plugin.ts) adds ?retry=<time> to that chunk's URL, which gets round both browsers' cached failed fetch. Finding on the way: Vite's preload helper marks a stylesheet whose load failed as handled and never asks for it again, so the retry also drops the failed <link> and adds a fresh one (with ?retry=) and waits for it. vite:preloadError is not needed. A failed load is no longer cached, so the next open tries again. While it retries the sheet shows what it always showed before its chunk arrives (no empty content, no error UI). If every try fails, Sheet.svelte closes the sheet quietly.

Tests. e2e/lazy-sheet-recovery.spec.ts runs in webkit-1440 and chromium-1440 (no skip): abort once -> sheet fills; abort every try -> sheet closes and the note still takes typing. lazy-ui.spec.ts "idle warming recovers" now expects an in-place recovery (page never reloads, stylesheets applied).

Gates (dev-01, inside nix develop -c, one run at a time; head ff002213):

  • cd apps/web && CALTERNAL_BIN=<wt>/target/debug/calternal ~/bin/slot bunx playwright test e2e/toast-bar.spec.ts e2e/lazy-sheet-recovery.spec.ts --project=chromium-1440 --workers=1 --repeat-each=30 -> 300 passed, 30 skipped (phone-only case), 0 failed.
  • same with --project=webkit-1440 -> 300 passed, 30 skipped, 0 failed.
  • lazy-ui, lazy-sheet-recovery, lazy-offline, lazy-styled, preload specs on both projects once: 47 passed, 7 skipped.
  • Note: my first 30x runs ran both browsers at once in one checkout; they clobbered each other's test-results (ENOENT on trace files, not test failures), so I discarded them and re-ran serially.

Bundle (bun run build, node scripts/bundle-size.mjs, perf/web.sh --bundle-only --gate -> exit 0): first-paint JS brotli 245,044 bytes (239.3 KB; budget 240 KB = 245,760, so ~716 bytes headroom left); raw 871,296; gzip 289,086. First-paint CSS brotli 21,324 bytes (20.8 KB; budget 22.1). All-JS brotli 311.6 KB.

🤖 Generated with Claude Code

**Lazy sheet chunk: retry in place instead of reloading the page** **Mechanism.** The page reload (`recoverChunks()`) is gone; `pwa.svelte.ts` is back to `dev`'s. `lazy()` in `lazy-ui.svelte.ts` now loads through `fetchChunk()` (`chunk-retry.ts`): on failure it waits 250/500/750 ms and tries again, up to 3 more times. Each retry sets the existing `calternal.chunk-retry` key while the import runs, so the build's URL rewrite (`lazy-ui-plugin.ts`) adds `?retry=<time>` to that chunk's URL, which gets round both browsers' cached failed fetch. Finding on the way: Vite's preload helper marks a stylesheet whose load failed as handled and never asks for it again, so the retry also drops the failed `<link>` and adds a fresh one (with `?retry=`) and waits for it. `vite:preloadError` is not needed. A failed load is no longer cached, so the next open tries again. While it retries the sheet shows what it always showed before its chunk arrives (no empty content, no error UI). If every try fails, `Sheet.svelte` closes the sheet quietly. **Tests.** `e2e/lazy-sheet-recovery.spec.ts` runs in webkit-1440 and chromium-1440 (no skip): abort once -> sheet fills; abort every try -> sheet closes and the note still takes typing. `lazy-ui.spec.ts` "idle warming recovers" now expects an in-place recovery (page never reloads, stylesheets applied). **Gates** (dev-01, inside `nix develop -c`, one run at a time; head `ff002213`): - `cd apps/web && CALTERNAL_BIN=<wt>/target/debug/calternal ~/bin/slot bunx playwright test e2e/toast-bar.spec.ts e2e/lazy-sheet-recovery.spec.ts --project=chromium-1440 --workers=1 --repeat-each=30` -> 300 passed, 30 skipped (phone-only case), 0 failed. - same with `--project=webkit-1440` -> 300 passed, 30 skipped, 0 failed. - `lazy-ui`, `lazy-sheet-recovery`, `lazy-offline`, `lazy-styled`, `preload` specs on both projects once: 47 passed, 7 skipped. - Note: my first 30x runs ran both browsers at once in one checkout; they clobbered each other's `test-results` (ENOENT on trace files, not test failures), so I discarded them and re-ran serially. **Bundle** (`bun run build`, `node scripts/bundle-size.mjs`, `perf/web.sh --bundle-only --gate` -> exit 0): first-paint JS brotli 245,044 bytes (239.3 KB; budget 240 KB = 245,760, so ~716 bytes headroom left); raw 871,296; gzip 289,086. First-paint CSS brotli 21,324 bytes (20.8 KB; budget 22.1). All-JS brotli 311.6 KB. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Owner

Independent review: chunk retry (head ff002213, read-only review from the diff, nothing built or run here)

Verdict: approve with fixes: P1 first, then merge. The mechanism is sound for the one-sheet case the tests cover. The shared sessionStorage key is the weak spot.

P1: the retry key is one global slot shared by every concurrent import (chunk-retry.ts:33-35, lazy-ui-plugin.ts:9)

  • All the lazy() entries that use the idle-screens chunk (Settings, Inspector, InsertSheet, InfoSheet, NotePicker and others) share one file. warmUI() starts them all at once. If that fetch fails, every entry fails together and retries together.
  • Each retry does setItem(Date.now()-attempt), so the first one to settle runs removeItem in its finally. A sibling whose import thunk hasn't run yet (it still waits on askCssAgain or Vite's preload) then reads no key and imports the plain URL. That URL is the browser's cached failure, so it burns a try for nothing.
  • Entries that set different values (different ms) load idle-screens-X.js?retry=A and ?retry=B. That is two module instances of the same chunk, and its components and move-to-note are evaluated twice.
  • Shared state (notes.svelte, editing, and so on) lives in separate chunks that are imported statically, so it stays single. The damage is limited to module-level state inside idle-screens. I found no such state, but nothing stops it from appearing later.
  • Fix: share one in-flight retry per chunk, e.g. a module-level retryStamp plus a counter of retries in flight. Set the key when the counter goes 0→1, clear it when it goes back to 0, and use the same stamp for all concurrent retries. Or add the stamp to the thunk: the plugin could emit import(retryURL(path, stamp)) with the stamp read synchronously.
  • Add a test with two sheets failing at once, e.g. Info and Style opened back to back with the route aborting once. Assert both fill and the chunk URL set has at most one ?retry= value.

P2: a reload during a retry leaves the key set for the rest of the tab. sessionStorage survives reload. Every later lazy import then gets the stale ?retry=. It is harmless (the URL is stable and the SW ignores the query) but it makes the plain URL unreachable and defeats the "one module copy" assumption. Clear the key once at startup, in lazy-ui module init (a one-line removeItem).

P2: quiet close has no feedback (TASTE 7). A tap that opens a blank panel for ≥1.5 s (250+500+750 ms plus fetch time) and then vanishes tells the user nothing. TASTE allows "Retry" toasts "when there is something to do". I'd either show one calm line, or at least log it, so a lost tap isn't confusing. Minimum: keep it quiet if you want, but record it, because chunkLoadFailed() only feeds the reload-on-return check in pwa.svelte.ts:72.

P2: no retry when sessionStorage throws (private mode or storage blocked). setItem is swallowed, so the retry reuses the plain URL and the cached failure. All tries fail and the sheet closes. Use a module-level variable as the fallback; the plugin snippet could read globalThis.__chunkRetry instead of sessionStorage, which also fixes the P2 above.

P3: the 17 rewrites each inline the full retryURL arrow function (~170 B raw ×17) in code that is on first paint. Brotli repeats compress well, but this is the biggest controllable cost against the ~716 B headroom. Emit it once as a shared helper and call it at each site. Do this before adding anything else to first paint.

P3: failure storm. warmUI() plus failure means 14 entries × 4 tries each, all with .catch(() => {}). It is bounded, but it is a burst of requests on an already failing network. Stagger or share one retry per underlying chunk (the P1 fix does this).

Checked and fine

  • Closed during retry / retry after close: the open flag in Sheet.svelte guards ctx.close(), the effect cleanup flips it on every k change, pending is cleared on failure, and a late success only fills component for the next open. A user who closes sheet A and opens B while A's retry runs doesn't get B closed.
  • Module identity for a single retry: only the idle-screens chunk and the other rewritten chunks get a second URL. Shared stores are in other chunks, so they stay singletons. See P1 for the concurrent case.
  • Offline/PWA: sw/sw.js serves non-navigation requests with caches.match(req, { ignoreSearch: true, ignoreVary: true }), so ?retry= hits the precache and works offline. A cache miss falls through to the network, as before. The fresh stylesheet <link ?retry=> gets the same treatment.
  • Bundle: chunk-retry.ts has to stay in first paint, because a lazy retry loader would itself need a network fetch to rescue a failed fetch. Only the repeated snippet (P3) can shrink.
  • Retry count: TRIES=3 gives 4 attempts with 250/500/750 ms waits, matching the status comment.

🤖 Generated with Claude Code

**Independent review: chunk retry** (head `ff002213`, read-only review from the diff, nothing built or run here) **Verdict: approve with fixes: P1 first, then merge.** The mechanism is sound for the one-sheet case the tests cover. The shared sessionStorage key is the weak spot. **P1: the retry key is one global slot shared by every concurrent import** (`chunk-retry.ts:33-35`, `lazy-ui-plugin.ts:9`) - All the `lazy()` entries that use the `idle-screens` chunk (Settings, Inspector, InsertSheet, InfoSheet, NotePicker and others) share one file. `warmUI()` starts them all at once. If that fetch fails, every entry fails together and retries together. - Each retry does `setItem(Date.now()-attempt)`, so the first one to settle runs `removeItem` in its `finally`. A sibling whose import thunk hasn't run yet (it still waits on `askCssAgain` or Vite's preload) then reads no key and imports the plain URL. That URL is the browser's cached failure, so it burns a try for nothing. - Entries that set different values (different ms) load `idle-screens-X.js?retry=A` and `?retry=B`. That is two module instances of the same chunk, and its components and `move-to-note` are evaluated twice. - Shared state (`notes.svelte`, `editing`, and so on) lives in separate chunks that are imported statically, so it stays single. The damage is limited to module-level state inside `idle-screens`. I found no such state, but nothing stops it from appearing later. - Fix: share one in-flight retry per chunk, e.g. a module-level `retryStamp` plus a counter of retries in flight. Set the key when the counter goes 0→1, clear it when it goes back to 0, and use the same stamp for all concurrent retries. Or add the stamp to the thunk: the plugin could emit `import(retryURL(path, stamp))` with the stamp read synchronously. - Add a test with two sheets failing at once, e.g. Info and Style opened back to back with the route aborting once. Assert both fill and the chunk URL set has at most one `?retry=` value. **P2: a reload during a retry leaves the key set for the rest of the tab.** `sessionStorage` survives reload. Every later lazy import then gets the stale `?retry=`. It is harmless (the URL is stable and the SW ignores the query) but it makes the plain URL unreachable and defeats the "one module copy" assumption. Clear the key once at startup, in `lazy-ui` module init (a one-line `removeItem`). **P2: quiet close has no feedback** (TASTE 7). A tap that opens a blank panel for ≥1.5 s (250+500+750 ms plus fetch time) and then vanishes tells the user nothing. TASTE allows "Retry" toasts "when there is something to do". I'd either show one calm line, or at least log it, so a lost tap isn't confusing. Minimum: keep it quiet if you want, but record it, because `chunkLoadFailed()` only feeds the reload-on-return check in `pwa.svelte.ts:72`. **P2: no retry when sessionStorage throws** (private mode or storage blocked). `setItem` is swallowed, so the retry reuses the plain URL and the cached failure. All tries fail and the sheet closes. Use a module-level variable as the fallback; the plugin snippet could read `globalThis.__chunkRetry` instead of sessionStorage, which also fixes the P2 above. **P3: the 17 rewrites each inline the full `retryURL` arrow function** (~170 B raw ×17) in code that is on first paint. Brotli repeats compress well, but this is the biggest controllable cost against the ~716 B headroom. Emit it once as a shared helper and call it at each site. Do this before adding anything else to first paint. **P3: failure storm.** `warmUI()` plus failure means 14 entries × 4 tries each, all with `.catch(() => {})`. It is bounded, but it is a burst of requests on an already failing network. Stagger or share one retry per underlying chunk (the P1 fix does this). **Checked and fine** - *Closed during retry / retry after close*: the `open` flag in `Sheet.svelte` guards `ctx.close()`, the effect cleanup flips it on every `k` change, `pending` is cleared on failure, and a late success only fills `component` for the next open. A user who closes sheet A and opens B while A's retry runs doesn't get B closed. - *Module identity for a single retry*: only the `idle-screens` chunk and the other rewritten chunks get a second URL. Shared stores are in other chunks, so they stay singletons. See P1 for the concurrent case. - *Offline/PWA*: `sw/sw.js` serves non-navigation requests with `caches.match(req, { ignoreSearch: true, ignoreVary: true })`, so `?retry=` hits the precache and works offline. A cache miss falls through to the network, as before. The fresh stylesheet `<link ?retry=>` gets the same treatment. - *Bundle*: `chunk-retry.ts` has to stay in first paint, because a lazy retry loader would itself need a network fetch to rescue a failed fetch. Only the repeated snippet (P3) can shrink. - *Retry count*: `TRIES=3` gives 4 attempts with 250/500/750 ms waits, matching the status comment. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Owner

Chunk retry: review fixes (head 1ef61536)

Changes

  1. P1 + both P2s (one change). The sessionStorage key is gone. chunk-retry.ts keeps a Map chunk -> stamp in memory. The first importer to fail on a chunk's URL makes a new stamp; anyone failing together with it reuses it, so concurrent importers share one ?retry= URL and one copy of the chunk. The build's rewrite calls one shared helper, __cr(path), which reads the map. Nothing outlives a reload and storage errors no longer matter. New test screens that fail together retry on one new URL...: idle warming fails every screen, online makes them all retry at once, and exactly one ?retry= URL is requested (the sheet then fills).
  2. P3 bundle. The 17 inline snippets are now import(__cr("./x.js")).
  3. P3 warm-up. lazy(chunk, load): load() is one try with no backoff; only load(true) (sheets, startup screen) retries. Screens whose load failed are retried in place on online / tab-visible. This replaced the old reload in pwa.svelte.ts (removed, with chunkLoadFailed). The startup hold on a failed sign-in/trash screen is now reactive (startup.blocked) and clears when it loads, instead of a reload.
  4. P2 TASTE 7 ("errors are one calm line that fades in"). A sheet still blank after 1.5 s shows "Still loading…"; if it cannot load at all it shows "Couldn't open this. Try again in a moment." for 1.5 s, then closes. Same 13 px --ink-2 text and 240 ms fade as the sign-in error line. No toast.

Also fixed on the way: a screen asked for again after a failure now starts on the new URL and swaps its failed stylesheet (Vite would otherwise skip it and show it unstyled); the retry <link> is created with crossOrigin as Vite does. lazy-offline.spec.ts no longer uses the removed key (it fetches the chunk URLs with a query offline).

Gates (dev-01, inside nix develop -c, serial; head 1ef61536)

  • cd apps/web && CALTERNAL_BIN=<wt>/target/debug/calternal ~/bin/slot bunx playwright test e2e/toast-bar.spec.ts e2e/lazy-sheet-recovery.spec.ts --project=<p>-1440 --workers=1 --repeat-each=30: chromium-1440 330 passed / 30 skipped / 0 failed; webkit-1440 330 passed / 30 skipped / 0 failed.
  • Once, both projects: e2e/lazy-sheet-recovery.spec.ts e2e/lazy-ui.spec.ts e2e/lazy-offline.spec.ts e2e/lazy-styled.spec.ts e2e/preload.spec.ts -> 49 passed, 7 skipped, 0 failed.
  • bun run build; perf/web.sh --bundle-only --gate -> exit 0.

Bundle. First-paint JS brotli 245,239 B (was 245,044 at ff002213: +195 B; budget 240 KB = 245,760, so 521 B headroom); raw 870,102 (was 871,296), gzip 289,273. First-paint CSS brotli 21,358 B (budget 22.1 KB). All-JS 312 KB (budget 315). The helper saved the repeated snippets but the startup/online recovery and the per-chunk map cost more than that; the headroom is thin.

Open. The "Still loading…" and failure lines are not covered by a spec (they need a throttled chunk); say if you want one.

🤖 Generated with Claude Code

**Chunk retry: review fixes** (head `1ef61536`) **Changes** 1. **P1 + both P2s (one change).** The sessionStorage key is gone. `chunk-retry.ts` keeps a `Map` chunk -> stamp in memory. The first importer to fail on a chunk's URL makes a new stamp; anyone failing together with it reuses it, so concurrent importers share one `?retry=` URL and one copy of the chunk. The build's rewrite calls one shared helper, `__cr(path)`, which reads the map. Nothing outlives a reload and storage errors no longer matter. New test `screens that fail together retry on one new URL...`: idle warming fails every screen, `online` makes them all retry at once, and exactly one `?retry=` URL is requested (the sheet then fills). 2. **P3 bundle.** The 17 inline snippets are now `import(__cr("./x.js"))`. 3. **P3 warm-up.** `lazy(chunk, load)`: `load()` is one try with no backoff; only `load(true)` (sheets, startup screen) retries. Screens whose load failed are retried in place on `online` / tab-visible. This replaced the old reload in `pwa.svelte.ts` (removed, with `chunkLoadFailed`). The startup hold on a failed sign-in/trash screen is now reactive (`startup.blocked`) and clears when it loads, instead of a reload. 4. **P2 TASTE 7** ("errors are one calm line that fades in"). A sheet still blank after 1.5 s shows "Still loading…"; if it cannot load at all it shows "Couldn't open this. Try again in a moment." for 1.5 s, then closes. Same 13 px `--ink-2` text and 240 ms fade as the sign-in error line. No toast. Also fixed on the way: a screen asked for again after a failure now starts on the new URL and swaps its failed stylesheet (Vite would otherwise skip it and show it unstyled); the retry `<link>` is created with `crossOrigin` as Vite does. `lazy-offline.spec.ts` no longer uses the removed key (it fetches the chunk URLs with a query offline). **Gates** (dev-01, inside `nix develop -c`, serial; head `1ef61536`) - `cd apps/web && CALTERNAL_BIN=<wt>/target/debug/calternal ~/bin/slot bunx playwright test e2e/toast-bar.spec.ts e2e/lazy-sheet-recovery.spec.ts --project=<p>-1440 --workers=1 --repeat-each=30`: chromium-1440 330 passed / 30 skipped / 0 failed; webkit-1440 330 passed / 30 skipped / 0 failed. - Once, both projects: `e2e/lazy-sheet-recovery.spec.ts e2e/lazy-ui.spec.ts e2e/lazy-offline.spec.ts e2e/lazy-styled.spec.ts e2e/preload.spec.ts` -> 49 passed, 7 skipped, 0 failed. - `bun run build`; `perf/web.sh --bundle-only --gate` -> exit 0. **Bundle.** First-paint JS brotli **245,239 B** (was 245,044 at `ff002213`: +195 B; budget 240 KB = 245,760, so **521 B headroom**); raw 870,102 (was 871,296), gzip 289,273. First-paint CSS brotli 21,358 B (budget 22.1 KB). All-JS 312 KB (budget 315). The helper saved the repeated snippets but the startup/online recovery and the per-chunk map cost more than that; the headroom is thin. **Open.** The "Still loading…" and failure lines are not covered by a spec (they need a throttled chunk); say if you want one. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Owner

Chunk retry: update (head 4d52ff45)

  • Removed the "Still loading…" line (no loading status in the UI). Only the failure line stays: "Couldn't open this. Try again in a moment.", shown 1.5 s, then the sheet closes (TASTE 7). lazy-sheet-recovery.spec.ts now checks the line appears and the sheet then closes.
  • Bug found by the gate and fixed: the chunk name was cut at the last - of the file name, but the build's 8-character hash can itself contain -. For such a build the stamp was stored under the wrong name and the retry reused the cached failed URL (the "fills after one failure" specs failed 60/60 on that build, passed on others). The name is now matched as name-<8-char hash>.js.
  • Gates (dev-01, nix develop -c, one run at a time): cd apps/web && CALTERNAL_BIN=<wt>/target/debug/calternal ~/bin/slot bunx playwright test e2e/lazy-sheet-recovery.spec.ts --project=<p>-1440 --workers=1 --repeat-each=30 -> chromium-1440 90 passed, webkit-1440 90 passed, 0 failed. Once on both projects: lazy-sheet-recovery, lazy-ui, lazy-offline, lazy-styled, preload -> 49 passed, 7 skipped, 0 failed.
  • Bundle: first-paint JS brotli 245,203 B (was 245,239; budget 245,760, 557 B headroom); CSS brotli 21,358 B. perf/web.sh --bundle-only --gate exit 0.

🤖 Generated with Claude Code

**Chunk retry: update** (head `4d52ff45`) - Removed the "Still loading…" line (no loading status in the UI). Only the failure line stays: "Couldn't open this. Try again in a moment.", shown 1.5 s, then the sheet closes (TASTE 7). `lazy-sheet-recovery.spec.ts` now checks the line appears and the sheet then closes. - **Bug found by the gate and fixed:** the chunk name was cut at the last `-` of the file name, but the build's 8-character hash can itself contain `-`. For such a build the stamp was stored under the wrong name and the retry reused the cached failed URL (the "fills after one failure" specs failed 60/60 on that build, passed on others). The name is now matched as `name-<8-char hash>.js`. - Gates (dev-01, `nix develop -c`, one run at a time): `cd apps/web && CALTERNAL_BIN=<wt>/target/debug/calternal ~/bin/slot bunx playwright test e2e/lazy-sheet-recovery.spec.ts --project=<p>-1440 --workers=1 --repeat-each=30` -> chromium-1440 90 passed, webkit-1440 90 passed, 0 failed. Once on both projects: lazy-sheet-recovery, lazy-ui, lazy-offline, lazy-styled, preload -> 49 passed, 7 skipped, 0 failed. - Bundle: first-paint JS brotli **245,203 B** (was 245,239; budget 245,760, 557 B headroom); CSS brotli 21,358 B. `perf/web.sh --bundle-only --gate` exit 0. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Owner

BM5 contrast fix, pushed to train/bm1-rebased at 09900aef (on top of 4d52ff45).

Cause. e2e/contrast.spec.ts:225 (the bar's sheets, 1440, light) fails on #819's head and passes on dev d0a2819a. The frost port redrew the sky (no clouds or glow, ridges) and changed the photo defaults, so the glass under the sheets is darker at night, and three kinds of quiet text on it fell under 4.5: the Insert and Move to field hints (they used the page's --placeholder, not the on-glass one), the Note info avatar letter (--accent on its soft tint) and Delete (--danger). I checked it was not the glass tokens (reverting tokens.css made it worse) and not the Morph handoff change (reverting it changed nothing).

Fix (colour tokens only, no layout or alpha change):

  • glass.css: words on the float glass also take --placeholder: var(--glass-placeholder), like the other on-glass inks.
  • InfoSheet.svelte: avatar letter uses --glass-accent; Delete is the danger colour mixed 22% toward --glass-ink-2, so it darkens in light and lightens in dark.

Gates (dev-01, one run each). contrast project, whole contrast.spec.ts: 9 passed (light and dark, 1440 and 390, 6.1m). lazy-offline, lazy-sheet-recovery, lazy-styled, lazy-ui, preload, toast-bar on chromium-1440 and webkit-1440: 65 passed, 9 skipped. Not rebuilt into the train.

BM5 contrast fix, pushed to train/bm1-rebased at 09900aef (on top of 4d52ff45). **Cause.** e2e/contrast.spec.ts:225 (the bar's sheets, 1440, light) fails on #819's head and passes on dev d0a2819a. The frost port redrew the sky (no clouds or glow, ridges) and changed the photo defaults, so the glass under the sheets is darker at night, and three kinds of quiet text on it fell under 4.5: the Insert and Move to field hints (they used the page's `--placeholder`, not the on-glass one), the Note info avatar letter (`--accent` on its soft tint) and Delete (`--danger`). I checked it was not the glass tokens (reverting tokens.css made it worse) and not the Morph handoff change (reverting it changed nothing). **Fix** (colour tokens only, no layout or alpha change): - glass.css: words on the float glass also take `--placeholder: var(--glass-placeholder)`, like the other on-glass inks. - InfoSheet.svelte: avatar letter uses `--glass-accent`; Delete is the danger colour mixed 22% toward `--glass-ink-2`, so it darkens in light and lightens in dark. **Gates (dev-01, one run each).** contrast project, whole contrast.spec.ts: 9 passed (light and dark, 1440 and 390, 6.1m). lazy-offline, lazy-sheet-recovery, lazy-styled, lazy-ui, preload, toast-bar on chromium-1440 and webkit-1440: 65 passed, 9 skipped. Not rebuilt into the train.
Author
Owner

Closing: head 09900aef is already in dev (reached via 88f4c091); nothing left to merge. Branch kept.

Closing: head 09900aef is already in dev (reached via 88f4c091); nothing left to merge. Branch kept.
kayg closed this pull request 2026-11-04 13:04:49 +00:00
Some checks failed
CI / server (pull_request) Has been cancelled
CI / rust (pull_request) Has been cancelled
CI / web (pull_request) Has been cancelled

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kayg/calternal!819
No description provided.