test: seal working memory U release and retrospective

This commit is contained in:
Agent Workbench Dev
2026-11-04 08:39:17 +08:00
parent 7e77fd65c3
commit 13849d038f
639 changed files with 1612445 additions and 29 deletions
+1 -1
View File
@@ -22,7 +22,7 @@ export async function verifyControlledApi({ api, url, token, directory, appRoot,
const origin = new URL(url);
assert.equal(origin.hostname, '127.0.0.1'); assert.notEqual(origin.port, '4318');
const expectedVersion = JSON.parse(fs.readFileSync(path.join(appRoot, fs.existsSync(path.join(appRoot, 'MANIFEST.json')) ? 'MANIFEST.json' : 'package.json'), 'utf8')).version;
assert.ok(['1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1', '1.20.2', '1.20.3', '1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7'].includes(expectedVersion));
assert.ok(['1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1', '1.20.2', '1.20.3', '1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.8'].includes(expectedVersion));
const bootstrap = await api('/bootstrap'); assert.equal(bootstrap.version, expectedVersion);
assert.equal(bootstrap.config.mode, 'demo'); assert.equal(bootstrap.config.hasKey, false);
const root = path.join(directory, 'compiled-controlled-node'), hooks = path.join(directory, 'disabled-hooks');
+7 -7
View File
@@ -34,7 +34,7 @@ for (const name of Object.keys(env)) if (name.toLowerCase() === 'path') delete e
const windowsRoot = process.env.SystemRoot || 'C:\\Windows';
env.PATH = [windowsRoot, path.join(windowsRoot, 'System32'), path.join(windowsRoot, 'System32', 'WindowsPowerShell', 'v1.0')].join(path.delimiter);
let externalGit = null;
if (['1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1','1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7'].includes(manifest.version)) {
if (['1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1','1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.8'].includes(manifest.version)) {
// The controlled project requires external Git. Preserve its observed binary
// directory while keeping system Node/npm unavailable to the packaged host.
const binary = fs.realpathSync.native(execFileSync('where.exe', ['git.exe'], { env: gitEnvironment(), encoding: 'utf8', windowsHide: true, timeout: 10000 }).trim().split(/\r?\n/)[0]);
@@ -88,7 +88,7 @@ try {
console.log((await launch()).trim());
assert.equal(JSON.parse(fs.readFileSync(path.join(data, 'service-info.json'), 'utf8')).pid, firstInfo.pid);
const example = bootstrap.projects.find(project => project.id === bootstrap.exampleProjectId);
if (['1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1','1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7'].includes(manifest.version)) {
if (['1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1','1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.8'].includes(manifest.version)) {
assert.equal(path.resolve(example.root).toLowerCase(), path.join(data, 'projects', 'starter-project').toLowerCase());
const compareTemplate = relative => { for (const entry of fs.readdirSync(path.join(appRoot, 'examples/starter-project', relative), { withFileTypes: true })) {
const next = path.join(relative, entry.name); if (entry.isDirectory()) compareTemplate(next);
@@ -114,7 +114,7 @@ try {
const checkLog = await api('/artifacts/' + checked.results[0].logArtifactId + '?session=' + session.id); assert.match(checkLog.content, /tests 4/);
assert.ok(fs.existsSync(path.join(appRoot, 'runtime/node_modules/npm/bin/npm-cli.js')));
const actualRea = [];
if (['1.8.0', '1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1','1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7'].includes(manifest.version)) {
if (['1.8.0', '1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1','1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.8'].includes(manifest.version)) {
const installation = await api('/research/availability'); assert.equal(installation.status, 'available'); assert.equal(installation.version, '6.8.0');
assert.equal(fs.realpathSync.native(installation.packageRoot), fs.realpathSync.native(path.join(appRoot, 'runtime/node_modules/rea-agents')));
assert.equal(fs.realpathSync.native(installation.node.path), fs.realpathSync.native(path.join(appRoot, 'runtime/node.exe')));
@@ -146,7 +146,7 @@ try {
console.log('PASS actual contained REA: ASAR, PE imports and PE resources; zero target execution/model requests');
}
let actualEngine = null;
if (['1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1','1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7'].includes(manifest.version) && process.argv.includes('--native-engines')) {
if (['1.9.0', '1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1','1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.8'].includes(manifest.version) && process.argv.includes('--native-engines')) {
const installation = await api('/engines/deepseek/availability'); assert.equal(installation.status, 'available', installation.message);
assert.equal(fs.realpathSync.native(installation.node.path), fs.realpathSync.native(path.join(appRoot, 'runtime/node.exe')));
const engineRoot = path.join(data, 'engine-project'); fs.mkdirSync(engineRoot); fs.writeFileSync(path.join(engineRoot, 'README.md'), '# Owned portable engine connection\n');
@@ -166,8 +166,8 @@ try {
assert.equal((await api('/research')).length, 4);
const page = await fetch(url); assert.equal(page.status, 200);
assert.match(await page.text(), /Agent Workbench/);
const actualBrowser = ['1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1','1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7'].includes(manifest.version) ? await verifyBrowserApi({ api, url, token: bootstrap.token, directory: data, appRoot, contained: true }) : null;
const actualControlled = ['1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1','1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7'].includes(manifest.version) ? await verifyControlledApi({ api, url, token: bootstrap.token, directory: data, appRoot, contained: true }) : null;
const actualBrowser = ['1.10.0', '1.10.1', '1.11.0', '1.12.0', '1.12.1', '1.13.0', '1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1','1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.8'].includes(manifest.version) ? await verifyBrowserApi({ api, url, token: bootstrap.token, directory: data, appRoot, contained: true }) : null;
const actualControlled = ['1.14.0', '1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1','1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.8'].includes(manifest.version) ? await verifyControlledApi({ api, url, token: bootstrap.token, directory: data, appRoot, contained: true }) : null;
console.log((await stop()).trim()); started = false;
await until(async () => { try { await fetch(url + '/api/health'); return false; } catch { return true; } });
for (const file of manifest.files) {
@@ -176,7 +176,7 @@ try {
}
const result = { success: true, date: new Date().toISOString(), appRoot, version: manifest.version, nodeVersion: manifest.nodeVersion,
verifiedFiles: manifest.files.length, url, reusedPid: firstInfo.pid, checks: { jobId, status: checked.status, tests: checked.results[0].tests }, actualRea, actualEngine, actualBrowser, actualControlled, externalGit,
steps: ['manifest hashes', 'bundled Node launch', 'same-service reuse', 'packaged example and static page', ...(['1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1','1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7'].includes(manifest.version) ? ['starter project copied to owned user data; original template bytes matched'] : []), 'explicit command consent', 'actual bundled Node version', 'actual bundled npm check without system Node/npm', 'check log artifact', ...(actualRea.length ? ['contained REA installation and Node identity', 'actual ASAR/imports/resources', 'original Bundle and target hash binding', 'verified reuse without producer replay'] : []), 'report availability', 'graceful stop', 'every original packaged file remains unchanged'], realModel: false };
steps: ['manifest hashes', 'bundled Node launch', 'same-service reuse', 'packaged example and static page', ...(['1.15.0', '1.16.0', '1.17.0', '1.18.0', '1.19.0', '1.20.0', '1.20.1','1.21.0', '1.22.0', '1.22.1', '1.23.0', '1.24.0', '1.24.1', '1.24.2', '1.24.3', '1.24.4', '1.24.5', '1.24.6', '1.24.7', '1.24.8'].includes(manifest.version) ? ['starter project copied to owned user data; original template bytes matched'] : []), 'explicit command consent', 'actual bundled Node version', 'actual bundled npm check without system Node/npm', 'check log artifact', ...(actualRea.length ? ['contained REA installation and Node identity', 'actual ASAR/imports/resources', 'original Bundle and target hash binding', 'verified reuse without producer replay'] : []), 'report availability', 'graceful stop', 'every original packaged file remains unchanged'], realModel: false };
fs.writeFileSync('.qa/release-validation.json', JSON.stringify(result, null, 2));
console.log(JSON.stringify(result, null, 2));
} finally { if (started) { try { await stop(); } catch {} } }
+96
View File
@@ -0,0 +1,96 @@
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';
import {verifyPlanEvidence} from '../src/core/context/request-plan.mjs';
import {assertToolPairs} from '../tests/helpers.mjs';
if(process.argv.includes('--help')){console.log('node scripts/verify-working-memory-u.mjs [--index] — offline sealed bytes, actual request coverage/provenance and retained state. No model, installer or task replay.');process.exit(0);}
assert.ok(process.argv.length===2||process.argv.length===3&&process.argv[2]==='--index');
const root=path.resolve('docs/working-memory-u-evidence'),index=process.argv.includes('--index');
const sha=b=>createHash('sha256').update(b).digest('hex'),read=r=>JSON.parse(fs.readFileSync(path.join(root,r),'utf8').replace(/^\uFEFF/,''));
const manifest=read('manifest.json'),names=new Set();let bytes=0,indexBytes=0;
for(const e of manifest.entries){
assert.equal(names.has(e.path),false);names.add(e.path);const p=path.resolve(root,e.path);assert.ok(p.startsWith(root+path.sep));
const b=fs.readFileSync(p);assert.equal(b.length,e.bytes,e.path);assert.equal(sha(b),e.sha256,e.path);bytes+=b.length;
if(e.path.endsWith('.png'))assert.equal(b.subarray(0,8).toString('hex'),'89504e470d0a1a0a');
if(/\.jpe?g$/.test(e.path))assert.equal(b.subarray(0,3).toString('hex'),'ffd8ff');
}
const walk=d=>fs.readdirSync(d,{withFileTypes:true}).flatMap(e=>{const p=path.join(d,e.name);assert.equal(fs.lstatSync(p).isSymbolicLink(),false);return e.isDirectory()?walk(p):[path.relative(root,p).replaceAll('\\','/')];});
assert.deepEqual(walk(root).filter(p=>p!=='manifest.json').sort(),[...names].sort());
assert.equal(manifest.count,names.size);assert.equal(manifest.bytes,bytes);assert.equal(manifest.realModelRequests,0);
const freeze=read('receipts/release/product-freeze.json'),identity=read('release-identity.json');
assert.equal(identity.sourceCommit,manifest.sourceCommit);assert.equal(freeze.sourceCommit,manifest.sourceCommit);assert.equal(identity.version,'1.24.8');
assert.equal(freeze.files.length,564);assert.equal(freeze.compiled.length,22);
for(const v of freeze.compiled)assert.equal(sha(fs.readFileSync(path.join(root,'compiled',v.path))),v.sha256);
for(const v of freeze.files.filter(v=>names.has('source-bytes/'+v.path)))assert.equal(sha(fs.readFileSync(path.join(root,'source-bytes',v.path))),v.sha256);
const build=read('validation/rebuild/result.json');assert.equal(build.success,true);assert.equal(build.sourceCommit,manifest.sourceCommit);
assert.equal(build.inputCount,569);assert.equal(build.compiled.length,22);assert.deepEqual(build.mismatches,[]);
for(const v of freeze.files)assert.equal(build.inputs.find(b=>b.path===v.path)?.sha256,v.sha256);
for(const v of build.compiled)assert.deepEqual(v.actual,v.expected);
assert.equal(read('receipts/release/extra-example-inputs.json').extra.length,5);
for(const mode of ['archives','memory','install','portable-final']){const r=read('receipts/release/'+mode+'.json');assert.equal(r.success,true,mode);assert.equal(r.sourceCommit,manifest.sourceCommit);}
for(const mode of ['portable','portable-recheck'])assert.equal(read('receipts/release/'+mode+'.json').success,false,'Preserve original verifier version-list failures');
for(const name of ['archives','portable'])assert.equal(read('validation/'+name+'.json').success,true);
const install=read('validation/install/result.json');assert.equal(install.success,true);assert.equal(install.version,'1.24.8');assert.equal(install.results.length,12);assert.ok(install.results.every(v=>v.passed));
for(const [name,count]of [['installed-results',16],['installed-files',9]]){const r=read('validation/'+name+'/result.json');assert.equal(r.success,true);assert.equal(r.checks.length,count);assert.deepEqual(r.errors,[]);}
const tap=fs.readFileSync(path.join(root,'receipts/final-core.tap'),'utf8');assert.match(tap,/pass 114\b/);assert.match(tap,/fail 0\b/);
const before=read('receipts/replay-before.json'),after=read('receipts/replay-after.json');assert.equal(before.covered,1643);assert.equal(after.covered,2584);assert.deepEqual(after.candidateRanges,[[0,2584]]);assert.equal(after.sourceSha256,before.sourceSha256);
const reference=read('original-t-reference.json'),oldRoot=path.resolve('docs/live-delivery-t-evidence');
assert.equal(sha(fs.readFileSync(reference.path)),reference.sha256);const oldManifest=JSON.parse(fs.readFileSync(reference.path));
for(const e of oldManifest.files){const p=path.resolve(oldRoot,e.path);assert.ok(p.startsWith(oldRoot+path.sep));const b=fs.readFileSync(p);assert.equal(sha(b),e.sha256);assert.equal(b.length,e.bytes);}
const oldRead=r=>JSON.parse(fs.readFileSync(path.join(oldRoot,'run',r),'utf8'));
const original=oldRead('node/export.json'),state=oldRead('node/session.json').execution,oldArtifacts=oldRead('analysis/artifact-index.json').artifacts;
function makeStore(core,load){return{core,owned(kind,id,sid){const v=core[kind]?.get(id);assert.ok(v,kind+':'+id);assert.equal(v.sessionId,sid);return v;},artifactStore:{read(a){const b=load(a);assert.equal(sha(b),a.sha256);return b.toString('utf8');}}};}
const oldCore={artifact:new Map(oldArtifacts.map(a=>[a.id,a])),tool:new Map(oldRead('analysis/owned-tool-rows.json').map(r=>{const v=JSON.parse(r.payload);return[v.id,v];})),run:new Map([[state.run.id,state.run]]),task:new Map([[state.task.id,state.task]])};
const oldLoad=a=>fs.readFileSync(path.join(oldRoot,'run',a.capturedPath));
for(const p of state.contextPlans)verifyPlanEvidence(makeStore(oldCore,oldLoad),original.session,p);
assert.equal(state.contextPlans.length,8);assert.equal(read('receipts/history-result.json').originalRequestsRewritten,0);
const fixture=read('original-t-fixture.json'),files=fixture.files.filter(f=>['test/expense.test.mjs','src/amount.mjs','src/summary.mjs','src/report.mjs'].includes(f.path));
function coverage(body){
assertToolPairs(body.messages);assert.ok(body.messages[0].content.includes(JSON.stringify(fixture.goal)));
for(const file of files){assert.equal(sha(file.content),file.sha256);const positions=new Set();
for(const m of body.messages){const spans=[];
if(m.role==='tool'){const v=JSON.parse(m.content);if(v.path===file.path&&typeof v.content==='string')spans.push({offset:v.offset??0,content:v.content});}
if(m.role==='system'){let v;try{v=JSON.parse(m.content.split('\n').at(-1));}catch{}for(const e of v?.data?.entries??[])if(e.observation?.path===file.path)spans.push({offset:e.observation.offset??0,content:e.content});}
for(const s of spans){assert.equal(s.content,file.content.slice(s.offset,s.offset+s.content.length));for(let i=s.offset;i<s.offset+s.content.length;i++)positions.add(i);}
}assert.equal(positions.size,file.content.length,file.path);
}
const marker='当前工程执行依据(每次请求重新核对,非操作授权):\n';const facts=JSON.parse(body.messages[0].content.split(marker)[1].split('\n')[0]);
assert.equal(facts.stage,'checks_need_repair');assert.equal(facts.has_applied_changes,false);assert.equal(facts.latest_check.current_source,true);
assert.equal(facts.latest_check.results[0].tests.failed,9);assert.equal(facts.latest_check.results[1].status,'passed');
return facts;
}
function verifyFacts(facts,execution,store){
const job=execution.checks.find(j=>j.id===facts.latest_check.id),plan=execution.plans.find(p=>p.id===facts.check_plan.id);
assert.ok(job&&plan);assert.equal(job.planId,plan.id);assert.equal(job.status,facts.latest_check.status);assert.equal(plan.sourceFingerprint,facts.source_fingerprint);
for(const f of facts.latest_check.results){const r=job.results.find(v=>v.name===f.name);assert.ok(r);assert.equal(r.status,f.status);assert.deepEqual(r.tests??null,f.tests);assert.equal(r.logArtifactId,f.log_artifact_id);const a=store.owned('artifact',f.log_artifact_id,job.sessionId);assert.equal(a.sha256,f.log_sha256);store.artifactStore.read(a);}
}
for(const number of [7,8]){
const prefix='receipts/wire-'+number+'-final/',plan=read(prefix+'record.json'),core={...oldCore,artifact:new Map(oldCore.artifact)};
const mapping=[['requestArtifactId','model-request'],['artifactId','context-plan'],['workingSetArtifactId','context-working-set'],['latestToolsArtifactId','context-latest-tools'],['historyIndexArtifactId','context-history-index']];
for(const [field,kind]of mapping){const id=plan[field];if(!id)continue;if(!fs.existsSync(path.join(root,prefix,id+'.json'))){assert.equal(core.artifact.get(id)?.kind,kind);continue;}const b=fs.readFileSync(path.join(root,prefix,id+'.json'));core.artifact.set(id,{id,kind,sha256:sha(b),sessionId:plan.sessionId,projectId:plan.projectId,taskId:plan.taskId,runId:plan.runId,sealedPath:prefix+id+'.json'});}
const wireStore=makeStore(core,a=>a.sealedPath?fs.readFileSync(path.join(root,a.sealedPath)):oldLoad(a));verifyPlanEvidence(wireStore,original.session,plan);
assert.deepEqual(read(prefix+'request.json'),read(prefix+plan.requestArtifactId+'.json'));verifyFacts(coverage(read(prefix+'request.json')),state,wireStore);
assert.ok(plan.estimatedInputTokens<=12352);assert.equal(plan.budget.contextLimit,16000);assert.equal(plan.budget.outputReservation,2048);assert.equal(plan.budget.safetyTokens,1600);
}
let fixturePlans=0;
for(const name of ['source-memory','portable-memory','installed-memory']){
const prefix='validation/'+name+'/',r=read(prefix+'result.json'),e=read(prefix+'export.json'),bodies=read(prefix+'requests.json');
assert.equal(r.success,true);assert.equal(r.version,'1.24.8');assert.equal(r.requests,7);assert.equal(r.checks.length,3);assert.deepEqual(r.errors,[]);
assert.equal(r.originalSourceUnchanged,true);assert.equal(r.originalNineTestsFailed,true);assert.equal(r.realModelDeliveryPassed,false);assert.equal(r.realModelRequests,0);
const core={artifact:new Map(e.execution.artifacts.map(a=>[a.id,a])),tool:new Map(),run:new Map(),task:new Map()};
for(const row of read(prefix+'owned-records.json'))if(core[row.kind]){const v=JSON.parse(row.payload);core[row.kind].set(v.id,v);}
const store=makeStore(core,a=>fs.readFileSync(path.join(root,prefix,'artifacts',a.relative)));
for(const p of e.execution.contextPlans){verifyPlanEvidence(store,e.session,p);assert.ok(p.estimatedInputTokens<=12352);fixturePlans++;}
assert.equal(e.execution.contextPlans.length,7);for(const body of bodies.slice(5))verifyFacts(coverage(body),e.execution,store);assert.equal(e.session.changes.length,0);
}
assert.equal(read('receipts/formal-release/before.json').success,false);assert.equal(read('receipts/formal-release/before-recheck.json').success,true);
const initial=read('receipts/production-before.json'),pre=read('receipts/formal-release/private-before.json');
function same(a,b){for(const key of ['pid','hasKey','configSha256','projectsSha256','sessionsSha256','eventCursor','exports','persistent','modelCenterSha256'])assert.deepEqual(b[key],a[key],key);assert.deepEqual(b.database.tables,a.database.tables);assert.deepEqual(b.database.sessionIds,a.database.sessionIds);}
same(initial,pre);
for(const mode of ['install','final']){const r=read('receipts/formal-release/'+mode+'.json');assert.equal(r.success,true);assert.equal(r.version,'1.24.8');assert.equal(r.pid,36552);assert.equal(r.inspectorClosed,true);same(pre,read('receipts/formal-release/'+mode+'-private-after.json'));}
const browser=read('receipts/release/browser-review/result.json');assert.equal(browser.success,true);assert.equal(browser.views.length,2);assert.deepEqual(browser.errors,[]);assert.deepEqual(browser.rejectedWrites,[]);
assert.equal(read('receipts/native/result.json').success,true);
if(index)for(const relative of [...names,'manifest.json']){const b=fs.readFileSync(path.join(root,relative)),blob=execFileSync('git',['cat-file','blob',':docs/working-memory-u-evidence/'+relative],{maxBuffer:Math.max(1024*1024,b.length+1024)});assert.deepEqual(blob,b,relative);indexBytes+=blob.length;}
console.log(JSON.stringify({success:true,version:identity.version,sourceCommit:manifest.sourceCommit,count:names.size,bytes,manifestSha256:sha(fs.readFileSync(path.join(root,'manifest.json'))),independentInputs:569,compiled:22,relatedTests:114,fixturePlans,historicalPlans:8,reconstructedPlans:2,realModelRequests:0,realDeliveryPassed:false,purgeBenefitMeasured:false,formalPid:36552,originalProjects:pre.projects,originalSessions:pre.database.sessionIds.length,...(index?{indexFiles:names.size+1,indexBytes}:{}),scope:'Read-only actual sealed bytes, typed request coverage and provenance; no configured-model calls or original driver replay.'}));