import fs from 'node:fs'; import path from 'node:path'; import assert from 'node:assert/strict'; import { execFileSync } from 'node:child_process'; import { createHash } from 'node:crypto'; const read = file => JSON.parse(fs.readFileSync(file, 'utf8')); const hash = file => createHash('sha256').update(fs.readFileSync(file)).digest('hex'); const root = '.qa/working-memory-u/release'; const freeze = read(root + '/product-freeze.json'), build = read(root + '/rebuild.json').result; assert.equal(build.success, true); const extra = build.inputs.filter(row => !freeze.files.some(input => input.path === row.path)); assert.deepEqual(extra.map(row => row.path).sort(), ['cli.mjs','normalize.mjs','package.json','render.mjs','summary.mjs'].map(name => 'examples/delivery-report/dist/' + name).sort()); for (const input of freeze.files) assert.equal(build.inputs.find(row => row.path === input.path)?.sha256, input.sha256); execFileSync(process.execPath, ['scripts/build.mjs'], { cwd: path.join(build.destination, 'examples/delivery-report'), windowsHide: true }); for (const input of extra) assert.equal(hash(path.join(build.destination, input.path)), input.sha256); const result = { success: true, trackedInputs: freeze.files.length, archiveInputs: build.inputCount, extra, unchanged: true, sourceCommit: freeze.sourceCommit, realModelRequests: 0, scope: 'Five declared ignored example dist inputs rebuilt independently from exact extracted source ZIP and matched byte hashes. No immutable payload changes.' }; fs.writeFileSync(root + '/extra-example-inputs.json', JSON.stringify(result, null, 2) + '\n', { flag: 'wx' }); console.log(JSON.stringify(result));