Skip to content

Load the browser page behind Strata's loading shell - #65

Merged
dmccoystephenson merged 2 commits into
masterfrom
strata-loading-shell
Oct 28, 2026
Merged

dmccoystephenson merged 2 commits into
masterfrom
strata-loading-shell

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

What changes

The browser page used to show "Loading env-lib-cpp on Strata…" while the engine downloaded. It now loads behind the Strata web kit's loading shell (strata-loader.js, from Strata's web/kit/, vendored at 901e6c9 in strata/web/strata-kit/ with PIN, SHA256SUMS, LICENSE and update.sh, the same way gardener vendors the kit):

  • Backdrop: the /play trailer's first frame, blurred, from https://danielstephenson.dev/trailers/.
  • Progress: byte-accurate, with the size, and role=progressbar. The loader streams the .wasm and hands its bytes to the engine, so nothing downloads twice.
  • Fallback: when the live view can't run (no WebGL 2, the renderer fails, the engine stops, a lost WebGL context does not come back), the trailer plays with the reason in words and a "More games" link. Under prefers-reduced-motion, the still is shown instead of the clip.
  • Slow devices: a device drawing under 12 frames a second over 8 s is offered the clip without losing the live view. This check is skipped in automated browsers and ?bench runs.

How it is wired

  • strata/web/strata-boot.js bridges this classic (non-MODULARIZE) build to the loader. emcc's {{{ SCRIPT }}} tag sits inert in <template id="strata-glue">. The bridge starts the glue, and the engine waits in Module.instantiateWasm for the loader's bytes.
  • strata/web/strata_page.cmake runs after each link. It puts the loader and the bridge inline in the page, so the site is still the same four files and the workflow is unchanged. It also stamps the download's size on the template, because the arcade compresses on the fly and sends no Content-Length.
  • The files live under strata/web/ (strata-kit/, strata-boot.js, strata_page.cmake), next to the page.
  • The #loading box now only shows in-page errors. window.envlib, ?world= and ?bench are unchanged.
  • The smoke test now checks that the shell finishes. It also checks that without WebGL 2 the shell says why and downloads nothing of the engine.

Checked locally

The build used emsdk 6.0.11 and Strata c2d7ee4. It was served by a local server that gzips on the fly with no Content-Length, as the arcade does.

  • strata/web/smoke/smoke.cjs passed on desktop and phone (iPhone 13), including the new shell checks.
  • strata/web/smoke/bench.cjs ?bench=3 passed on desktop and phone.
  • ctest (wasm under Node) passed: 1/1.
  • arcade-watch's strata check, run locally on desktop, passed: wasm instantiated, WebGL 2, frames and draws advancing, envlib.status().tick advancing, the canvas not blank, and the shell gone.
  • Screenshots were taken at 390×844 of the loading state, a throttled download part way, and the no-WebGL 2 fallback with and without reduced motion.

Drafted by Claude on behalf of Daniel Stephenson.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LYNeuo5Ry76i84tz6WXQSE

dmccoystephenson and others added 2 commits October 28, 2026 01:54
The page used to show "Loading env-lib-cpp on Strata..." while the engine
downloaded. It now loads behind the Strata web kit's loading shell
(strata-loader.js, vendored at Strata 901e6c9 with its PIN, SHA256SUMS,
LICENSE and update.sh): the /play trailer's first frame as a blurred
backdrop, in the page's colours, and byte-accurate progress with the size.
The loader streams envlib-strata.wasm and hands the bytes to the engine, so
nothing downloads twice.

When the view can't run (no WebGL 2, the renderer fails, the engine stops,
a lost WebGL context does not come back) the shell plays the trailer and
says why; under prefers-reduced-motion it shows the still. A device drawing
under 12 frames a second is offered the clip without losing the live view;
that watch is skipped in automated browsers and ?bench runs.

strata/web/strata-boot.js bridges this classic (non-MODULARIZE) build to
the loader: emcc's script tag is kept inert in a template, the bridge starts
it, and the engine waits in Module.instantiateWasm for the loader's bytes.
After each link strata/web/strata_page.cmake puts the loader and the bridge
inline in the page, so the site is still the same four files, and stamps
the download's size, since the arcade compresses on the fly with no
Content-Length. The smoke test now checks that the shell finishes, and that
without WebGL 2 it says why and downloads nothing of the engine.

drafted by Claude on behalf of Daniel Stephenson

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LYNeuo5Ry76i84tz6WXQSE
drafted by Claude on behalf of Daniel Stephenson

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LYNeuo5Ry76i84tz6WXQSE
@dmccoystephenson

Copy link
Copy Markdown
Member Author

Review of PR #65 (adopted by a Gardener tend run; no prior review was recorded on this PR).

Rubric:

  • Scope: PASS — every file serves the loading shell: the vendored kit (strata/web/strata-kit/), the bridge (strata-boot.js), the post-link page step (strata_page.cmake + strata/CMakeLists.txt), the page (shell.html), the smoke test, and docs/STRATA.md. No src/ or Makefile changes.
  • Tests-new: PASS — strata/web/smoke/smoke.cjs now asserts the shell reaches done and that, with WebGL 2 stubbed out, the shell states the reason and no envlib-strata.(wasm|js) request is made.
  • Tests-fix: not applicable — no bug fix in scope.
  • Vendored integrity: PASS — sha256sum of strata-loader.js and LICENSE matches SHA256SUMS (7da2a43f…, 8e3fc647…). The only network call in the loader is the same-origin .wasm fetch (strata-loader.js:213); no innerHTML/eval use was found, and reason text goes through textContent.
  • Docs: PASS — docs/STRATA.md gains "The loading shell" section matching the wiring; README.md's class table is unaffected (no library classes changed).
  • Do-not-auto-merge paths: PASS — no .github/workflows/*, security/, or Makefile change; no file deletes more than 50 lines.
  • CI anchor: PASS — "Library tests (make + CMake)", "Strata frontend (build, tests, headless render)", and "Web build and smoke test (headless Chromium)" are all green on the PR head; the branch already contains master (merge state CLEAN).

Non-blocking notes:

  • strata/web/shell.html:153 — onRendererFailed still writes to #loading, which is now display: none, so that text is never seen; the loader's fallback carries the message instead. It is harmless but could be dropped later.
  • strata/web/strata_page.cmake:37 — the -DDATA= option is accepted but strata/CMakeLists.txt never passes it (this build has no --preload-file package). It reads as forward compatibility rather than a defect.
  • strata/web/strata-boot.js:117 — the instantiateWasm closure references resolveFactory, declared with let further down; this is safe because it only runs after start() returns, but hoisting the declaration would read more clearly.

Verdict: ready to merge.

This review was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).


drafted by Claude on behalf of Daniel Stephenson

@dmccoystephenson
dmccoystephenson merged commit f4d73b4 into master Oct 28, 2026
3 checks passed
@dmccoystephenson
dmccoystephenson deleted the strata-loading-shell branch October 28, 2026 10:41
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