Files
Web_FreeCAD_Bitbybit/scripts/generate-freecad-property-linksubhidden-promotion.mjs
wangdequan 54649da16c
Some checks are pending
real-verification / chrome (push) Waiting to run
real-verification / freecad-oracle (push) Waiting to run
real-verification / wasm (push) Waiting to run
feat: close link sub property codecs
2026-08-17 21:37:33 -04:00

67 lines
4.7 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-linksubhidden-promotion.json')
const [inventory, success, failure, mutation, roundTrip, chrome, semantics, progress] = await Promise.all([
load('config/freecad-property-linksubhidden-inventory.json'),
load('config/freecad-property-linksubhidden-success.json'),
load('config/freecad-property-linksubhidden-failure.json'),
load('config/freecad-property-linksubhidden-mutation.json'),
load('config/freecad-property-linksubhidden-roundtrip.json'),
load('config/chrome-property-linksubhidden-verification.json'),
load('config/freecad-native-property-semantics.json'),
load('config/freecad-follow-up-task-progress.json'),
])
const fail = (message) => { throw new Error(`FreeCAD PropertyLinkSubHidden 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-propertylinksubhidden-${phase}`)) fail(`phase ${phase} is not completed in the evidence ledger`)
if (inventory.status !== 'pass' || inventory.propertyType !== 'App::PropertyLinkSubHidden' || inventory.recordCount !== 4 || inventory.objectTypeCount !== 4 || inventory.writableRecordCount !== 4) 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::PropertyLinkSubHidden')
if (propertyType?.support !== 'native-editable-codec' || propertyType.recordCount !== 4 || propertyType.objectTypeCount !== 4 || propertyType.statusNames?.join(',') !== 'LockDynamic,PropHidden') fail('global property semantics did not promote App::PropertyLinkSubHidden')
const opaque = semantics.supportSummary?.['opaque-fcstd-proxy']
const editable = semantics.supportSummary?.['native-editable-codec']
if (opaque?.typeCount !== 43 || opaque.recordCount !== 450 || editable?.typeCount !== 37 || editable.recordCount !== 4377) fail('global property support summary is not synchronized')
if (roundTrip.classification?.zeroUnknownDrift !== true || roundTrip.classification.hiddenLinksPreserved !== true || roundTrip.classification.nativeDependencyMetadataNormalized !== true || chrome.persistence?.loadedType !== 'App::PropertyLinkSubHidden' || chrome.persistence.fcstdElement !== 'LinkSub' || chrome.ui?.hiddenControlCountAfter !== 0 || chrome.ui?.hiddenTextPresentAfter !== false || chrome.release?.workerTerminated !== true) fail('round-trip or browser closure evidence is incomplete')
const report = {
schemaVersion: 1,
status: 'pass',
taskId: 'PROP-app-propertylinksubhidden-I',
baseline: semantics.baseline,
propertyType: 'App::PropertyLinkSubHidden',
recordCount: 4,
phaseEvidence: Object.fromEntries(requiredCompletedPhases.map((phase) => [phase, completed.get(`PROP-app-propertylinksubhidden-${phase}`).evidence])),
promotion: {
from: inventory.classification,
to: propertyType.support,
facadeValueModel: 'same-document-object-and-ordered-sub-element-name-array-or-null',
writableRecords: 4,
objectTypeCount: 4,
propertyStatus: 'LockDynamic,PropHidden',
linkScope: 'Hidden',
runtimeDependencyEdges: 0,
fcstdElement: chrome.persistence.fcstdElement,
nativeRoundTripValue: roundTrip.classification.resavedValue,
browserRoundTripValue: chrome.persistence.loadedValue,
hiddenUiFiltered: chrome.ui.hiddenControlCountAfter === 0 && chrome.ui.hiddenTextPresentAfter === false,
hiddenLinksPreserved: roundTrip.classification.hiddenLinksPreserved,
nativeDependencyMetadataNormalized: roundTrip.classification.nativeDependencyMetadataNormalized,
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-linksubhidden-promotion-generated', output: 'config/freecad-property-linksubhidden-promotion.json', promotion: report.promotion, exactBlockerSync: report.exactBlockerSync }, null, 2))