mirror of
https://github.com/Kpa-clawbot/meshcore-analyzer.git
synced 2026-06-03 23:51:22 +00:00
## 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 <bot@openclaw.dev>
This commit is contained in:
@@ -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: |
|
||||
|
||||
+2
-1
@@ -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', () => {
|
||||
|
||||
Reference in New Issue
Block a user