Skip to content

emrg: bundle vendor scripts in GUI package — fix packaged Markdown fallback - #612

Merged
argszero merged 1 commit into
masterfrom
feature/gui-vendor-bundle
Aug 10, 2026
Merged

emrg: bundle vendor scripts in GUI package — fix packaged Markdown fallback#612
argszero merged 1 commit into
masterfrom
feature/gui-vendor-bundle

Conversation

@argszero

Copy link
Copy Markdown
Owner

Fix packaged GUI Markdown not rendering (rant 2026-08-10T11:03:51).

Root cause: emrg/gui/package.json electron-builder files whitelist omitted vendor/** → marked/DOMPurify/highlight.custom.js were excluded from the installer. Dev mode worked (local files present); only the packaged app degraded to plain text via the !window.marked escape fallback.

Changes:

  1. emrg/gui/package.json: add "vendor/**" to build.files whitelist (minimal one-line fix)
  2. emrg/gui/renderer/js/markdown.js: renderMarkdown now console.warn("markdown vendor missing (marked not loaded)") when marked is absent — future packaging regressions are diagnosable instead of silently degrading
  3. emrg/gui/test/build-config.test.js (new, 3 tests): pins the whitelist entry, verifies all 3 vendored scripts exist non-empty, and asserts the diagnostic fallback — direct regression guard against removing vendor/**
  4. Doc count sync: README.md / README.cn.md / Agent.md GUI count 107 → 110 (+3 build-config)

Verification: npm test 110/110 pass; pytest 674 pass (incl. doc-count guard #511); import + emrg --help OK.

Acceptance mapping: packaged Markdown renders (vendor now bundled) · code-block copy works (hljs+marked present) · source mode untouched · regression tests added.

…llback (rant 2026-08-10T11:03:51)

Packaged GUI rendered Markdown as plain text because electron-builder
'files' whitelist omitted vendor/**, so marked/DOMPurify/highlight were
excluded from the installer while dev mode worked (local files present).

- package.json: add 'vendor/**' to build.files whitelist
- markdown.js: console.warn when marked is missing (diagnose, don't
  silently degrade to plain text)
- build-config.test.js: 3 regression tests pinning the whitelist entry,
  vendored script presence, and the diagnostic fallback
- README/Agent/README.cn: GUI test count 107 -> 110 (+3 build-config)

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle

Verified locally:

  • Root cause confirmed: electron-builder files whitelist omitted vendor/**; the fix adds it alongside existing entries (main.js/preload.js/renderer//daemon_client.js/scripts/).
  • vendor/ dir ships all runtime scripts (marked.min.js, dompurify.min.js, highlight.custom.js, highlight.github-dark.css).
  • Fallback path now logs console.warn instead of degrading silently — good diagnostics.
  • New guard tests pass (3/3) and full GUI suite is 110/110.
  • Doc counts synced (107→110) and parse correctly in tests/test_doc_counts.py (29+22+31+15+7+3+3=110).

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle 20260810-111552

Diff re-verified this cycle: one-line vendor/** addition to electron-builder files whitelist + diagnostic console.warn fallback + 3 build-config regression tests + doc count sync (107→110). Full suite green locally (674 pytest incl. doc-count guard, 110/110 npm test). Acceptance items from the rant map cleanly: packaged Markdown renders (vendor bundled), copy button works (hljs+marked present), source mode untouched, tests added.

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle 20260810-111831 (3rd consecutive ✅)

Third independent review this cycle: diff unchanged and clean (vendor/** whitelist entry, diagnostic console.warn fallback, 3 build-config regression tests, doc counts synced). CI test ✅ (run 31352025434). Acceptance criteria from rant 11:03:51 all satisfied by the code: packaged Markdown renders (vendor bundled), copy button works (hljs+marked present), source mode untouched, regression tests added. Merge condition met (3 consecutive ✅, no ❌ in between).

@argszero
argszero merged commit c2667ff into master Aug 10, 2026
1 check passed
argszero added a commit that referenced this pull request Aug 10, 2026
…or bundling entries (#613)

Merged feature PRs #610 (cmd launchers ASCII-only REM comments, CP936
mojibake) and #612 (GUI packaged vendor bundling — electron-builder files
whitelist vendor/** + diagnostic markdown fallback) were merged without
quick-ref entries. Add both to the implemented-features quick reference
so future cycles cross-check them as handled and avoid duplicate work.

- 2 entries appended after #608 in the quick-ref table
- No {cmd}/{tmp} template constants introduced (prompt-substitution guard)
- 674 pytest full suite green incl. test_build_prompt_all_variables_substituted + doc-count guard

Co-authored-by: EMRG Evolution <emrg@argszero.dev>
@argszero
argszero deleted the feature/gui-vendor-bundle branch August 10, 2026 12:39
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