Files
Agent-Workbench/docs/task-control-j-release-evidence/0000-accept-task-control-independent.mjs
T
2026-11-01 16:35:58 +08:00

29 lines
2.7 KiB
JavaScript

import fs from 'node:fs';
import assert from 'node:assert/strict';
import { createHash } from 'node:crypto';
const read = file => JSON.parse(fs.readFileSync(file, 'utf8'));
const hash = bytes => createHash('sha256').update(bytes).digest('hex');
const release = read('.qa/task-control-final-candidate.json'), baseline = read('docs/task-control-release-code-baseline.json');
const phases = ['archives', 'source-retry', 'portable', 'portable-task-control', 'prepare-install', 'install'];
const accepted = phases.map(phase => {
const file = '.qa/task-control-f-' + phase + '-result.json', result = read(file);
assert.equal(result.success, true, phase); assert.equal(result.unchangedInputs, true);
assert.equal(result.release.setupSha256, release.installer.sha256); assert.equal(result.codeCommit, baseline.codeCommit);
const log = fs.readFileSync(result.logPath); assert.equal(log.length, result.logBytes); assert.equal(hash(log), result.logSha256);
return { phase, receipt: file, sha256: hash(fs.readFileSync(file)) };
});
const source = read('.qa/task-control-f-source-retry-original-validation.json');
assert.equal(source.success, true); assert.equal(source.tests.pass, source.tests.tests); assert.ok(source.tests.tests >= 604);
for (const key of ['fail', 'cancelled', 'skipped', 'todo']) assert.equal(source.tests[key], 0);
for (const row of source.logs) { const bytes = fs.readFileSync(row.path); assert.equal(bytes.length, row.bytes); assert.equal(hash(bytes), row.sha256); }
for (const row of [...baseline.inputs, ...baseline.builds, ...baseline.benchmarks]) { const bytes = fs.readFileSync(row.path); assert.equal(bytes.length, row.bytes); assert.equal(hash(bytes), row.sha256); }
const adjustment = read('.qa/task-control-f-source-wait-adjustment.json');
assert.equal(hash(fs.readFileSync(adjustment.originalScript)), adjustment.originalSha256);
assert.equal(hash(fs.readFileSync(adjustment.adjustedScript)), adjustment.adjustedSha256);
const result = { success: true, version: '1.20.1', release, codeCommit: baseline.codeCommit, accepted, tests: source.tests,
validationAdjustment: adjustment, unchangedInputs: true, realModelRequests: 0, acceptedAt: new Date().toISOString(),
originalFailure: '.qa/task-control-f-source-original-validation.json',
scope: 'Same immutable candidate throughout. Previously successful source stages retained by input/log hashes; only screenshot QA waits corrected in an external copy, then all remaining source gates and complete tests executed. Original failed receipts remain unmodified.' };
fs.writeFileSync('.qa/task-control-f-independent-accepted.json', JSON.stringify(result, null, 2) + '\n', { flag: 'wx' });
console.log(JSON.stringify({ success: true, tests: source.tests, phases }));