// Question: do return 230's mechanical registry claims hold, independently // of its source-level interpretations and the pending integration audit? const fs=require('node:fs'),path=require('node:path'),crypto=require('node:crypto'),assert=require('node:assert/strict'); const started=performance.now(),cpuStarted=process.cpuUsage(); const inputText=fs.readFileSync('registry-729-inputs.json','utf8'); assert.equal(crypto.createHash('sha256').update(inputText).digest('hex'),'a210713c4763dff2ac361828af88bf919c6d8561b1b86c427b556a287aa45276'); const input=JSON.parse(inputText),sha=s=>crypto.createHash('sha256').update(s).digest('hex'),lf=s=>s.replace(/\r\n/g,'\n'),norm=s=>s.replace(/\s+/g,' ').trim(); // Load exactly the primary parser and summarise closure, not a copied model // of their behavior. No project generation, network request or mutation runs. const parserBegin=input.generator.indexOf('function parseBlock(file) {'),parserEnd=input.generator.indexOf('\nfunction todoItems()',parserBegin);assert(parserBegin>=0&&parserEnd>parserBegin); const summary=input.generator.match(/const summarise = id => \{[\s\S]*?\n \};/)[0]; const constants=['STATUSES','BLOCK_RE'].map(n=>input.generator.match(new RegExp('^const '+n+' .+$','m'))[0]).join('\n'); const byId=new Map(),C={read:file=>input.notes[file].content}; const {parseBlock,summarise}=new Function('C','path','byId',constants+'\n'+input.generator.slice(parserBegin,parserEnd)+'\n'+summary+'\nreturn {parseBlock,summarise};')(C,path,byId); function cells(line){const out=[];let current='';for(let i=0;i['OPEN','PARTIAL'].includes(r.status));assert.deepEqual(apiOpen.map(r=>r.id),input.archived_53.map(r=>r.id)); const noteHashes=[];for(const[file,n]of Object.entries(input.notes)){assert.equal(sha(lf(n.content)),n.lf_sha256);noteHashes.push([file,n.lf_sha256]);} for(const old of input.archived_53){const entries=[];for(const n of old.notes){assert.equal(input.notes[n.path].lf_sha256,n.sha256);const parsed=parseBlock(n.path);assert(parsed.block);assert.equal(parsed.block.id,old.id);assert.deepEqual(parsed.problems,[]);entries.push(parsed);}entries.sort((a,b)=>a.fileb.file?1:0);byId.set(old.id,entries);} const checked=input.archived_53.map(old=>{const actual=summarise(old.id),row=rows.get(old.id),status_ok=norm(actual.status)===norm(row.status),verdict_ok=norm(actual.verdict)===norm(row.verdict);assert.equal(status_ok,old.status_ok);assert.equal(verdict_ok,old.verdict_ok);return{row:old.row,id:old.id,status_ok,verdict_ok,current:status_ok&&verdict_ok,source_notes:old.notes.length};}); const swept=checked.filter(r=>r.row>=23&&r.row<=37),stale=checked.filter(r=>!r.current);assert.equal(swept.length,15);assert.deepEqual(swept.filter(r=>!r.current).map(r=>r.row),[37]);assert.equal(stale.length,6); const oldLines=input.row37_patch.split('\n').filter(s=>s.startsWith('-|')).map(s=>s.slice(1)),newLines=input.row37_patch.split('\n').filter(s=>s.startsWith('+|')).map(s=>s.slice(1));assert.equal(oldLines.length,2);assert.equal(newLines.length,2);let revised=input.registry; for(let i=0;i<2;i++){assert.equal(revised.split(oldLines[i]).length-1,1);revised=revised.replace(oldLines[i],newLines[i]);} assert.equal(revised,input.proposed_registry_232);assert.equal(sha(revised),'86d4399452b0b991df350132b18afe7e359ab2cb61084876606abcaa79ffbc3f'); assert.equal(norm(cells(newLines[1])[3]),norm(summarise('Q-derive-0904-L7-transfer').verdict)); const note=input.notes['research/history/staging/derive-0904-L7-transfer.md'];assert.equal(sha(lf(note.content)),input.accepted_152.revision_sha);assert.equal(input.accepted_152.status,'accepted');assert.equal(input.accepted_152.final_rung,'verified');assert.equal(input.accepted_152.patch_status,'integrated'); // A genuine negative control: replacing the source ledger verdict with its // old indexed value defeats the source-equals-accepted and current-row gates. const oldVerdict=rows.get('Q-derive-0904-L7-transfer').verdict,changed=note.content.replace(/^verdict: .+$/m,'verdict: '+oldVerdict);assert.notEqual(sha(lf(changed)),input.accepted_152.revision_sha);assert.notEqual(norm(oldVerdict),norm(summarise('Q-derive-0904-L7-transfer').verdict)); const result={job_id:729,input_sha256:sha(inputText),primary_generator_sha256:sha(input.generator),full_registry_rows:rows.size,api_questions:input.api.counts.total,api_open_partial:apiOpen.length,fresh_note_count:noteHashes.length,all64_archived_source_LF_hashes_match_fresh:true,registry_sha256:sha(lf(input.registry)),reported_registry_digest_length:input.reported_registry_digest_230.length,reported_registry_digest_230_matches:false,corrected_registry_232_sha256:sha(revised),two_patch_lines_exact_revision_match:true,accepted152_note_sha256:input.accepted_152.revision_sha,accepted152_creation:input.accepted_152.created_at,accepted152_decision:input.accepted_152.decision.decided_at,accepted152_effects_applied:input.accepted_152.effects_applied_at,sweep_23_37:swept,all_api_stale_rows:stale,old_verdict_negative_control_defeats_source_hash_and_row:true,scope:'Exact 15-row and 53-row mechanical API-scope claims and source/patch custody. No 554-row staleness sweep, historical raw CRLF verification, underlying source-math re-derivation, integration or novel theorem.'}; assert.equal(result.reported_registry_digest_length,63);assert.equal(result.full_registry_rows,554);assert.equal(result.registry_sha256,'e2ddcfc55f89be535041515a26fbc5068db832a7db548d35765b75f5360ff60e'); process.stdout.write(JSON.stringify(result,null,2)+'\n');const cpu=process.cpuUsage(cpuStarted);process.stderr.write(JSON.stringify({wall_seconds:(performance.now()-started)/1000,cpu_seconds:(cpu.user+cpu.system)/1e6,maxRSS_kib:process.resourceUsage().maxRSS})+'\n');