Skip to content

fix(ci): inline parser JSON assets + copy tut-alert partial in option-tail-leak test - #3041

Merged
jung-thomas merged 1 commit into
DEVfrom
worktree-fix-parsers-json-and-alert-partial
Nov 6, 2026
Merged

jung-thomas merged 1 commit into
DEVfrom
worktree-fix-parsers-json-and-alert-partial

Conversation

@jung-thomas

Copy link
Copy Markdown
Contributor

Third and final follow-up unblocking the DEV unit job. #3036 fixed the bundle-step crash; #3039 fixed 3 of the 5 surfaced failures (hugo contains, blockquote-hook/css stale tests). This PR fixes the last 2.

A — 5 srv-qa suites fail at module load: Cannot find module './icon-allowlist.json'

Once #3039's banner-alias cleared the createRequire collision, the next error surfaced: parsers.bundle.mjs does createRequire('./icon-allowlist.json') / './api-libs.json' at runtime, but neither parsers bundle (srv-qa/lib/parsers.bundle.mjs from the package.json inline script, nor srv/lib/_shared/parsers.bundle.mjs from bundle-shared.cjs) ships the JSON beside the .mjs. So the require fails at load → all 5 srv-qa suites error before any test runs.

Fix: scripts/parsers/directives/ui.ts + reference-links.ts now use static default JSON imports (import x from './x.json') instead of createRequire. tsconfig has resolveJsonModule: true; esbuild, Vite (Vitest) and tsx all inline the JSON into the bundle at build time — removing the sidecar-file dependency for both bundles, and removing the createRequire imports that caused the earlier collision in the first place.

Verified: rebuilt the bundle → 0 runtime require('./*.json'), both JSON payloads inlined, node --check passes.

D — option-tail-leak.test.ts: Hugo build failed (exit 1)

The test builds a temp Hugo site copying the render hooks. render-blockquote.html now delegates > [!TYPE] alerts to partials/tut-alert.html (#2595/#71a8d70bc), but the test never copied that partial → partial "tut-alert.html" was unresolvable → build died (the test only captured WARN lines, masking the real error).

Fix: create layouts/partials/ in the temp site and copy tut-alert.html into it.

Verified by reproducing the real Hugo pipeline with the hana-clients TIP shape: build now exits 0 and renders exactly 2 <aside class="alert alert-tip"> (matching #3039's updated assertion).

Net

With this + #3036 + #3039, all 6 originally-failing unit suites are addressed. CI on this PR should show the unit job green.

🤖 Generated with Claude Code

…eak test

Follow-up after the first round fixed B/C/E but left A and D red.

A (5 srv-qa suites, 'Cannot find module ./icon-allowlist.json'):
  directives/ui.ts and reference-links.ts loaded icon-allowlist.json /
  api-libs.json via createRequire('./x.json') at runtime, but neither
  parsers bundle (srv-qa/lib + srv/lib/_shared, both built from
  scripts/parsers/*) ships the JSON beside the .mjs, so the runtime require
  fails. Switch to static default JSON imports (tsconfig has
  resolveJsonModule) — esbuild/vite/tsx all inline the JSON into the bundle,
  removing the sidecar-file dependency for BOTH bundles and also removing the
  createRequire imports that caused the earlier banner collision.

D (option-tail-leak.test.ts, 'Hugo build failed exit 1'):
  render-blockquote.html now delegates  alerts to the tut-alert
  partial (#2595/#71a8d70bc), but the test's temp Hugo site never copied
  tut-alert.html, so  was unresolvable and the
  build died. Copy tut-alert.html into the temp layouts/partials/ dir.
  Verified by reproducing the real Hugo pipeline: build now exits 0 and
  renders exactly 2 <aside class="alert alert-tip">.
@jung-thomas
jung-thomas merged commit 3036312 into DEV Nov 6, 2026
4 checks passed
@jung-thomas
jung-thomas deleted the worktree-fix-parsers-json-and-alert-partial branch November 6, 2026 19:44
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