Files
Web_FreeCAD_Bitbybit/scripts/check-freecad-property-linksublistglobal-promotion.mjs
wangdequan 54649da16c
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: close link sub property codecs
2026-08-17 21:37:33 -04:00

27 lines
4.3 KiB
JavaScript

import { isDeepStrictEqual } from 'node:util'
import { readFile } 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 [report, semantics, progress, roundTrip, chrome] = await Promise.all([
load('config/freecad-property-linksublistglobal-promotion.json'),
load('config/freecad-native-property-semantics.json'),
load('config/freecad-follow-up-task-progress.json'),
load('config/freecad-property-linksublistglobal-roundtrip.json'),
load('config/chrome-property-linksublistglobal-verification.json'),
])
const fail = (message) => { throw new Error(`FreeCAD PropertyLinkSubListGlobal promotion check failed: ${message}`) }
if (report.schemaVersion !== 1 || report.status !== 'pass' || report.taskId !== 'PROP-app-propertylinksublistglobal-I' || report.propertyType !== 'App::PropertyLinkSubListGlobal' || report.recordCount !== 1 || report.baseline?.freecadVersion !== '1.1.1' || report.baseline?.commit !== '0108fd4b4850cc46e625b60e53cea7a7bbe69f8d' || report.systemExact !== false) fail('promotion report boundary is invalid')
const requiredPhases = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H']
const completed = new Map(progress.completedTasks?.map((entry) => [entry.id, entry]) ?? [])
for (const phase of requiredPhases) { const taskId = `PROP-app-propertylinksublistglobal-${phase}`; if (!completed.has(taskId) || !Array.isArray(report.phaseEvidence?.[phase]) || report.phaseEvidence[phase].length === 0 || !isDeepStrictEqual(report.phaseEvidence[phase], completed.get(taskId).evidence)) fail(`phase ${phase} evidence is incomplete`) }
const propertyType = semantics.types?.find(({ typeId }) => typeId === report.propertyType)
const promotion = report.promotion
if (promotion?.from !== 'opaque-fcstd-proxy' || promotion.to !== 'native-editable-codec' || propertyType?.support !== promotion.to || propertyType.recordCount !== 1 || propertyType.objectTypeCount !== 1 || propertyType.statusNames?.length !== 0 || promotion.facadeValueModel !== 'same-document-object-and-ordered-sub-element-pair-list' || promotion.writableRecords !== 1 || promotion.objectTypeCount !== 1 || promotion.propertyStatus !== '' || promotion.linkScope !== 'Global' || promotion.runtimeDependencyEdges !== 2 || promotion.fcstdElement !== 'LinkSubList' || !isDeepStrictEqual(promotion.nativeRoundTripValue, roundTrip.classification.resavedValue) || !isDeepStrictEqual(promotion.browserRoundTripValue, chrome.persistence.loadedValue) || promotion.globalBacklinksPreserved !== true || promotion.nativeDependenciesNormalized !== true || promotion.zeroUnknownDrift !== true) fail('capability promotion is incomplete')
const sync = report.exactBlockerSync
if (sync?.nativeEditableTypes !== 37 || sync.nativeEditableRecords !== 4377 || sync.opaqueTypes !== 43 || sync.opaqueRecords !== 450 || sync.exactPromotionReady !== false || sync.exactBlocker !== '43 runtime property types and 450 records remain opaque-only; complete native document and property semantics') fail('exact blocker synchronization is stale')
if (!isDeepStrictEqual(sync, { nativeEditableTypes: semantics.supportSummary['native-editable-codec'].typeCount, nativeEditableRecords: semantics.supportSummary['native-editable-codec'].recordCount, opaqueTypes: semantics.supportSummary['opaque-fcstd-proxy'].typeCount, opaqueRecords: semantics.supportSummary['opaque-fcstd-proxy'].recordCount, exactPromotionReady: semantics.exactPromotionReady, exactBlocker: semantics.exactBlocker })) fail('promotion report diverges from global property semantics')
if (roundTrip.classification?.zeroUnknownDrift !== true || roundTrip.classification.globalBacklinksPreserved !== true || roundTrip.classification.nativeDependenciesNormalized !== true || chrome.status !== 'pass' || !isDeepStrictEqual(chrome.persistence?.loadedValue, promotion.browserRoundTripValue) || chrome.persistence?.fcstdElement !== 'LinkSubList' || chrome.persistence?.loadedDependencyCount !== 2 || chrome.ui?.dependencyCount !== 2 || chrome.resource?.released !== true || chrome.release?.workerTerminated !== true) fail('G/H closure evidence regressed')
console.log(JSON.stringify({ status: 'freecad-property-linksublistglobal-promotion-pass', propertyType: report.propertyType, promotion, completedPhases: requiredPhases, exactBlockerSync: sync, systemExact: report.systemExact }, null, 2))