Skip to content

harness: load undici at first use so the server source guard stays green - #499

Closed
kridaydave wants to merge 1 commit into
DuskBotAI:devfrom
kridaydave:fix/lazy-undici-system-proxy
Closed

kridaydave wants to merge 1 commit into
DuskBotAI:devfrom
kridaydave:fix/lazy-undici-system-proxy

Conversation

@kridaydave

Copy link
Copy Markdown
Contributor

What changed

  • server/system-proxy.ts no longer statically imports undici. It loads it with await import("undici") inside installSystemProxy, the Electron-only first use, and passes the module into systemProxyDispatcher.
  • installSystemProxy is now async; its tests await it.

Why

The lazy-module source guard requires tar, undici and @hpke/core to be first-use imports. The new proxy support landed with a top-level undici import, so scripts/testing/lazy-server-modules.test.ts is currently red on dev and every PR based on it (including #497 and #498):

AssertionError: expected [ 'server/system-proxy.ts' ] to deeply equal []

This keeps the same behavior in Electron's utility process while leaving plain Node and the bundled server from loading undici at startup.

Verification

  • scripts/testing/lazy-server-modules.test.ts + server/system-proxy.test.ts: 10 passed
  • npm run typecheck: passed
  • oxlint on both changed files: 0 warnings, 0 errors

@kridaydave

Copy link
Copy Markdown
Contributor Author

Folded into the three issue PRs (#497, #498, #500) so each is self-contained and green on current dev; keeping a separate fix-only PR would leave all three blocked until it merges. The same one-commit prerequisite is in each branch.

@kridaydave kridaydave closed this Dec 3, 2026
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