Files
Agent-Workbench/docs/engineering-evals-f-release-evidence/0130-write-evals-acceptance.mjs
T
2026-11-01 12:31:20 +08:00

19 lines
3.2 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 identityFile = 'docs/engineering-evals-release-identity.json', identity = JSON.parse(fs.readFileSync(identityFile, 'utf8'));
assert.equal(identity.success, true); assert.equal(identity.version, '1.20.0');
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/evals-f-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 text = '# Agent Workbench 1.20.0 本地发行验收\n\n固定工程评测、同源原版/候选、原报告和受控采纳已完整本地交付。604/604独立源码、28类210组界面、四类工程14节点、源码/便携新评测5组、同载荷安装7组、正式26页及升级后原生回看通过。原PID36552/Provider、全部表/会话/模型中心/工件保持。\n\n固定HTTP证明执行链、隔离边界和来源绑定模块修复,不代表自主推理收益或全仓自升级。React依赖由QA显式准备;真实模型工程、视觉/Purge收益及新增iPhone流程仍单列待验。本轮真实模型请求0。\n\n安装器/ZIP保持不可变,包内说明为构建时快照。最终见[验收](../docs/QA-1.20.md)、[回顾](../docs/RETROSPECTIVE-1.20.md)、[身份](../docs/engineering-evals-release-identity.json)及[下一阶段](../docs/PLAN-1.21.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/evals-f-final-audit.json', finalAudit, fs.constants.COPYFILE_EXCL);
fs.writeFileSync(json, JSON.stringify({ success: true, at: new Date().toISOString(), localGitCommit: commit, identityPath: identityFile, identitySha256: hash(fs.readFileSync(identityFile)), 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 }));