Skip to content

emrg: pack the preview preload, and guard every preload path main.js names - #3306

Merged
argszero merged 2 commits into
masterfrom
fix/preview-preload-not-packaged
Dec 3, 2026
Merged

argszero merged 2 commits into
masterfrom
fix/preview-preload-not-packaged

Conversation

@argszero

@argszero argszero commented Dec 3, 2026

Copy link
Copy Markdown
Owner

The packaged app was missing preview-preload.js, so the HTML preview's annotation interface never loaded: the file exists in the repo and the build's file whitelist left it out, so it is absent from app.asar.

Measured on the installed v0.3.88 (~/Applications/EMRG.app): npx asar list app.asar | grep -c preview-preload answers 0, while main.js names the file as the preview view's preload. A preload that cannot be found is not a crash — the page loads without it, which is exactly what the host saw: a rendered page and no way to annotate.

Why no test caught it: build-config.test.js scans require("./x") in main.js, preload.js and config_fields.js, and a preload is not required — it is a path handed to WebContentsView. The whitelist was never asked about it.

Two changes:

  • package.json build.files gains preview-preload.js, beside main.js and preload.js.
  • build-config.test.js gains a guard over the other carrier: every path.join(__dirname, "*.js") in main.js must be covered by build.files. Measured that it fires — with the entry removed the test reports actual: [ 'preview-preload.js' ], expected: []; with it restored, 10 passed.

The guard also holds the two paths that already ship (preload.js, conn-manager.js-style requires keep their own test), so a future preload added the same way cannot ship missing.

Readings: node --test test/build-config.test.js 10 passed; cd emrg/gui && npm test 280 executed, 273 passed, 8 skipped; scripts/check-node-test-count.py agreeing with Agent.md (1282 renderer + 280 GUI); tests/test_doc_counts.py 82 passed.

The host reaches this only through a published release: the installed .pkg carries the whitelist's decision.

@argszero
argszero merged commit 4cb31a8 into master Dec 3, 2026
2 checks passed
@argszero
argszero deleted the fix/preview-preload-not-packaged branch December 3, 2026 11:51
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