// Rank evidence-backed large-building candidates for human imagery/DEM review; never mutates assets. import {readFileSync,writeFileSync,mkdirSync} from 'node:fs' import {resolve} from 'node:path' const audit=JSON.parse(readFileSync(resolve('.scratch/cockpit-shell-panel-layout/verify/artifacts/t35/large-building-audit/audit.json'))) const candidates=audit.candidates.filter(b=>b.tier==='urban').sort((a,b)=>b.areaSqm-a.areaSqm||a.id.localeCompare(b.id)) const group=(status)=>candidates.filter(b=>b.status===status) const queue=candidates.map((b,index)=>({rank:index+1,id:b.id,areaSqm:b.areaSqm,width:b.width,depth:b.depth,center:b.center,maskId:b.maskId,status:b.status,terrainRelief:b.terrainRelief,source:b.source,imageryReviewed:b.imageryReviewed,action:b.status==='terrain relief exceeds the allowed plinth; needs stepped construction'?'Review satellite roof/footprint, then design stepped construction and re-run DEM seat check':b.status==='seated-outside-active-selection'?'Review satellite roof and explicitly decide whether this non-running-tier building belongs in the city runtime':'Repair survey/DEM evidence before any geometry decision'})) const report={generatedAt:'2026-10-14',sourceAudit:'large-building-audit/audit.json',sourceLevel:'1:500 surveyed JMD polygon; height/facade estimated',totalUrbanCandidates:candidates.length,queue,summary:{terrainReview:group('terrain relief exceeds the allowed plinth; needs stepped construction').length,seatedOutside:group('seated-outside-active-selection').length,invalidOutline:group('self-intersecting survey outline cannot be extruded').length,missingDem:group('missing or invalid DEM sample').length},policy:'Queue only. Do not add geometry or restore rural assets until imagery and DEM/footprint review is explicitly accepted.'} mkdirSync(resolve('.scratch/cockpit-shell-panel-layout/verify/artifacts/t35/large-building-audit'),{recursive:true});writeFileSync(process.argv[2]||'.scratch/cockpit-shell-panel-layout/verify/artifacts/t35/large-building-audit/review-queue-v7.json',JSON.stringify(report,null,2));writeFileSync(process.argv[3]||'.scratch/cockpit-shell-panel-layout/verify/artifacts/t35/large-building-audit/review-queue-v7.md',['# Large building review queue v7','','Source: 1:500 surveyed JMD polygons; candidates are not confirmed missing rendered buildings.','',`Urban candidates: ${candidates.length}`,`Terrain/stepped review: ${report.summary.terrainReview}`,`Non-running-tier seated candidates: ${report.summary.seatedOutside}`,`Invalid outline: ${report.summary.invalidOutline}`,`Missing/invalid DEM: ${report.summary.missingDem}`,'','Each row in the JSON requires satellite footprint review and DEM/seat decision before geometry changes.'].join('\n')) console.log(JSON.stringify({passed:true,urbanCandidates:candidates.length,summary:report.summary,top:candidates.slice(0,10).map(({id,areaSqm,status,center})=>({id,areaSqm,status,center}))}))