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

22 lines
3.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import fs from 'node:fs';
import path from 'node:path';
import assert from 'node:assert/strict';
import { createHash } from 'node:crypto';
import { execFileSync } from 'node:child_process';
const hash = bytes => createHash('sha256').update(bytes).digest('hex');
const identityPath = 'docs/task-control-release-identity.json', identity = JSON.parse(fs.readFileSync(identityPath, 'utf8'));
assert.equal(identity.success, true); assert.equal(identity.version, '1.20.1');
assert.equal(execFileSync('git', ['status', '--porcelain'], { encoding: 'utf8', windowsHide: true }).trim(), '');
const commit = execFileSync('git', ['rev-parse', 'HEAD'], { encoding: 'utf8', windowsHide: true }).trim();
const audit = JSON.parse(fs.readFileSync('.qa/task-control-j-final-audit.json', 'utf8')); assert.equal(audit.success, true); assert.equal(audit.finalGitCommit, commit);
const root = path.join('releases', path.basename(identity.release.portableRoot)), markdown = root + '-ACCEPTANCE.md', json = root + '-ACCEPTANCE.json', finalAudit = root + '-FINAL-AUDIT.json';
for (const file of [markdown, json, finalAudit]) assert.equal(fs.existsSync(file), false);
const artifacts = ['installer', 'portable', 'source'].map(kind => { const row = identity.release[kind], bytes = fs.readFileSync(row.path); assert.equal(hash(bytes), row.sha256); assert.equal(bytes.length, row.bytes); return { kind, filename: path.basename(row.path), bytes: row.bytes, sha256: row.sha256 }; });
const tests = identity.validation.source.tests;
const text = '# Agent Workbench 1.20.1 本地修复验收\n\n原目标/诊断续接、审查来源、空参数兼容、失败用量与无进展控制已修复;暂停终态和Windows进程退出竞态已补齐。独立源码' + tests + '/' + tests + '、核心5组和相关历史5类UI、同载荷安装7组、正式26页及实际Electron两视口通过。原PID36552/Provider、模型连接及全部表/会话/工件保持。\n\n本轮真实模型请求0;固定HTTP验证控制和执行链,不代表自主推理收益。原用户任务、原工程业务测试与历史用量未重跑或改写。1.21和安装进度/性能方案保留。\n\n安装器/ZIP不可变,包内说明为构建时快照。最终见[验收](../docs/QA-1.20.1.md)、[回顾](../docs/RETROSPECTIVE-1.20.1.md)、[身份](../docs/task-control-release-identity.json)和[后续计划](../docs/NEXT-STEPS.md)。\n\n本地Git:`' + commit + '`;产品/QA来源:`' + identity.codeCommit + '`。\n\n| 工件 | 字节 | SHA-256 |\n| --- | ---: | --- |\n' + artifacts.map(row => '| ' + row.filename + ' | ' + row.bytes + ' | `' + row.sha256 + '` |').join('\n') + '\n';
fs.writeFileSync(markdown, text, { flag: 'wx' }); fs.copyFileSync('.qa/task-control-j-final-audit.json', finalAudit, fs.constants.COPYFILE_EXCL);
fs.writeFileSync(json, JSON.stringify({ success: true, at: new Date().toISOString(), localGitCommit: commit, identityPath, identitySha256: hash(fs.readFileSync(identityPath)), artifacts,
notes: { path: markdown, sha256: hash(Buffer.from(text)) }, finalAudit: { path: finalAudit, sha256: hash(fs.readFileSync(finalAudit)) }, identity,
scope: 'Detached final acceptance; immutable executable and archives remain exact.' }, null, 2) + '\n', { flag: 'wx' });
console.log(JSON.stringify({ success: true, commit, markdown, json, finalAudit }));