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'; // Byte/source/log verification only; no Runtime, Provider, credentials or network. const root=path.resolve('docs/live-network-b-evidence'),sha=value=>createHash('sha256').update(value).digest('hex'); const inside=relative=>{const file=path.resolve(root,relative);assert.ok(file.startsWith(root+path.sep));return file;}; const raw=fs.readFileSync(path.join(root,'manifest.json')),manifest=JSON.parse(raw); assert.equal(manifest.schemaVersion,1);assert.equal(manifest.realModelRequests,0);assert.equal(manifest.formalServiceChanged,false); assert.match(manifest.sourceCommit,/^[a-f0-9]{40}$/);const paths=new Set();let bytes=0; for(const entry of manifest.entries){assert.ok(!paths.has(entry.path));paths.add(entry.path);const file=fs.readFileSync(inside(entry.path)); assert.equal(file.length,entry.bytes);assert.equal(sha(file),entry.sha256);bytes+=file.length;} assert.equal(paths.size,manifest.count);assert.equal(bytes,manifest.bytes); for(const input of manifest.sourceInputs){ assert.match(input.path,/^(?:src|tests)\/[A-Za-z0-9_./-]+$|^package(?:-lock)?\.json$/);assert.ok(!input.path.split('/').includes('..')); const blob=execFileSync('git',['show',manifest.sourceCommit+':'+input.path],{maxBuffer:8*1024*1024,windowsHide:true}); assert.equal(sha(blob),input.gitBlobSha256);const source=fs.readFileSync(inside(input.snapshot));assert.equal(sha(source),input.sha256); assert.equal(source.toString('utf8').replaceAll('\r\n','\n'),blob.toString('utf8').replaceAll('\r\n','\n')); } const receipt=name=>fs.readFileSync(inside(manifest.receipts.find(entry=>entry.name===name).file),'utf8'); for(const [name,total,passed,failed] of [['related',94,94,0],['compiled-engine-first',16,14,2],['compiled-state',2,0,2],['compiled-cooldown',2,2,0],['initial-diagnostics',12,9,3]]){ const log=receipt(name);assert.match(log,new RegExp('tests '+total+'\\b'));assert.match(log,new RegExp('pass '+passed+'\\b'));assert.match(log,new RegExp('fail '+failed+'\\b')); } assert.match(receipt('build'),/Server bundle built\./); const a=JSON.parse(receipt('a-offline').trim());assert.equal(a.passed,true);assert.equal(a.manifestSha256,manifest.finalChecks.aManifestSha256); console.log(JSON.stringify({passed:true,sourceCommit:manifest.sourceCommit,manifestSha256:sha(raw),files:paths.size,bytes,realModelRequests:0, scope:'Offline source/byte/final-log validation with original failed Runs preserved; real-model/Purge benefit not measured.'}));