hololake-system-architecture/product-source/hololake-native-desktop/scripts/zero-point-nucleus.test.mjs

40 lines
2.2 KiB
JavaScript
Raw Normal View History

import assert from 'node:assert/strict'
import fs from 'node:fs'
import test from 'node:test'
const read = (relative) => fs.readFileSync(new URL(`../${relative}`, import.meta.url), 'utf8')
const contract = JSON.parse(read('contracts/zero-point-nucleus-channel.json'))
const stageOne = JSON.parse(read('contracts/stage-one-platform.json'))
const foundation = JSON.parse(read('foundation.json'))
const rust = read('src-tauri/src/zero_point.rs')
const lib = read('src-tauri/src/lib.rs')
const ui = read('src/main.tsx')
test('zero-point nucleus is a system runtime and never an inferred persona binding', () => {
assert.equal(contract.metacognitive_boundary.zero_point_system_is_persona, false)
assert.equal(contract.metacognitive_boundary.zero_point_system_is_model_carrier, false)
assert.equal(contract.metacognitive_boundary.number_verification_is_persona_binding, false)
assert.equal(contract.metacognitive_boundary.number_verification_grants_execution_authority, false)
assert.equal(stageOne.zero_point_nucleus_client_runtime.system_is_persona, false)
assert.equal(foundation.zero_point_nucleus_is_persona, false)
assert.match(ui, /验证结果不构成人格绑定、模型载体绑定或执行授权/)
})
test('protocol comparison starts below the public surface and fails closed', () => {
assert.equal(contract.current_implementation.boot_time_silent_version_comparison, true)
assert.equal(contract.current_implementation.signed_protocol_payload_installation, false)
assert.equal(contract.security.unsigned_protocol_update_allowed, false)
assert.match(lib, /sync_protocol_runtime/)
assert.match(rust, /UPDATE_PENDING_SIGNATURE_KEY_ABSENT/)
assert.match(rust, /UPDATE_FOUND_GATE_PENDING/)
assert.doesNotMatch(lib, /zero_point_save_api|zero_point_api_config|generic_layer_chat/)
assert.doesNotMatch(ui, /模型 API 配置|通用AI运行层|AGENT PARLOR|会客厅/)
})
test('number validation requires an explicit positive lighthouse verdict', () => {
assert.match(rust, /fn lighthouse_resolution/)
assert.match(rust, /eq_ignore_ascii_case\("RESOLVED"\)/)
assert.match(rust, /route_not_found/)
assert.match(rust, /an arbitrary successful response/)
assert.match(rust, /inner\.route = "restricted"/)
})