Files
Agent-Workbench/docs/embedded-browser-release-evidence/verifiers/verify-state.mjs
T

19 lines
1.7 KiB
JavaScript

import fs from 'node:fs';
import assert from 'node:assert/strict';
import { originalExecutionFields, addedExecutionFields } from './embedded-browser-d-state.mjs';
const before=JSON.parse(fs.readFileSync('.qa/embedded-browser-d-upgrade-schema-diagnostic-before.json')).export.execution;
const after=JSON.parse(fs.readFileSync('.qa/embedded-browser-d-upgrade-schema-diagnostic-after.json')).export.execution;
let assertions=0;
assert.deepEqual(originalExecutionFields('1.21.0',before),before);assertions++;
assert.deepEqual(originalExecutionFields('1.22.0',after),before);assertions++;
for(const field of addedExecutionFields){
const nonempty=structuredClone(after);nonempty[field]=[{id:'unexpected'}];assert.throws(()=>originalExecutionFields('1.22.0',nonempty));assertions++;
const missing=structuredClone(after);delete missing[field];assert.throws(()=>originalExecutionFields('1.22.0',missing));assertions++;
const old=structuredClone(before);old[field]=[];assert.throws(()=>originalExecutionFields('1.21.0',old));assertions++;
}
const changed=structuredClone(after);changed.progress.totalTools++;assert.notDeepEqual(originalExecutionFields('1.22.0',changed),before);assertions++;
const extra=structuredClone(after);extra.unreviewed=[];assert.notDeepEqual(originalExecutionFields('1.22.0',extra),before);assertions++;
assert.throws(()=>originalExecutionFields('1.23.0',after));assertions++;
fs.writeFileSync('.qa/embedded-browser-d-state-checks.json',JSON.stringify({success:true,assertions,realModelRequests:0,scope:'Actual diagnosed original export fields stay exact; only all four empty additions allowed. Missing, nonempty, pre-existing, unknown-version and unrelated changes rejected.'},null,2)+'\n',{flag:'wx'});
console.log(JSON.stringify({success:true,assertions}));