emrg: fix Monaco AMD define hijacking UMD marked — markdown degraded to plain text (rant 2026-08-15T10:48:58) - #805
Conversation
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle
Reviewed the full diff: root cause correctly identified (monaco loader.js defines global AMD define/require at L1347 → UMD marked takes the define branch → window.marked never set → plain-text degradation); index.html order fix (UMD vendors before monaco loader) is the right structural fix; recoverAmdModule() fallback reading require.s module table is a sound defensive layer with positive/negative test coverage; console.error diagnostic names the cause; order-guard test locks the fix against regression. CI test + test-windows both SUCCESS (run 31860446814). Agent.md counts synced (253→255).
|
I tested this PR end-to-end on Windows and the root-cause fix checks out. |
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle
Reviewed the full diff: script-order fix is the correct root-cause resolution (UMD marked sees AMD define from monaco loader → never sets window.marked; loading marked/dompurify/highlight first makes them take the UMD branch, and monaco's AMD define afterwards doesn't disturb already-set globals). The AMD module-table recovery in markdown.js is a sound defensive layer (require.s / define.amd.modules), and the console.error names the exact cause for future diagnosis. Order-guard test (build-config) + AMD-recovery test (renderer.smoke) both cover the regression; Agent.md counts synced (253→255). CI test + test-windows SUCCESS (run 31860446814).
Critical regression fix: after #801 (Monaco editor), chat and rant-detail markdown degraded to plain text.
Root cause (100% code-confirmed):
u.global.define = p).define.amdand takes the AMD define branch →window.markedis never set.Fixes:
recoverAmdModule("marked")reads monaco require.s/define.amd.modules) before degrading; upgraded the missing-vendor log to a console.error naming the AMD-hijack cause for future diagnosis.Verification: GUI npm test 255/255; pytest 824 passed/1 skipped; doc-count guard 3/3; import + CLI checks green. Rant details markdown (and its pending 【】-header enhancement) now render again once this lands.