fix(web): SPA black screen — vendor @noble/hashes/pbkdf2 + importmap guard#44
Merged
Conversation
…reen) B1.5 pulled deriveWallet into the sign-in path, so app.js's module graph now imports web/src/wallet/bip39.js -> '@noble/hashes/pbkdf2' for the first time in the BROWSER. That specifier was never in the index.html importmap (only node tests exercised bip39, where it resolves via node_modules), so the browser failed to resolve it and the whole graph never loaded — a black screen on boot (seen when pairing). Fix: vendor a bundled noble-hashes-pbkdf2.js, add the importmap entry, precache it in sw.js. Add web/test/importmap.test.js as a regression guard: every bare specifier under web/src must be in the importmap, and every importmap target must exist on disk — the check node tests couldn't do before. Verified in a real browser: the app boots to the sign-in gate. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Production hotfix for the v0.5.0 SPA: pairing (and any sign-in) showed a black
screen, nothing happened.
Root cause
B1.5 moved wallet derivation into the sign-in path, so
app.js's module graph now importsweb/src/wallet/bip39.js→@noble/hashes/pbkdf2in the browser for the first time.That specifier was never in the
index.htmlimportmap (node tests resolve it vianode_modules, so they passed), so the browser threw Failed to resolve module specifierand the entire module graph failed to load → black screen on boot.
Fix
web/vendor/noble-hashes-pbkdf2.js(esbuild, matching the other vendored@noble files), add the importmap entry, precache it in
sw.js.web/test/importmap.test.js: every bare specifier underweb/srcmust be in the importmap, and every importmap target must exist on disk — the browser
resolution check node tests couldn't do before. This would have caught the bug.
Verified
npm test95/95. Servedweb/locally and loaded it in Chrome: app boots to the sign-ingate, no module-resolution errors in the console (only unrelated extension noise).
Once merged I redeploy the SPA (
deploy/lightsail/redeploy.sh) to fix the live site.🤖 Generated with Claude Code