feat: advance FreeCAD exact parity evidence
This commit is contained in:
@@ -3,12 +3,13 @@ import { readFile, writeFile } from 'node:fs/promises'
|
||||
import { resolve } from 'node:path'
|
||||
|
||||
const root = resolve(new URL('..', import.meta.url).pathname)
|
||||
const reportPath = resolve(root, process.env.FREECAD_GUI_COMMAND_REPORT || '.cache/freecad/reference-desktop.json')
|
||||
const reportPath = resolve(root, process.env.FREECAD_GUI_COMMAND_REPORT || '.cache/freecad/reference-desktop-gui-commands.json')
|
||||
const outputPath = resolve(root, process.env.FREECAD_GUI_COMMAND_INVENTORY || 'config/freecad-gui-command-inventory.json')
|
||||
const sourceInventory = JSON.parse(await readFile(resolve(root, 'config/freecad-source-inventory.json'), 'utf8'))
|
||||
const reportBytes = await readFile(reportPath)
|
||||
const report = JSON.parse(reportBytes)
|
||||
if (report.baselineId !== 'freecad-1.1.1' || report.freecadVersion !== '1.1.1' || report.guiUp !== true) throw new Error('A verified desktop FreeCAD GUI report is required.')
|
||||
if (report.probeScope !== 'gui-commands') throw new Error('The dedicated gui-commands oracle report is required.')
|
||||
if (!report.guiCommands?.available || !Array.isArray(report.guiCommands.commands)) throw new Error('Desktop report does not contain GUI command observations.')
|
||||
|
||||
const sourceCommandModules = new Map()
|
||||
@@ -21,17 +22,21 @@ const normalizeState = (state) => typeof state === 'boolean' ? state : state &&
|
||||
const unique = (values) => [...new Set(values)].sort()
|
||||
const commands = report.guiCommands.commands.map((command) => {
|
||||
const observations = command.observations || []
|
||||
const emptyStates = unique(observations.map((entry) => normalizeState(entry.emptySelection)))
|
||||
const noDocumentStates = unique(observations.map((entry) => normalizeState(entry.noDocument)))
|
||||
const documentNoSelectionStates = unique(observations.map((entry) => normalizeState(entry.documentNoSelection)))
|
||||
const selectedStates = unique(observations.map((entry) => normalizeState(entry.selectedPartBox)))
|
||||
const selectionSensitive = observations.some((entry) => typeof entry.emptySelection === 'boolean' && typeof entry.selectedPartBox === 'boolean' && entry.emptySelection !== entry.selectedPartBox)
|
||||
const documentSensitive = observations.some((entry) => typeof entry.noDocument === 'boolean' && typeof entry.documentNoSelection === 'boolean' && entry.noDocument !== entry.documentNoSelection)
|
||||
const selectionSensitive = observations.some((entry) => typeof entry.documentNoSelection === 'boolean' && typeof entry.selectedPartBox === 'boolean' && entry.documentNoSelection !== entry.selectedPartBox)
|
||||
return {
|
||||
id: command.id,
|
||||
sourceModules: unique(sourceCommandModules.get(command.id) || ['GuiCore']),
|
||||
workbenches: unique(observations.map((entry) => entry.workbench)),
|
||||
workbenches: unique(command.registeredWorkbenches || observations.map((entry) => entry.workbench)),
|
||||
cases: {
|
||||
emptySelection: { states: emptyStates, observed: true },
|
||||
noDocument: { states: noDocumentStates, observed: true },
|
||||
documentNoSelection: { states: documentNoSelectionStates, observed: true },
|
||||
selectedPartBox: { states: selectedStates, observed: true },
|
||||
},
|
||||
documentSensitive,
|
||||
selectionSensitive,
|
||||
status: 'runtime-probed',
|
||||
}
|
||||
@@ -51,10 +56,14 @@ const inventory = {
|
||||
baseline: { freecadVersion: '1.1.1', commit: '0108fd4b4850cc46e625b60e53cea7a7bbe69f8d' },
|
||||
generatedBy: 'scripts/generate-freecad-gui-command-inventory.mjs',
|
||||
sourceInventory: 'config/freecad-source-inventory.json',
|
||||
contextBoundaries: 'config/freecad-gui-command-context-boundaries.json',
|
||||
runtimeEvidence: {
|
||||
report: '.cache/freecad/reference-desktop.json',
|
||||
report: '.cache/freecad/reference-desktop-gui-commands.json',
|
||||
reportSha256: createHash('sha256').update(reportBytes).digest('hex'),
|
||||
workbenchCount: report.guiCommands.workbenches.length,
|
||||
stateProbe: report.guiCommands.stateProbe,
|
||||
stateCases: report.guiCommands.stateCases,
|
||||
directIsActiveBoundary: report.guiCommands.directIsActiveBoundary,
|
||||
},
|
||||
commandCount: commands.length,
|
||||
commands,
|
||||
|
||||
Reference in New Issue
Block a user