Files
Web_FreeCAD_Bitbybit/scripts/generate-freecad-property-acceleration-promotion.mjs
wangdequan 8f6053089a
Some checks failed
real-verification / chrome (push) Has been cancelled
real-verification / freecad-oracle (push) Has been cancelled
real-verification / wasm (push) Has been cancelled
feat: promote font force heat flux and integer set properties
2026-08-17 09:10:47 -04:00

62 lines
3.8 KiB
JavaScript

import { readFile, writeFile } from 'node:fs/promises'
import { resolve } from 'node:path'
const root = resolve(new URL('..', import.meta.url).pathname)
const load = (path) => readFile(resolve(root, path), 'utf8').then(JSON.parse)
const outputPath = resolve(root, 'config/freecad-property-acceleration-promotion.json')
const [inventory, success, failure, mutation, roundTrip, chrome, semantics, progress] = await Promise.all([
load('config/freecad-property-acceleration-inventory.json'),
load('config/freecad-property-acceleration-success.json'),
load('config/freecad-property-acceleration-failure.json'),
load('config/freecad-property-acceleration-mutation.json'),
load('config/freecad-property-acceleration-roundtrip.json'),
load('config/chrome-property-acceleration-verification.json'),
load('config/freecad-native-property-semantics.json'),
load('config/freecad-follow-up-task-progress.json'),
])
const fail = (message) => { throw new Error(`FreeCAD PropertyAcceleration promotion generation failed: ${message}`) }
const requiredCompletedPhases = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H']
const completed = new Map(progress.completedTasks?.map((entry) => [entry.id, entry]) ?? [])
for (const phase of requiredCompletedPhases) if (!completed.has(`PROP-app-propertyacceleration-${phase}`)) fail(`phase ${phase} is not completed in the evidence ledger`)
if (inventory.status !== 'pass' || inventory.propertyType !== 'App::PropertyAcceleration' || inventory.recordCount !== 1) fail('inventory evidence is invalid')
for (const [name, artifact] of Object.entries({ success, failure, mutation, roundTrip, chrome })) if (artifact.status !== 'pass') fail(`${name} evidence is not passing`)
const propertyType = semantics.types?.find(({ typeId }) => typeId === 'App::PropertyAcceleration')
if (propertyType?.support !== 'native-editable-codec' || propertyType.recordCount !== 1) fail('global property semantics did not promote App::PropertyAcceleration')
const opaque = semantics.supportSummary?.['opaque-fcstd-proxy']
const editable = semantics.supportSummary?.['native-editable-codec']
if (opaque?.typeCount !== 46 || opaque.recordCount !== 457 || editable?.typeCount !== 34 || editable.recordCount !== 4370) fail('global property support summary is not synchronized')
if (roundTrip.classification?.zeroUnknownDrift !== true || chrome.persistence?.loadedType !== 'App::PropertyAcceleration' || chrome.persistence.loadedValue !== 500 || chrome.release?.workerTerminated !== true) fail('round-trip or browser closure evidence is incomplete')
const report = {
schemaVersion: 1,
status: 'pass',
taskId: 'PROP-app-propertyacceleration-I',
baseline: semantics.baseline,
propertyType: 'App::PropertyAcceleration',
recordCount: 1,
phaseEvidence: Object.fromEntries(requiredCompletedPhases.map((phase) => [phase, completed.get(`PROP-app-propertyacceleration-${phase}`).evidence])),
promotion: {
from: inventory.classification,
to: propertyType.support,
facadeValueModel: 'finite-number-mm/s^2',
fcstdElement: chrome.persistence.fcstdElement,
nativeRoundTripValue: roundTrip.classification.resavedValue,
browserRoundTripValue: chrome.persistence.loadedValue,
zeroUnknownDrift: roundTrip.classification.zeroUnknownDrift,
},
exactBlockerSync: {
nativeEditableTypes: editable.typeCount,
nativeEditableRecords: editable.recordCount,
opaqueTypes: opaque.typeCount,
opaqueRecords: opaque.recordCount,
exactPromotionReady: semantics.exactPromotionReady,
exactBlocker: semantics.exactBlocker,
},
systemExact: false,
generatedAt: new Date().toISOString(),
}
await writeFile(outputPath, `${JSON.stringify(report, null, 2)}\n`)
console.log(JSON.stringify({ status: 'freecad-property-acceleration-promotion-generated', output: 'config/freecad-property-acceleration-promotion.json', promotion: report.promotion, exactBlockerSync: report.exactBlockerSync }, null, 2))