29 lines
1.6 KiB
JavaScript
29 lines
1.6 KiB
JavaScript
import fs from 'node:fs';
|
|
import path from 'node:path';
|
|
import assert from 'node:assert/strict';
|
|
import { root, sha, experiment } from './common.mjs';
|
|
const read = name => JSON.parse(fs.readFileSync(path.join(root, name)));
|
|
const manifest = read('MANIFEST.json');
|
|
for (const row of manifest.files) {
|
|
const file = path.resolve(root, row.path); assert.ok(file.startsWith(root + path.sep));
|
|
const bytes = fs.readFileSync(file); assert.equal(bytes.length, row.bytes); assert.equal(sha(bytes), row.sha256);
|
|
}
|
|
assert.equal(read('preflight/verification.json').passed, true);
|
|
const analysis = read('analysis.json');
|
|
for (const stage of ['preflight', 'node']) {
|
|
const file = path.join(root, stage, 'result.json'); if (!fs.existsSync(file)) continue;
|
|
const result = JSON.parse(fs.readFileSync(file));
|
|
for (const row of result.captures) {
|
|
const bytes = fs.readFileSync(path.join(root, row.path));
|
|
assert.equal(bytes.length, row.bytes); assert.equal(sha(bytes), row.sha256);
|
|
}
|
|
if (stage === 'node') {
|
|
assert.equal(read('node/restoration.json').passed, true);
|
|
assert.equal(result.usage.requests <= 8, true); assert.equal(result.usage.totalTokens <= 90000, true);
|
|
assert.equal(sha(fs.readFileSync(path.join(root, 'node/goal.txt'))), 'b5421d0bb502126f49a5153729027f13ef82db86ab19a9e5b0c23a49070bb905');
|
|
}
|
|
}
|
|
console.log(JSON.stringify({ passed: true, route: experiment.name, files: manifest.files.length, bytes: manifest.totalBytes,
|
|
requests: analysis.requestCount, reportedTokens: analysis.reportedTokens, engineeringSuccess: analysis.engineeringSuccess,
|
|
modelRequestsExecutedByVerifier: 0 }));
|