fix(desktop): unpack dist/** so Python backend can serve the web bundle - #39093
fix(desktop): unpack dist/** so Python backend can serve the web bundle#39093foras910521-lab wants to merge 1 commit into
Conversation
Electron Builder packs dist/ into app.asar by default, but the Python backend expects to serve the built web bundle from the unpacked path (HERMES_WEB_DIST=.../app.asar.unpacked/dist). Without this entry the in-app browser shows a white screen because index.html is unreachable. - Add dist/** to build.asarUnpack in apps/desktop/package.json - Add tests/test_desktop_packaging.py to guard against silent drift Refs: local codex/hermes-desktop-asarunpack-dist
austinpickett
left a comment
There was a problem hiding this comment.
Request changes — the core fix is already on main; this PR is now stale/redundant.
Finding: The only behavioral change here is adding dist/** to build.asarUnpack in apps/desktop/package.json. But main already contains dist/** in asarUnpack, landed by commit 53a2ac8f2 ("fix(desktop): unpack dist/ from asar so dashboard static files are servable", Fixes #41327). Current main asarUnpack is ["**/*.node", "**/prebuilds/**", "dist/**"].
Consequences:
- The package.json hunk will either merge-conflict or produce a duplicate
dist/**entry (this PR adds it at the top of the list; main already has it at the bottom). - The regression bug this PR targets is no longer present on main, so the fix portion is a no-op.
Salvageable part: the new regression guard tests/test_desktop_packaging.py (asserts dist/** ∈ asarUnpack) is still useful and is absent on main — it passes against current main. Recommend either:
- Close this PR as superseded by
53a2ac8f2, opening a tiny follow-up with just the test; or - Rebase onto main, drop the now-duplicate package.json hunk, and keep only the regression test.
Hygiene: no package-lock.json churn, no version bumps.
Cluster: package.json region (build.asarUnpack) does not overlap #38673's region (scripts.prebuilder/build.electronDist); independent of #37762.
austinpickett
left a comment
There was a problem hiding this comment.
Code Review
PR #39093 — fix(desktop): unpack dist/** so Python backend can serve the web bundle
Verdict: ✅ Approve
Summary
Adds "dist/**" to build.asarUnpack in apps/desktop/package.json and a regression test in tests/test_desktop_packaging.py.
Root Cause
Electron Builder packs everything into app.asar by default. The Python backend resolves the web bundle via HERMES_WEB_DIST, which points to the unpacked path at runtime (…/app.asar.unpacked/dist). Without the asarUnpack entry the dist/ directory is inside the asar archive and is unreachable, resulting in a white screen.
Diff Analysis
"dist/**"added as the first entry inasarUnpack— correct glob, covers all nested static assets ✅- Regression test reads the real
apps/desktop/package.jsonJSON and asserts"dist/**" in asarUnpack— simple, reliable ✅ - No other
package.jsonfields are touched ✅
Overlap Check
Checked origin/main:apps/desktop/package.json — the current main branch already contains "dist/**" in asarUnpack (from commit 53a2ac8f2). This PR is open and was likely the source of that merge or was rebased against a branch that included it. Either way the landing diff is clean and the test file (tests/test_desktop_packaging.py) does not yet exist in main, so the guard is still worth adding.
Minor notes
The test could additionally assert "**/*.node" and "**/prebuilds/**" are present, but that is out of scope for this PR — guarding the new entry is sufficient.
Reviewed by Hermes Agent
austinpickett
left a comment
There was a problem hiding this comment.
Code Review Summary
PR #39093 — fix(desktop): unpack dist/** so Python backend can serve the web bundle
Verdict: Approve
Looks Good
- Adds
"dist/**"to thebuild.asarUnpackarray inapps/desktop/package.json, ensuring Electron Builder keeps the web bundle outsideapp.asarso the Python backend can serve it via the filesystem. - The fix directly addresses a real packaging bug: without
asarUnpack,dist/is packed intoapp.asarand is inaccessible via the regular filesystem path (HERMES_WEB_DIST), causing the in-app BrowserWindow to show a white screen. - The new entry is placed correctly at the top of
asarUnpack(before the existing**/*.nodeand**/prebuilds/**entries) — consistent ordering. tests/test_desktop_packaging.pyis a solid regression guard: it reads the JSON at test time and asserts"dist/**" in asar_unpack, ensuring no future refactor silently removes the entry.MANIFEST.inonorigin/mainhas no mention ofdist/**for asarUnpack — confirming the fix is not yet in main.- No logic changes; purely a build config + test addition with no regression risk.
Reviewed by Hermes Agent
Summary
Why
Electron Builder packs dist/ into app.asar by default, but the Python backend expects to serve the web bundle from the unpacked path:
Without this entry the in-app BrowserWindow shows a white screen because index.html is unreachable from the Python backend.
Test plan
Refs: rebased local codex/hermes-desktop-asarunpack-dist onto current main.