From aa63a478a7d0ce5fa07c06ffd459c184189b2b15 Mon Sep 17 00:00:00 2001 From: Kpa-clawbot Date: Mon, 25 May 2026 23:36:03 -0700 Subject: [PATCH] =?UTF-8?q?fix(#1392):=20test-live.js=20=E2=80=94=20load?= =?UTF-8?q?=20packet-helpers.js=20in=20makeLiveSandbox,=20wire=20into=20CI?= =?UTF-8?q?=20(#1393)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Root cause `makeLiveSandbox()` in `test-live.js` didn't load `public/packet-helpers.js`, so `window.getParsedDecoded` / `getParsedPath` were undefined. The `dbPacketToLive` and `expandToBufferEntries` suites failed all 8 assertions with `getParsedDecoded is not a function`. The `expandToBufferEntriesAsync` suite was unaffected because it builds its sandbox manually and already loads packet-helpers.js. ## Fix - `test-live.js`: load `public/packet-helpers.js` in `makeLiveSandbox()` before `live.js`. Mirrors the working pattern in `expandToBufferEntriesAsync`. - `.github/workflows/deploy.yml`: wire `node test-live.js` into the "Run JS unit tests" step so this can't silently regress again. - Adjusted one cross-realm `deepStrictEqual([], [])` โ†’ `.length === 0` because the array literal lives inside the vm sandbox; host-side `deepStrictEqual` rejects the proto mismatch even when the value is semantically equal. Test-harness only. No production code change. ## Mutation verification With the new `loadInCtx(ctx, 'public/packet-helpers.js')` line removed, all 8 original assertions return (`getParsedDecoded is not a function`). With the fix in place, `node test-live.js` exits 0 โ€” 95 passed, 0 failed. ## CI wire `node test-live.js` now runs in deploy.yml under "Run JS unit tests (packet-filter)" alongside the other root-level test files. YAML validated with `yaml.safe_load`. Fixes #1392 Co-authored-by: openclaw-bot --- .github/workflows/deploy.yml | 1 + test-live.js | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index ca142f1a..dbdb91fe 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -111,6 +111,7 @@ jobs: node test-issue-1364-pill-no-clamp.js node test-issue-1375-scope-stats-fetch.js node test-issue-1361-cb-presets.js + node test-live.js - name: ๐Ÿงน Frontend lint (eslint no-undef) โ€” issue #1342 run: | diff --git a/test-live.js b/test-live.js index 46322791..56e85865 100644 --- a/test-live.js +++ b/test-live.js @@ -149,6 +149,7 @@ function makeLiveSandbox({ withAppJs = false } = {}) { addLiveGlobals(ctx); loadInCtx(ctx, 'public/roles.js'); + loadInCtx(ctx, 'public/packet-helpers.js'); if (withAppJs) loadInCtx(ctx, 'public/app.js'); try { loadInCtx(ctx, 'public/live.js'); } catch (e) { console.error('live.js load error:', e.message); @@ -190,7 +191,7 @@ console.log('\n=== live.js: dbPacketToLive ==='); const pkt = { id: 1, hash: 'x', decoded_json: null, path_json: null, timestamp: '2024-01-01T00:00:00Z' }; const result = dbPacketToLive(pkt); assert.strictEqual(result.decoded.header.payloadTypeName, 'UNKNOWN'); - assert.deepStrictEqual(result.decoded.path.hops, []); + assert.strictEqual(result.decoded.path.hops.length, 0); }); test('uses payload_type_name as fallback', () => {