31 lines
4.1 KiB
JavaScript
31 lines
4.1 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-color-promotion.json'),
|
|
load('config/freecad-native-property-semantics.json'),
|
|
load('config/freecad-follow-up-task-progress.json'),
|
|
load('config/freecad-property-color-roundtrip.json'),
|
|
load('config/chrome-property-color-verification.json'),
|
|
])
|
|
const fail = (message) => { throw new Error(`FreeCAD PropertyColor promotion check failed: ${message}`) }
|
|
if (report.schemaVersion !== 1 || report.status !== 'pass' || report.taskId !== 'PROP-app-propertycolor-I' || report.propertyType !== 'App::PropertyColor' || report.recordCount !== 8 || 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-propertycolor-${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 target = [0.2, 0.4, 0.6, 0.8]
|
|
const approximatelyTarget = (value) => Array.isArray(value) && value.length === target.length && value.every((channel, index) => typeof channel === 'number' && Math.abs(channel - target[index]) <= 1e-7)
|
|
const propertyType = semantics.types?.find(({ typeId }) => typeId === report.propertyType)
|
|
if (report.promotion?.from !== 'opaque-fcstd-proxy' || report.promotion.to !== 'native-editable-codec' || propertyType?.support !== report.promotion.to || propertyType.statusNames?.length !== 0 || report.promotion.facadeValueModel !== 'four-finite-rgba-channels-with-8-bit-fcstd-packing' || report.promotion.writableRecords !== 8 || report.promotion.fcstdElement !== 'PropertyColor' || report.promotion.fcstdPackedValue !== '862362060' || !approximatelyTarget(report.promotion.nativeRoundTripValue) || !isDeepStrictEqual(report.promotion.browserRoundTripValue, target) || report.promotion.zeroUnknownDrift !== true) fail('capability promotion is incomplete')
|
|
const sync = report.exactBlockerSync
|
|
if (sync?.nativeEditableTypes !== 30 || sync.nativeEditableRecords !== 4361 || sync.opaqueTypes !== 50 || sync.opaqueRecords !== 466 || sync.exactPromotionReady !== false || sync.exactBlocker !== '50 runtime property types and 466 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 || !approximatelyTarget(roundTrip.classification.resavedValue) || chrome.status !== 'pass' || chrome.persistence?.fcstdElement !== 'PropertyColor' || chrome.persistence.fcstdValue !== '862362060' || !isDeepStrictEqual(chrome.persistence.loadedValue, target) || chrome.resource?.released !== true || chrome.release?.workerTerminated !== true) fail('G/H closure evidence regressed')
|
|
console.log(JSON.stringify({ status: 'freecad-property-color-promotion-pass', propertyType: report.propertyType, promotion: report.promotion, completedPhases: requiredPhases, exactBlockerSync: sync, systemExact: report.systemExact }, null, 2))
|