test: freeze host-authoritative original Purge validation

This commit is contained in:
Agent Workbench Dev
2026-11-06 13:53:53 +08:00
parent 01e64f3fcf
commit a6830bbf50
16 changed files with 256 additions and 15 deletions
+4 -2
View File
@@ -8,6 +8,8 @@ const auditPath = process.argv[2]; assert.ok(auditPath, 'Explicit completed audi
const audit = read(auditPath); assert.equal(audit.success, true);
const frozen = read('current.json'), result = read('result.json'), samples = [], allAttempts = [], tools = new Set();
for (const sample of result.samples) {
if (!sample.workerSessionId) { samples.push({ ...sample, requests: 0, usage: { requests: 0, inputTokens: 0, outputTokens: 0, totalTokens: 0,
unknownRequests: 0, estimatedUnknownTokens: 0 }, dispatchStage: 'before-worker-and-real-model', originalPurge: [] }); continue; }
const prefix = sample.sample, state = read(prefix + '/worker/session.json'), attempts = read(prefix + '/worker/attempts.json');
const jobs = read(prefix + '/worker/engine-jobs.json'), proof = read(prefix + '/worker/engine-proof.json');
assert.equal(attempts.length, state.execution.task.usage.requests);
@@ -68,9 +70,9 @@ function walk(directory) {
}
}
walk(root); files.sort((a, b) => a.path.localeCompare(b.path)); const bytes = files.reduce((sum, row) => sum + row.bytes, 0);
save('FINAL-MANIFEST.json', { schema: 1, files, bytes, scope: 'All AF raw requests/responses, original engine inputs/reports, source/Git, checks and audits. Historical evidence is not repackaged.' });
save('FINAL-MANIFEST.json', { schema: 1, files, bytes, scope: 'All ' + (frozen.batch ?? 'af').toUpperCase() + ' raw requests/responses, original engine inputs/reports, source/Git, checks and audits. Historical evidence is not repackaged.' });
for (const row of files) { const value = fs.readFileSync(path.join(root, row.path)); assert.equal(value.length, row.bytes); assert.equal(sha(value), row.sha256); }
if (!frozen.fixture) fs.writeFileSync('docs/live-purge-af-evidence.json', JSON.stringify({ summary, evidence: { root, files: files.length, bytes,
if (frozen.fixture !== true) fs.writeFileSync('docs/live-purge-' + (frozen.batch ?? 'af') + '-evidence.json', JSON.stringify({ summary, evidence: { root, files: files.length, bytes,
manifestSha256: sha(fs.readFileSync(path.join(root, 'FINAL-MANIFEST.json'))) } }, null, 2) + '\n', { flag: 'wx' });
console.log(JSON.stringify({ success: true, realRequests: summary.requests, reportedTokens: summary.reportedTokens, unknown: summary.unknownRequests,
allFourSuccessful: fourSuccessful, sameTools, comparison, files: files.length, bytes }));