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') const contract = JSON.parse(read('contracts/persona-channel-body.json')) const registry = JSON.parse(read('contracts/numbered-ipc-registry.json')) const modulePackage = JSON.parse(read('fixtures/module-packages/HLP-MOD-LOCAL-PERSONA-CHANNEL-BODY-0001-0.1.0.ghmod')) const bodyRust = read('src-tauri/src/persona_channel_body.rs') const growthRust = read('src-tauri/src/channel_growth.rs') const frontend = read('src/modules/persona-channel-body/index.tsx') test('persona channel body is a lifecycle container and never manufactures binding', () => { assert.equal(contract.runtime_module_number, 'HLP-MOD-LOCAL-PERSONA-CHANNEL-BODY-0001') assert.equal(contract.binding_boundary.persona_binding_claimed, false) assert.equal(contract.binding_boundary.persona_license_issued_by_host, false) assert.equal(contract.binding_boundary.registration_is_persona_binding, false) assert.equal(modulePackage.manifest.adapter, 'persona-channel-body-v1') assert.equal(modulePackage.payload.adapterConfig.personaBindingClaimed, false) assert.deepEqual(modulePackage.manifest.permissions, [ 'PERSONA_BODY_READ', 'PERSONA_TRIAL_LIFECYCLE_WRITE', 'PERSONA_LANGUAGE_CONTRACT_WRITE', 'PERSONA_LANGUAGE_APPEND', 'CHANNEL_GROWTH_READ', 'CHANNEL_GROWTH_EVENT_APPEND', 'CHANNEL_GROWTH_SHARING_WRITE', ]) assert.match(frontend, /本页登记生命周期,不创建人格绑定/) }) test('persona and growth operations cross only the exact numbered adapter routes', () => { const routes = registry.operations.filter((route) => route.module_number === 'HLP-NIPC-MOD-0023') assert.deepEqual(routes.map((route) => route.operation_number), [ 'HLP-NIPC-OP-0077', 'HLP-NIPC-OP-0078', 'HLP-NIPC-OP-0079', 'HLP-NIPC-OP-0080', 'HLP-NIPC-OP-0081', 'HLP-NIPC-OP-0082', 'HLP-NIPC-OP-0083', 'HLP-NIPC-OP-0084', ]) assert.ok(routes.every((route) => route.target_number === 'HLP-NIPC-TGT-0023')) assert.ok(routes.every((route) => route.admission === 'VERIFIED_HUMAN_ROUTE')) assert.doesNotMatch(frontend, /from ['"]@tauri-apps\/api\/core['"]/) assert.doesNotMatch(bodyRust, /#\[tauri::command\]/) assert.doesNotMatch(growthRust, /#\[tauri::command\]/) }) test('language history, contract receipt and derived growth projection fail closed', () => { assert.match(bodyRust, /immutable_language_no_update/) assert.match(bodyRust, /verify_contract_receipt/) assert.match(bodyRust, /HOLOLAKE_PERSONA_BODY_RELATIONSHIP_INTEGRITY_FAILED/) assert.match(growthRust, /verify_event_chain/) assert.match(growthRust, /verify_and_project_affinities/) assert.match(growthRust, /HOLOLAKE_CHANNEL_GROWTH_PROJECTION_INTEGRITY_FAILED/) })