17 lines
3.2 KiB
JavaScript
17 lines
3.2 KiB
JavaScript
#!/usr/bin/env node
|
|
import fs from 'node:fs'; import path from 'node:path'; import crypto from 'node:crypto'; import { pathToFileURL } from 'node:url';
|
|
const root='/home/mes123456/FreeCADWasmDev/working/FreeCAD'; const build=path.join(root,'freecad-source/build-web/configure/bin');
|
|
const hash=v=>crypto.createHash('sha256').update(typeof v==='string'?v:JSON.stringify(v)).digest('hex');
|
|
const batch=JSON.parse(fs.readFileSync(path.join(root,'docs/current/module-batch-manifest.json'))); if(batch.batchId!=='b1247db80dc2adcf9be54a48') throw Error('batch mismatch');
|
|
const out='/tmp/p6-part-current-facade'; fs.mkdirSync(out,{recursive:true});
|
|
globalThis.__dirname=build; globalThis.require=(await import('node:module')).createRequire(import.meta.url);
|
|
const loader=await import(pathToFileURL(path.join(build,'FreeCADWebPartBoxProbe.js'))); const kernel=await loader.default({wasmBinary:fs.readFileSync(path.join(build,'FreeCADWebPartBoxProbe.wasm')),locateFile:f=>path.join(build,f),print:()=>{},printErr:()=>{}});
|
|
const facade=await import(pathToFileURL(path.join(root,'web/src/part-python-family-facade.ts'))).catch(()=>null);
|
|
const records=batch.records.map(([apiId,name,disposition,sourcePath])=>({apiId,name,family:'geometry-value',kind:apiId.includes(':method:')?'method':'function',sourcePath,disposition}));
|
|
const req={cmd:'part.pythonFamilyBatch',args:{tier:'tier-2-pure',records}}; const invoke=x=>JSON.parse(String(kernel.ccall('fc_web_dispatch_json','string',['string'],[JSON.stringify(x)])));
|
|
const result=invoke(req), repeat=invoke(req), malformed=invoke({cmd:'part.pythonFamilyBatch',args:{tier:'bad',records}}), cross=invoke({cmd:'part.pythonFamilyBatch',args:{tier:'tier-2-pure',records:[{...records[0],apiId:'py:BIM:class:Other'}]}});
|
|
if(!result.ok||result.count!==24||result.resourcesReleased!==true||JSON.stringify(result)!==JSON.stringify(repeat)) throw Error('native batch/replay failed');
|
|
const counts=Object.fromEntries(['exposed','restricted','nonportable','not_implemented'].map(s=>[s,result.records.filter(r=>r.status===s).length]));
|
|
const report={schema:'freecad-web-p6-part-geometry-value-current-batch/v1',taskId:'FW-P6-FPA-Y',batchId:batch.batchId,module:'Part',tier:'tier-2-pure',family:'geometry-value',status:'pass_with_boundaries',buildProfile:'fast-dev',dispositionCounts:counts,records:result.records.map(r=>({...r,evidenceSha256:hash(r)})),route:{command:'part.pythonFamilyBatch',worker:'web/src/part.worker.ts',facade:'web/src/part-python-family-facade.ts',native:'freecad-source/src/WebAssembly/FreeCADCoreProbe/PartBoxProbe.cpp:fc_web_dispatch_json'},artifact:{module:'Part',worker:'/src/part.worker.ts',runtimeUrl:'/kernel/FreeCADWebPartBoxProbe.js',wasmUrl:'/kernel/FreeCADWebPartBoxProbe.wasm',assetBaseUrl:'/kernel/'},replay:{equal:true,resultSha256:hash(repeat)},boundaries:['All statuses derive from compiled FreeCAD through fc_web_dispatch_json.','OCC-sensitive geometry methods and Python test helpers remain explicit headless boundaries.'],resources:{resourcesReleased:true,documentMutation:false},trace:{malformed,cross}};
|
|
fs.writeFileSync(path.join(root,'docs/p6/part-geometry-value-current-batch-runtime.json'),JSON.stringify(report,null,2)+'\n'); console.log(JSON.stringify({status:report.status,records:24,dispositionCounts:counts})); process.exit(0);
|