Fetch the avatar model instead of shipping it
The interviewer's VRM was 10.9 MB of every release binary, for an art asset
that is neither code nor configuration. The browser downloads it now, from a
commit-pinned URL, and checks it against a SHA-256 this repository keeps.
Nothing about an interview changes when it cannot be had: every failure lands
on the neutral panel the avatar already degraded to, and a candidate gets Jim
by voice.
The pin is the whole of the trust, so it runs on the cache path as much as the
network one. A cached entry is only as trustworthy as whatever last wrote to
this origin's storage, and re-hashing 11 MB costs tens of milliseconds against
a download that costs seconds. A browser with no crypto.subtle, which means
an insecure context, gets the neutral panel rather than 11 MB of unverified
third-party geometry: verification has no fallback. Storage does. caches.open
rejects outright in Firefox private browsing and cache.put rejects with
QuotaExceededError once 11 MB will not fit, and both describe a browser that
can still download and render perfectly well, so every storage failure is
swallowed and costs a download rather than the avatar.
The loader is handed the verified ArrayBuffer through parseAsync, never a
URL. A URL would mean either giving it the remote one, which is the loader
deciding what is trustworthy, or wrapping the bytes back into a blob and owning
its lifetime for nothing.
web/avatar/model.js is new and owns the URL, the hash, and the cache. None of
it touches Three.js and vrm.js is the one file that does, which is also what
lets node --test drive the cache branches, the pin, and the storage failures
with no browser and no renderer.
Operational
- The interview page now reaches
raw.githubusercontent.com. A deployment
behind an egress allowlist that does not permit it gets the neutral panel and
nothing else changes.connect-srcnames the origin unconditionally,
including on a page with compiled runs withdrawn. - Release archives strip their symbol table, so a backtrace out of one is hex
addresses.debuginfois already absent in this profile, so stripping that
instead would buy nothing. - The load deadline is 60 s rather than 30. The old number was an 11 MB
download at 3 Mbps measured when that download was localhost; it now covers a
round trip to the model's host, the digest, and the parse. - A pre-migration checkout still has
web/vendor/avatar/jim.vrm.
scripts/fetch-vendor.shdeletes it on the next build. The retired URL is
refused outright and no model is embedded, so a leftover copy is inert.
Licensing
Shape, not substance. CodeTrial no longer redistributes Seed-san, but the VRM
Public License credit obligation attaches to displaying the model, so the
credit stays in the lobby footer where a candidate sees it, and NOTICE,
THIRD-PARTY-NOTICES.md and LICENSE-jim-vrm.txt now say fetched rather than
shipped. tests/browser/avatar.test.js still asserts the visible credit.
Verification
406 Rust tests, 258 browser tests, clippy -D warnings and cargo fmt clean,
verify-vendor and fetch-vendor green.
The avatar was rendered end to end against the release binary with Playwright,
because none of the above proves a model actually loads. Cold: one 200 from the
pinned URL, 31 frames, canvas 398x398, no console errors. Warm, same browser
context: zero requests to the model host, same render. dispose() leaves no
canvas behind.
Two claims are checked rather than reasoned about. #[exclude = "**/*.vrm"]
was re-tested with the real 10,917,800-byte model restored to the tree, since a
glob that silently stopped matching would put 11 MB back in the binary. And
no_model_is_embedded_in_the_binary was confirmed to fail when the exclusion
is removed, because static_candidates refuses the retired URL outright, so an
HTTP 404 for it says nothing about what was embedded.
Not verified here
- The
browser-check.cjsavatar flow, which needs a LiveKit room. Its new
dynamic import resolves and the render path it asserts on is what Playwright
exercised above, but the flow itself did not run. - The
zip -9release step, which needs a runner.
Worth knowing
web/vendor/avatar/jim.vrm is exempted from the verify-vendor walk that
otherwise requires every file under web/vendor to be pinned, so it is the one
path there that may exist unpinned. It is not served, not embedded, and deleted
on the next build, which is the trade being made; the exemption is pinned by a
test so it cannot be dropped silently.
TODO.md carries an open item to replace Seed-san. That swap is cheaper now
(a URL, a hash, and the license record, with no re-vendoring), but the
occurrences its subtask 4 enumerates have moved.
Summary by cubic
Fetches the avatar model at runtime instead of shipping it, trimming 10.9 MB from release binaries and removing an art asset from the embed. The browser downloads the VRM from a commit-pinned URL, checks it against a pinned SHA-256, and caches it; any failure still falls back to the existing neutral panel and Jim by voice.
Rollout
- The interview page now requires
connect-srctoraw.githubusercontent.com; deployments without egress to that host get the neutral panel. - The model load deadline increases from 30 to 60 seconds to cover the download, digest, and parse.
- Pre-migration checkouts keep an ignored leftover
jim.vrm;fetch-vendor.shdeletes it on the next build, and the retired URL is refused outright.
Behavior
- Verification has no fallback: a browser without
crypto.subtle(an insecure context) gets the neutral panel rather than unverified bytes. - Every byte is hashed before rendering, including cache hits; a cache miss or mismatch triggers a fresh download.
- Release binaries now strip symbols (backtraces show hex addresses) and are about 11 MB smaller.