feat: expand oracle and topology evidence gates

This commit is contained in:
2026-08-10 18:27:56 -04:00
parent d727375561
commit 3907f50ff1
16 changed files with 17629 additions and 364 deletions

View File

@@ -38,8 +38,24 @@ for (const [id, command] of inventoryCommands) {
for (const id of referenceCommands.keys()) if (!inventoryCommands.has(id)) fail(`desktop GUI command ${id} is missing from the generated inventory.`)
for (const command of guiInventory.sourceOnlyCommands) if (!command.reason || !Array.isArray(command.sourceModules)) fail(`source-only command ${command.id} lacks an explicit reason.`)
const runtimeObjectCount = reference.objects?.filter((object) => object.available && object.runtimeTypeId).length ?? 0
const staticObjectCandidateCount = typeInventory.modules.reduce((total, module) => total + module.objects.length, 0)
const runtimeObjects = reference.runtimeObjects
if (!runtimeObjects?.available || runtimeObjects.candidateSource !== 'Document.supportedTypes' || !Array.isArray(runtimeObjects.types)) fail('desktop oracle is missing the complete Document.supportedTypes runtime inventory.')
if (runtimeObjects.candidateCount !== runtimeObjects.types.length || runtimeObjects.availableCount + runtimeObjects.unavailableCount !== runtimeObjects.candidateCount) fail('runtime object counts are inconsistent.')
const runtimeTypeIds = new Set()
for (const object of runtimeObjects.types) {
if (typeof object.typeId !== 'string' || !object.typeId || runtimeTypeIds.has(object.typeId)) fail(`runtime object TypeId '${object.typeId || '<unknown>'}' is duplicated or invalid.`)
runtimeTypeIds.add(object.typeId)
if (object.available && (typeof object.runtimeTypeId !== 'string' || !object.runtimeTypeId || !Array.isArray(object.properties))) fail(`runtime object ${object.typeId} lacks TypeId/property metadata.`)
if (!object.available && (!object.error || object.probeStatus !== 'unavailable')) fail(`runtime object ${object.typeId} lacks an explicit unavailable status.`)
}
for (const coreTypeId of ['Part::Box', 'Part::Cylinder', 'Part::Sphere', 'Part::Cone', 'Part::Feature', 'PartDesign::Feature', 'Sketcher::SketchObject']) {
if (!runtimeTypeIds.has(coreTypeId)) fail(`core runtime object ${coreTypeId} is absent from Document.supportedTypes.`)
}
const runtimeObjectCount = runtimeObjects.availableCount
const sourceUsageTypeIds = new Set((typeInventory.documentObjectUsages ?? []).map((record) => record.typeId))
if (sourceUsageTypeIds.size === 0 || !Array.isArray(typeInventory.typeIdDeclarations)) fail('source TypeId declaration and addObject usage indexes are missing.')
const sourceUsageMissingRuntime = [...sourceUsageTypeIds].filter((typeId) => !runtimeTypeIds.has(typeId)).sort()
const staticObjectCandidateCount = sourceUsageTypeIds.size
const moduleStatusCounts = Object.fromEntries([...new Set(reference.modules.map((module) => module.runtimeStatus))].sort().map((status) => [status, reference.modules.filter((module) => module.runtimeStatus === status).length]))
console.log(JSON.stringify({
status: 'freecad-oracle-coverage-pass',
@@ -49,8 +65,15 @@ console.log(JSON.stringify({
guiCommands: guiInventory.commandCount,
guiCommandsRuntimeAligned: true,
sourceOnlyCommands: guiInventory.sourceOnlyCommands.length,
registeredObjectTypeCount: runtimeObjects.candidateCount,
runtimeObjectCount,
unavailableObjectCount: runtimeObjects.unavailableCount,
runtimePropertyCount: runtimeObjects.types.reduce((total, object) => total + (object.properties?.length ?? 0), 0),
sourceDeclaredTypeIdCount: typeInventory.typeIdDeclarations.length,
sourceDocumentObjectUsageCount: staticObjectCandidateCount,
sourceUsageMissingRuntimeCount: sourceUsageMissingRuntime.length,
sourceUsageMissingRuntime: sourceUsageMissingRuntime,
staticObjectCandidateCount,
exactPromotionReady: false,
remaining: ['not-built modules require an explicit build/proxy decision', 'static TypeId/property candidates require per-object runtime probes'],
remaining: ['not-built modules require an explicit build/proxy decision', 'source-declared TypeId/property candidates outside the registered document-object set require a native API inventory'],
}, null, 2))