// Archive bounded host disk checks; never starts a VM or grants roadmap moves. import assert from 'node:assert/strict'; import {spawnSync} from 'node:child_process'; import {createHash} from 'node:crypto'; import {copyFileSync,mkdirSync,mkdtempSync,readFileSync,writeFileSync} from 'node:fs'; import {join} from 'node:path'; const root=process.cwd(),dir=mkdtempSync('reports/os-implementation/K2160-disk-transition-host-'); const digest=path=>createHash('sha256').update(readFileSync(path)).digest('hex'); const artifact=path=>({path,sha256:digest(path)}); const files=[]; for(const path of [ 'scripts/os-acceptance/features/k2160-disk-check.mjs', 'scripts/os-acceptance/k2160-fixture.mjs', 'scripts/os-acceptance/file-map-disk.mjs', 'tools/reopen_verify/test_disk_transition.mjs', 'tools/reopen_verify/prepare_disk_transition.mjs', 'kernel/tests/os/fixtures/turkfs-journal-v1.bin', ]){ const saved=join(dir,'source',path+'.txt');mkdirSync(saved.slice(0,saved.lastIndexOf('/')),{recursive:true});copyFileSync(path,saved); files.push({original:artifact(path),copy:artifact(saved)}); } const run=spawnSync('node',['tools/reopen_verify/test_disk_transition.mjs'],{cwd:root,encoding:'utf8',timeout:30_000}); const log=join(dir,'host-check.log');writeFileSync(log,(run.stdout??'')+(run.stderr??'')); const report={schema:'turkos-k2160-disk-transition-host/v1',status:'HOST_DISK_TRANSITION_FAILED', guestAccepted:false,productAccepted:false,roadmapMovesAccepted:[],files,log:artifact(log), scope:'Five host disk transitions and eleven corruption controls. No QEMU, physical DMA/EL0, PSCI, or product acceptance.'}; try{ assert.ifError(run.error);assert.equal(run.status,0); const result=JSON.parse((run.stdout??'').trim()); assert.equal(result.status,'HOST_DISK_TRANSITION_CHECK_PASSED'); assert.equal(result.positiveCases,5);assert.equal(result.negativeControls,11); report.result=result;report.status='HOST_DISK_TRANSITION_PREPARATION_PASSED'; }catch(error){report.error=String(error);process.exitCode=1;} const path=join(dir,'report.json');writeFileSync(path,JSON.stringify(report,null,2)+'\n'); writeFileSync('/tmp/turkos-k2160-disk-transition.txt',path+'\n'); console.log(JSON.stringify({status:report.status,report:path}));