25 lines
2.2 KiB
JavaScript
25 lines
2.2 KiB
JavaScript
import fs from 'node:fs';
|
|
import path from 'node:path';
|
|
import assert from 'node:assert/strict';
|
|
import { createHash } from 'node:crypto';
|
|
const directory = path.resolve('docs/live-delivery-ab-evidence');
|
|
const manifest = JSON.parse(fs.readFileSync(path.join(directory, 'MANIFEST.json')));
|
|
const session = JSON.parse(fs.readFileSync(path.join(directory, 'node/session.json'))), observations = [];
|
|
for (const row of manifest.files.filter(row => row.path.startsWith('node/artifacts/') && row.path.endsWith('.blob'))) {
|
|
const bytes = fs.readFileSync(path.join(directory, row.path)); assert.equal(createHash('sha256').update(bytes).digest('hex'), row.sha256);
|
|
let value; try { value = JSON.parse(bytes); } catch { continue; }
|
|
if (!value.classification || value.mode !== 'shadow') continue;
|
|
assert.ok(value.stepId || value.phase === 'baseline' && value.stepId === null && value.stepIndex === null);
|
|
assert.equal(value.taskId, session.execution.task.id); assert.equal(value.runId, session.execution.run.id);
|
|
assert.equal(value.delta.changed_files, 0); assert.equal(value.delta.repeated_reads, 0);
|
|
observations.push({ path: row.path, sha256: row.sha256, stepIndex: value.stepIndex, phase: value.phase, classification: value.classification, delta: value.delta, reasons: value.reasons, waiting: value.waiting });
|
|
}
|
|
assert.equal(observations.length, 10);
|
|
const classifications = {};
|
|
for (const row of observations) classifications[row.classification] = (classifications[row.classification] ?? 0) + 1;
|
|
assert.equal(classifications.evidence_growth, 6); assert.equal(classifications.waiting, 2); assert.equal(classifications.new_failure_evidence, 1); assert.equal(classifications.baseline, 1);
|
|
const result = { passed: true, sample: 'AB', observations: observations.sort((a, b) => a.stepIndex - b.stepIndex || a.phase.localeCompare(b.phase)), classifications,
|
|
scope: 'Ten preserved public-fact shadow records only; no prompt, stop, permission or budget intervention and no engineering-success claim.', realModelRequests: 0 };
|
|
fs.writeFileSync('docs/live-delivery-ab-shadow.json', JSON.stringify(result, null, 2) + '\n', { flag: 'wx' });
|
|
console.log(JSON.stringify({ passed: true, observations: observations.length, classifications, realModelRequests: 0 }));
|