Files
Agent-Workbench/docs/reliability-1.25.2-evidence/development/review-source-suite.mjs.txt
T

31 lines
2.9 KiB
Plaintext

import fs from 'node:fs';
import assert from 'node:assert/strict';
import { createHash } from 'node:crypto';
const root = '.qa/reliability-1.25.2';
const read = file => JSON.parse(fs.readFileSync(root + '/' + file, 'utf8'));
const hash = file => createHash('sha256').update(fs.readFileSync(file)).digest('hex');
const fullFile = root + '/full-release-final.tap', full = fs.readFileSync(fullFile, 'utf8');
for (const expression of [/\btests 899\b/, /\bpass 898\b/, /\bfail 1\b/, /\bcancelled 0\b/, /\bskipped 0\b/]) assert.match(full, expression);
const name = 'a real bundle restart preserves proposals, interrupts old approvals and requests fresh consent on resume';
const failures = full.split(/\r?\n/).filter(line => line.startsWith('✖ ') && !line.startsWith('✖ failing tests:'));
assert.equal(failures.length, 2); assert.ok(failures.every(line => line.startsWith('✖ ' + name + ' (')));
assert.match(full, /Error: Timed out waiting for test state\./);
assert.match(full, /tests\/api\.test\.mjs:101:3/);
const freeze = read('release-final/freeze.json'), supplement = read('api-restart-recheck.json');
assert.equal(supplement.success, true); assert.equal(supplement.code, 0); assert.equal(supplement.sourceCommit, freeze.sourceCommit);
assert.equal(supplement.realModelRequests, 0);
const tap = fs.readFileSync(supplement.output, 'utf8');
for (const expression of [/\btests 1\b/, /\bpass 1\b/, /\bfail 0\b/, /\bcancelled 0\b/, /\bskipped 0\b/]) assert.match(tap, expression);
assert.ok(tap.includes('ok 1 - ' + name));
for (const file of ['tests/api.test.mjs', 'tests/helpers.mjs']) assert.equal(hash(file), freeze.inputs.find(row => row.path === file)?.sha256);
const review = { success: true, version: '1.25.2', sourceCommit: freeze.sourceCommit,
wholeSuite: { tests: 899, passed: 898, failed: 1, cancelled: 0, skipped: 0, file: fullFile, sha256: hash(fullFile) },
originalFailure: { name, location: 'tests/api.test.mjs:101:3', phase: 'before restart: first awaiting_approval', error: 'Timed out waiting for test state.', originalDeadlineMs: 8000 },
supplement: { ...supplement, tests: 1, passed: 1, failed: 0, outputSha256: hash(supplement.output), logSha256: hash(supplement.log) },
unchangedAssertions: ['tests/api.test.mjs', 'tests/helpers.mjs'].map(file => ({ path: file, sha256: hash(file) })),
decision: 'Proceed to independent candidate acceptance using the original complete run plus exact unchanged semantic-path supplement. This is not a whole-suite all-pass claim; no product/test timeout, assertion, permission or budget is changed.',
limits: ['Unique cause of the first-state scheduling timeout remains unproven.', 'Concurrent-load and controlled-Harness startup stability remain unresolved.'],
realModelRequests: 0, reviewedAt: new Date().toISOString() };
fs.writeFileSync(root + '/full-suite-review.json', JSON.stringify(review, null, 2) + '\n', { flag: 'wx' });
console.log(JSON.stringify(review));