audit-negative-estate-candidates.mjs 2.1 KB

1234567
  1. import {readFileSync,writeFileSync} from 'node:fs'
  2. const dir='.scratch/cockpit-shell-panel-layout/verify/artifacts/t35/user-samples/',near=JSON.parse(readFileSync(dir+'report-v2.json')),target=near.targets.find(t=>t.name==='negative-estate'),root='tools/city-massing/city/cad-bim',cfg=JSON.parse(readFileSync('public/cockpit/config.json')),manifest=JSON.parse(readFileSync(root+'/city-regions-v7/manifest.json')),source=JSON.parse(readFileSync(root+'/'+manifest.source+'/manifest.json'))
  3. const ids=new Set(target.highRiseNotActive.map(b=>b.id)),refs=new Map()
  4. for(const [ri,r] of manifest.regions.entries())for(const f of r.fineRecords){const rec=source.records.find(x=>x.uri===f.sourceUri);for(const id of rec?.buildingIds||[])if(ids.has(id)){if(!refs.has(id))refs.set(id,[]);refs.get(id).push({region:ri,sourceUri:f.sourceUri,sourceCell:rec.sourceCell,contentCount:r.contentCount,decodedGeometryBytes:r.decodedGeometryBytes})}}
  5. const rows=target.highRiseNotActive.map(b=>({...b,sourceRefs:refs.get(b.id)||[],activeInConfiguredGraph:false,selectionReason:'rural source tier / outside current urban active manifest; requires local imagery and explicit tier decision'}))
  6. const report={generatedAt:'2026-10-14',target:target.target,radiusM:target.radiusM,configuredRegionManifest:cfg.map.tilesets[0].regionManifest,sourceGraph:manifest.source,rows,allRowsHaveSourceReference:rows.every(r=>r.sourceRefs.length>0),modelChanged:false,decision:'Candidate-only. No automatic rural restoration, no geometry edit, no region reallocation. Before a local pilot, reclassify only these evidence-backed IDs and create a separate immutable region generation; preserve current v7 until visual/budget/rollback evidence passes.',caps:{maxRegions:2,maxContents:180,maxDecodedBytes:100663296}}
  7. writeFileSync(dir+'negative-estate-highrise-candidates.json',JSON.stringify(report,null,2));console.log(JSON.stringify({passed:true,candidates:rows.length,allRowsHaveSourceReference:report.allRowsHaveSourceReference,rows:rows.map(r=>({id:r.id,refs:r.sourceRefs.length,regions:[...new Set(r.sourceRefs.map(x=>x.region))]})),modelChanged:false}))