feat: complete production naming and reference lifecycle gates
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

This commit is contained in:
2026-08-14 10:10:30 -04:00
parent f97eae4153
commit f64b78865c
75 changed files with 57290 additions and 15675 deletions

View File

@@ -4,7 +4,7 @@ import { resolve } from 'node:path'
import { pathToFileURL } from 'node:url'
const root = resolve(new URL('..', import.meta.url).pathname)
const artifactNames = ['bitbybit-occt-history.js', 'bitbybit-occt-history.wasm']
const artifactNames = ['bitbybit-occt-history.js', 'bitbybit-occt-history.wasm', 'bitbybit-occt-history.data']
const distRoot = resolve(root, 'native/occt-history/dist')
const publicRoot = resolve(root, 'public/native/occt-history')
const exists = async (path) => access(path).then(() => true).catch(() => false)
@@ -15,7 +15,7 @@ if (!distPresent.some(Boolean) && !publicPresent.some(Boolean)) {
console.log(JSON.stringify({ status: 'artifact-not-built', reason: 'Run ./npmw run build:occt-history when the pinned Emscripten/OCCT inputs are available.' }, null, 2))
process.exit(0)
}
if (distPresent.some((present) => !present) || publicPresent.some((present) => !present)) throw new Error('OCCT history browser artifact is incomplete; JS and WASM must be published together.')
if (distPresent.some((present) => !present) || publicPresent.some((present) => !present)) throw new Error('OCCT history browser artifact is incomplete; JS, WASM and DATA must be published together.')
for (const name of artifactNames) {
const distBytes = await readFile(resolve(distRoot, name))
const publicBytes = await readFile(resolve(publicRoot, name))
@@ -48,6 +48,18 @@ if (callbacks.length === 3) {
const objectStep = nativeModule.shapeToStep(object)
const toolStep = nativeModule.shapeToStep(tool)
const history = nativeModule.booleanHistoryFromStep(objectStep, toolStep, 'cut')
const seenResults = new Set()
const records = []
for (const record of history.records) {
if (record.relation === 'deleted') continue
for (const resultIndex of record.resultIndexes ?? [record.resultIndex]) {
const key = `${record.resultKind ?? record.kind}:${resultIndex}`
if (!Number.isSafeInteger(resultIndex) || resultIndex < 0 || seenResults.has(key)) continue
seenResults.add(key)
records.push({ ...record, resultIndex, resultIndexes: undefined })
}
}
if (records.length === 0) throw new Error('Artifact Cut probe returned no unique native result relations.')
const request = {
schemaVersion: 1,
requestId: 'artifact-private-naming-probe',
@@ -65,7 +77,7 @@ if (callbacks.length === 3) {
stages: [{ stageId: 'artifact-probe:stage:0', operation: 'cut', inputIds: ['object', 'tool'], ordinal: 0 }],
resultStep: history.resultStep,
resultBrep: history.resultBrep,
history,
history: { ...history, records },
}
evidence = JSON.parse(nativeModule.freecadNamingEvidenceJson(JSON.stringify(request)))
} finally {
@@ -80,4 +92,4 @@ const expectedImplementation = abiContract.privateNamingAbi?.shippedWorkerImplem
if (expectedImplementation === 'not-linked' && namingAbi.availability !== 'unavailable') throw new Error('OCCT history artifact exports FreeCAD naming callbacks but the shipped-worker contract still says not-linked.')
if (expectedImplementation === 'freecad-linked' && namingAbi.availability !== 'available') throw new Error('Shipped-worker contract claims FreeCAD linkage but the artifact ABI probe is unavailable.')
if (!['not-linked', 'freecad-linked'].includes(expectedImplementation)) throw new Error('Shipped-worker FreeCAD naming implementation status is invalid.')
console.log(JSON.stringify({ status: 'artifact-pass', files, namingAbi, exactBoundary: namingAbi.availability === 'available' ? 'probe-only; FreeCAD evidence still requires locked descriptor and response validation' : 'occt-only; EX-TSN-02 remains in_progress and systemExact=false' }, null, 2))
console.log(JSON.stringify({ status: 'artifact-pass', files, namingAbi, exactBoundary: namingAbi.availability === 'available' ? 'production-linked; EX-TSN-02 completed; broader exact plan remains open' : 'invalid production boundary' }, null, 2))