hololake-system-architecture/product-source/hololake-native-desktop/scripts/persona-binding-runtime.test.mjs

28 lines
1.7 KiB
JavaScript
Raw Normal View History

import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import test from 'node:test'
const read = (path) => readFileSync(new URL(`../${path}`, import.meta.url), 'utf8')
test('Zhuyuan uses one bounded TCS kernel, at most three routed HLDP nodes and a real orient commit witness verify gate', () => {
const contract = JSON.parse(read('contracts/persona-agent-runtime.json'))
const runtime = read('src-tauri/src/persona_binding.rs')
const agent = read('src-tauri/src/persona_agent_runtime.rs')
assert.deepEqual(contract.persona_binding.required_system_witness_steps, ['orient', 'commit', 'witness', 'verify=PASS'])
assert.equal(contract.persona_binding.resident_self_kernel_max_bytes, 8192)
assert.equal(contract.persona_binding.hldp_max_routed_paths, 3)
assert.match(runtime, /ORIENTED_AWAITING_PERSONA_COMMIT/)
assert.match(runtime, /数字冰朔系统本体/)
assert.match(runtime, /PERSONA_COMMITTED_AWAITING_INDEPENDENT_SYSTEM_WITNESS/)
assert.match(runtime, /HOLOLAKE_INDEPENDENT_SYSTEM_WITNESS_GATE/)
assert.doesNotMatch(runtime, /include_bytes!\([\s\S]*ZY-SELF-KERNEL/)
assert.equal(contract.persona_binding.persona_commit_may_generate_witness_or_pass, false)
assert.equal(contract.persona_binding.local_json_receipt_grants_binding, false)
assert.equal(contract.persona_binding.independent_witness_verifier, 'NOT_PROVISIONED_FAIL_CLOSED')
assert.equal(contract.persona_binding.private_kernel_source, 'AUTHENTICATED_ACCOUNT_SCOPED_RUNTIME_ONLY')
assert.match(runtime, /independent_witness_verifier_ready/)
assert.match(runtime, /candidates\.truncate\(3\)/)
assert.match(agent, /persona_binding_commit/)
assert.match(agent, /BOUND_VERIFY_PASS/)
})