Skip to content

fix(server): serve the terminal WebAssembly module compressed, as application/wasm - #2953

Merged
devswha merged 1 commit into
mainfrom
fix/serve-wasm-compressed
Nov 5, 2026
Merged

devswha merged 1 commit into
mainfrom
fix/serve-wasm-compressed

Conversation

@devswha

@devswha devswha commented Nov 5, 2026

Copy link
Copy Markdown
Owner

What

The terminal's WebAssembly module (Settings > Terminal > Draw with libghostty, #2908) was sent uncompressed and as application/octet-stream: 1,110,716 bytes on every first load. The build already writes .br/.gz copies next to it (#2908 added wasm to scripts/compressed-assets.ts), but serveStatic only negotiates precompressed copies for /assets/*.js|css.

  • server/static.ts: /assets/*.wasm is negotiated like js/css (br, gzip, identity, 406 when none is acceptable), immutable cache, and served as application/wasm.

Validation

  • server/static-encoding.test.ts: new case serves a wasm fixture as br and gzip with application/wasm, and identity without encoding; it fails on main (content-encoding null).
  • bun test server/static-encoding.test.ts server/static.test.ts: pass.
  • bun run check fast: pass (exit 0) on this head.
  • Manual, isolated hc 0.1.17 core + this branch's server on loopback, setting on, headless Chromium with a fresh profile:
    • curl -H 'Accept-Encoding: br': 200, 344,901 bytes, application/wasm (was 1,110,716).
    • first open: the service worker fetches the module once, 344,901 bytes br; it lands in the build's cache (ovis-v4-sheep-<build>).
    • re-open: no network request for the module at all; the page gets it from the service worker.

@coderabbitai

coderabbitai Bot commented Nov 5, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You'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 28 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between b2aadc4 and f705533.

Files selected for processing: 3

  • changelog.d/serve-wasm-compressed.md
  • server/static-encoding.test.ts
  • server/static.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@devswha

devswha commented Nov 5, 2026

Copy link
Copy Markdown
Owner Author

Merge note: GitHub required checks green at this head, omo CLEAR, threads resolved. The ghostty wasm is now served compressed (1.11 MB -> 345 KB br) and cached by the service worker, so a re-open fetches 0 bytes.

@devswha
devswha merged commit c73db88 into main Nov 5, 2026
23 checks passed
@devswha
devswha deleted the fix/serve-wasm-compressed branch November 5, 2026 10:42
devswha added a commit that referenced this pull request Nov 5, 2026
…#2976)

## What

Settings > Terminal > Draw with libghostty (#2908) is on by default.

- It still only draws on a herdr-core server (`terminal-history`, as the
desktop app runs); on herdr and mirrored panes xterm.js draws exactly as
before.
- The setting stays, per device. A device that turned it off stays off:
a stored `false` is kept, only a missing or invalid value means on.
Note: since #2908 every settings save writes this key, so a device that
saved any setting on a main build after #2908 also has `false` stored
and stays off; released versions never had the key, so their users get
the new default.

## Gates (step 1 checklist, measured on isolated hc 0.1.17 + this stack)

| Gate | Result |
|---|---|
| Phone first load (slow 4G 1.6 Mbps/150 ms, CPU x4, fresh profile,
median of 5) | off 7,510 ms / on 7,918 ms: +408 ms, within +0.5 s (wasm
served br since #2953: 1.11 MB -> 345 KB, re-open fetches no wasm) |
| Low-end phone frames (CPU x6, `seq 1 200000`, ABBA) | after #2959 on
is at or below off: median finish 10.5 s vs 10.8 s, stalls > 50 ms 4 vs
7 |
| Screen reader (real NVDA 2026.2, Windows 11 VM, Edge 156) | on: NVDA
reads new output; off (xterm, screen reader mode off): reads nothing.
Known follow-ups in #2963 |
| iOS long-press copy (iOS 27 Simulator, Safari) | **provisionally
equal**: neither xterm nor libghostty shows a selection/copy menu on a
1.6 s long-press (driven with simctl + AXe touch). Pending one manual
check once Simulator components are installed on the test Mac. Copy
keeps working through the key bar's copy button and OSC 52 (#2925) |

## Validation

- `bun test src/lib/settings`: pass (the two tests that pinned the old
default now pin the new one: missing/invalid means on, a stored `false`
stays off, the key stays out of the whole-record save).
- `bun scripts/terminal-ghostty-demo-regression.ts`: pass (herdr-core
pane drawn with libghostty, herdr's own and off stay xterm).
- `bun run check fast`: pass (exit 0) on this head
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant