Commit ac52ec9
committed
fix(browser): keep the Node-only fs-safe package out of the browser graph
The Workflow Runner Browser E2E leg fails all 27 specs on
page.waitForFunction timeout, waiting for workflowRunnerReady. My previous
attempt at this leg chased a vite build failure. That was the wrong
measurement: playwright.config.ts runs the dev server, not a build, so the
rollup error I was fixing is not the error CI sees.
Reproduced the real one by loading the harness page against the dev server
and reading pageerror:
Browser stub: node:module.createRequire not supported
at .../@openclaw_fs-safe.js:1057
and, once past that, "process is not defined" from the same module. Both are
at module scope in @openclaw/fs-safe's native-binding loader, so having it in
the graph throws before any code calls it.
It is in the graph because of this branch. main's runtime defined its own
FileStorageAdapter in context.ts; consolidating onto @nodetool-ai/storage's
made storage-workspace.ts import that package statically, and rolldown says
so directly while building web:
packages/storage/src/index.ts is dynamically imported by
packages/runtime/src/context.ts but also statically imported by
packages/runtime/src/storage-workspace.ts, packages/runtime/src/testing.ts
So context.ts's deliberate await import — its comment says storage reaches
node:fs — is defeated by two static ones.
Stubbed at the same seam the configs already use for Node-only modules, in
both the harness and web. root() is called only from FileStorageAdapter's
constructor and a browser has no local directory to point one at, so the stub
throws on use like every other one there. web's bundle carried the real
package until now: the chunks pulling it are lazy node bundles, so it was
latent rather than a load failure.
Harness: 26 of 27 pass. The one failure is sandbox-media, on
"This video track cannot be decoded by this browser" — this container's
codec-less Chromium build, not the change. Before the stub the page never
reached workflowRunnerReady at all.
Also measured and not shipped: making the createRequire stub return a
throwing require instead of throwing itself. It fixes the first error on its
own, but with fs-safe stubbed nothing reaches it, so there is no failing case
to justify it.
web build clean, typecheck web+electron clean, lint 0 errors, harness gate
exit 0.
Not fixed here, written up on the PR: the two static imports above mean the
runtime barrel still cannot be loaded off Node without the alias.1 parent 842c706 commit ac52ec9
4 files changed
Lines changed: 61 additions & 0 deletions
File tree
- packages/workflow-runner/e2e
- stubs
- web
- vite-node-stubs
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
92 | 106 | | |
93 | 107 | | |
94 | 108 | | |
| |||
99 | 113 | | |
100 | 114 | | |
101 | 115 | | |
| 116 | + | |
102 | 117 | | |
103 | 118 | | |
104 | 119 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
85 | 96 | | |
86 | 97 | | |
87 | 98 | | |
| |||
94 | 105 | | |
95 | 106 | | |
96 | 107 | | |
| 108 | + | |
97 | 109 | | |
98 | 110 | | |
99 | 111 | | |
| |||
0 commit comments