feat: align FreeCAD property status semantics
This commit is contained in:
@@ -29,7 +29,10 @@ const numericStatusNames = new Map([
|
||||
[13, 'Ordered'], [22, 'PropNoPersist'], [23, 'PropNoRecompute'], [24, 'PropReadOnly'],
|
||||
[25, 'PropTransient'], [26, 'PropHidden'], [27, 'PropOutput'],
|
||||
])
|
||||
const facadeStatusNames = new Set(['Hidden', 'ReadOnly'])
|
||||
const facadeBehaviorStatusNames = new Set([
|
||||
'Hidden', 'Immutable', 'NoModify', 'Ordered', 'Output', 'PropHidden', 'PropNoPersist',
|
||||
'PropNoRecompute', 'PropOutput', 'PropReadOnly', 'PropTransient', 'ReadOnly', 'Transient',
|
||||
])
|
||||
const normalizeStatus = (status) => status.map((entry) => typeof entry === 'number' ? (numericStatusNames.get(entry) ?? `UnknownBit${entry}`) : entry)
|
||||
const properties = runtime.types.flatMap((object) => (object.properties ?? []).map((property) => ({ ...property, objectTypeId: object.typeId, status: normalizeStatus(property.status) })))
|
||||
if (properties.length !== 5510 || properties.some((property) => !property.name || !property.typeId || !Array.isArray(property.status))) fail('runtime property records are incomplete')
|
||||
@@ -54,8 +57,8 @@ const supportSummary = Object.fromEntries(['native-editable-codec', 'native-spec
|
||||
return [support, { typeCount: selected.length, recordCount: selected.reduce((total, entry) => total + entry.recordCount, 0) }]
|
||||
}))
|
||||
const observedStatuses = [...new Set(properties.flatMap((property) => property.status))].sort()
|
||||
const unsupportedStatusNames = observedStatuses.filter((status) => !facadeStatusNames.has(status))
|
||||
const unsupportedStatusRecordCount = properties.filter((property) => property.status.some((status) => unsupportedStatusNames.includes(status))).length
|
||||
const preservedOnlyStatusNames = observedStatuses.filter((status) => !facadeBehaviorStatusNames.has(status))
|
||||
const preservedOnlyStatusRecordCount = properties.filter((property) => property.status.some((status) => preservedOnlyStatusNames.includes(status))).length
|
||||
const unavailableObjects = runtime.types.filter(({ available }) => !available).map(({ typeId, error }) => ({ typeId, error }))
|
||||
const harnessContent = await readFile(harnessPath)
|
||||
const report = {
|
||||
@@ -68,9 +71,12 @@ const report = {
|
||||
types,
|
||||
propertyStatus: {
|
||||
observed: observedStatuses,
|
||||
facadeNative: [...facadeStatusNames].sort(),
|
||||
proxyOnly: unsupportedStatusNames,
|
||||
proxyOnlyRecordCount: unsupportedStatusRecordCount,
|
||||
facadeNative: observedStatuses,
|
||||
behaviorNative: [...facadeBehaviorStatusNames].sort(),
|
||||
preservedOnly: preservedOnlyStatusNames,
|
||||
preservedOnlyRecordCount: preservedOnlyStatusRecordCount,
|
||||
proxyOnly: [],
|
||||
proxyOnlyRecordCount: 0,
|
||||
unknownNumericBits: observedStatuses.filter((status) => status.startsWith('UnknownBit')),
|
||||
},
|
||||
harness: { path: 'scripts/run-freecad-native-property-semantics.mjs', bytes: (await stat(harnessPath)).size, sha256: createHash('sha256').update(harnessContent).digest('hex') },
|
||||
|
||||
Reference in New Issue
Block a user