prepare-negative-estate-whitelist-plan.mjs 2.0 KB

123456789
  1. import assert from 'node:assert/strict'
  2. import {createHash} from 'node:crypto'
  3. import {readFileSync,writeFileSync,mkdirSync} from 'node:fs'
  4. import {resolve,join} from 'node:path'
  5. const root=resolve('tools/city-massing/city/cad-bim'),out=resolve('.scratch/cockpit-shell-panel-layout/verify/artifacts/t35/negative-estate-pilot'),ids=['cad-25612','cad-25467','cad-25968','cad-25957'],plan=JSON.parse(readFileSync(join(root,'plan.json'))),seat=JSON.parse(readFileSync(join(root,'seated-plan.json'))),by=new Map(plan.buildings.map(b=>[b.id,b])),seated=new Map(seat.buildings.map(b=>[b.id,b]))
  6. assert.ok(ids.every(id=>by.has(id)&&seated.has(id)))
  7. const buildings=ids.map(id=>{const b=by.get(id),s=seated.get(id);assert.equal(b.tier,'rural');assert.ok(s.terrainRelief<=3.2);return {...b,acceptedPilotWhitelist:true,whitelistReason:'maintainer sample neighborhood; source imagery review + seated DEM evidence; not global rural restore',heightM:s.heightM,positionENU:s.positionENU,foundationBottom:s.foundationBottom,terrainMin:s.terrainMin,terrainMax:s.terrainMax,terrainRelief:s.terrainRelief}})
  8. const pilot={version:1,source:'seated-plan subset; four explicit maintainer-sample whitelist IDs',policy:'Immutable local pilot only. No global rural restoration. Survey outlines, estimated floors/heights and original DEM seating retained.',parentPlanSha256:createHash('sha256').update(readFileSync(join(root,'seated-plan.json'))).digest('hex'),buildings,samples:buildings.flatMap(b=>b.sampleIndices.map(i=>plan.samples[i])),counts:{buildings:buildings.length,assets:buildings.filter(b=>b.kind==='asset').length,massing:buildings.filter(b=>b.kind==='massing').length},caps:{maxRegions:1,maxContents:buildings.length*2,maxDecodedBytes:32*1024*1024},modelChanged:false}
  9. mkdirSync(out,{recursive:true});writeFileSync(join(out,'seated-whitelist-plan.json'),JSON.stringify(pilot,null,2));console.log(JSON.stringify({passed:true,ids,assets:pilot.counts.assets,massing:pilot.counts.massing,maxRelief:Math.max(...buildings.map(b=>b.terrainRelief)),modelChanged:false}))