37 lines
4.8 KiB
JavaScript
37 lines
4.8 KiB
JavaScript
import fs from 'node:fs';
|
|
import path from 'node:path';
|
|
import assert from 'node:assert/strict';
|
|
import { createHash } from 'node:crypto';
|
|
const hash = bytes => createHash('sha256').update(bytes).digest('hex');
|
|
const read = file => JSON.parse(fs.readFileSync(file));
|
|
const accepted = read('.qa/desktop-host-f-accepted-code-release.json');
|
|
const fresh = read('releases/latest.json');
|
|
const source = read('.qa/desktop-host-f-accepted-source.json'); assert.equal(source.success, true);
|
|
const runner = read('.qa/desktop-host-f-equivalence-final-result.json'); assert.equal(runner.success, false); assert.equal(runner.unchangedInputs, true);
|
|
const docs = file => file.startsWith('docs/') || ['README.md', 'CHANGELOG.md', 'DESIGN.md', 'AGENTS.md', 'task_plan.md', 'findings.md', 'progress.md'].includes(file);
|
|
const pairs = [];
|
|
for (const kind of ['portable', 'source']) {
|
|
const before = read(path.join(accepted[kind + 'Root'], 'MANIFEST.json')), after = read(path.join(fresh[kind + 'Root'], 'MANIFEST.json'));
|
|
const a = new Map(before.files.filter(row => !docs(row.path)).map(row => [row.path, row])), b = new Map(after.files.filter(row => !docs(row.path)).map(row => [row.path, row]));
|
|
const changed = [...new Set([...a.keys(), ...b.keys()])].filter(file => JSON.stringify(a.get(file)) !== JSON.stringify(b.get(file)));
|
|
assert.deepEqual(changed, ['runtime/REA-RUNTIME.json']);
|
|
const original = read(path.join(accepted[kind + 'Root'], changed[0])), current = read(path.join(fresh[kind + 'Root'], changed[0]));
|
|
assert.notEqual(current.builtAt, original.builtAt); assert.deepEqual({ ...current, builtAt: original.builtAt }, original);
|
|
pairs.push({ kind, acceptedRoot: accepted[kind + 'Root'], freshRoot: fresh[kind + 'Root'], originalRuntimeSha256: a.get(changed[0]).sha256,
|
|
freshRuntimeSha256: b.get(changed[0]).sha256, originalBuiltAt: original.builtAt, freshBuiltAt: current.builtAt, soleChangedRuntimeField: '/builtAt', identicalOtherRuntimeFiles: a.size - 1 });
|
|
}
|
|
const directory = 'docs/desktop-host-f-runtime-time'; assert.equal(fs.existsSync(directory), false); fs.mkdirSync(directory);
|
|
fs.writeFileSync(path.join(directory, '.gitattributes'), '* -text\n*.txt binary\n*.log binary\n');
|
|
const inputs = ['.qa/desktop-host-f-equivalence-final-result.json', runner.log, 'releases/latest.json',
|
|
path.join(accepted.portableRoot, 'runtime/REA-RUNTIME.json'), path.join(fresh.portableRoot, 'runtime/REA-RUNTIME.json'), '.qa/record-desktop-f-runtime-time.mjs'];
|
|
const files = inputs.map((file, index) => {
|
|
const bytes = fs.readFileSync(file), destination = path.join(directory, String(index + 1).padStart(3, '0') + '-' + path.basename(file));
|
|
fs.writeFileSync(destination, bytes, { flag: 'wx' }); return { source: path.resolve(file), path: destination.replaceAll('\\', '/'), bytes: bytes.length, sha256: hash(bytes) };
|
|
});
|
|
const result = { success: true, version: '1.15.0', freshCandidateAccepted: false, pairs, files, recordedAt: new Date().toISOString(),
|
|
scope: 'Original full equivalence failure is retained. All non-documentation bytes except REA runtime manifest matched; complete parsed manifests differ only at builtAt. The final documentation package will inherit all original accepted runtime bytes and generate new outer manifests/ZIPs/setup in new directories, followed by strict equivalence and exact final acceptance.' };
|
|
fs.writeFileSync('docs/desktop-host-f-runtime-time-evidence.json', JSON.stringify(result, null, 2), { flag: 'wx' });
|
|
fs.appendFileSync('docs/RETROSPECTIVE-1.15.md', '\n\n### 运行库时间字段与最终发行身份\n\n标准重新打包的最终候选仅runtime/REA-RUNTIME.json发生字节差异;完整结构核对确认唯一字段为builtAt,其余代码、依赖、构建、基准与许可证完全相同。[原差异与失败](desktop-host-f-runtime-time-evidence.json)保留。最终说明发行采用已通过的不可变候选全部运行字节,并从当前Git文档生成新的外层清单、ZIP和精确安装器;仍执行完整字节等价、最终归档/便携/安装和正式保留状态验收。运行库沿用其原制作时间,外层发行记录本次真实时间。\n');
|
|
fs.appendFileSync('progress.md', '\n\nF最终说明包首次全字节对照拒绝REA运行清单的builtAt时间变化,原失败日志和两份完整清单已封存,结构比较只此字段变化。最终包从已验收候选继承全部运行字节,加入当前说明后生成全新清单/ZIP/安装器;原候选保持,不改变360源码/测试/构建输入或491项/179组原结果。文档同步首次过期计划段落匹配中止后,保留已完成的三个文档并从当前F段落续写,未触碰产品或正式服务。\n');
|
|
console.log(JSON.stringify({ success: true, freshCandidateAccepted: false, pairs: pairs.map(row => ({ kind: row.kind, field: row.soleChangedRuntimeField, identicalOtherRuntimeFiles: row.identicalOtherRuntimeFiles })), files: files.length }));
|