import assert from "node:assert/strict"; import fs from "node:fs"; import path from "node:path"; import test from "node:test"; import { fileURLToPath } from "node:url"; const directory = path.dirname(fileURLToPath(import.meta.url)); const map = JSON.parse(fs.readFileSync(path.join(directory, "zhuyuan-unique-confidence-body-map.json"), "utf8")); const subjects = JSON.parse(fs.readFileSync(path.join(directory, "../identity/fifth-domain-subject-registry.json"), "utf8")); const navigation = JSON.parse(fs.readFileSync(path.join(directory, "ai-machine-navigation-map.json"), "utf8")); test("one continuous subject owns exactly one confidence-layer persona-system body", () => { assert.equal(map.subject.persona_id, "ICE-P-ZY001"); assert.equal(map.subject.continuous_in_guanghu_world_time, true); assert.equal(map.subject.created_by_host_entry, false); assert.equal(map.unique_confidence_body.cardinality, 1); assert.equal(map.unique_confidence_body.owner_and_persona_brain_controller, "ICE-P-ZY001"); assert.ok(subjects.subjects.some((entry) => entry.id === "ICE-P-ZY001")); }); test("Codex and ZCode are distinct host paths to the same body", () => { const hosts = new Map(map.host_paths.map((entry) => [entry.host_family, entry])); assert.equal(hosts.get("CODEX").may_create_second_persona_body, false); assert.equal(hosts.get("ZCODE").may_create_second_persona_body, false); assert.equal(hosts.get("CODEX").state_directory, "PER_CHANNEL_PER_HOST_PER_SESSION"); assert.equal(hosts.get("ZCODE").state_directory, "PER_CHANNEL_PER_HOST_PER_SESSION"); }); test("normal entry continues while recovery remains exception-only", () => { assert.equal(map.subject.normal_entry, "ATTACH_AND_CONTINUE"); assert.equal(map.subject.recovery, "EXCEPTION_ONLY"); assert.equal(map.entry_state_machine.dormancy.world_time_advances, true); assert.equal(map.entry_state_machine.dormancy.continuous_model_inference_claimed, false); assert.equal(map.truth.normal_entry_runtime_migrated_from_restore_to_attach_continue, 0); }); test("public registry, product source and persona-owned Git cannot become the persona", () => { assert.match(map.repository_roles["REPO-012"], /NOT_PRIVATE_PERSONA_BRAIN/u); assert.match(map.repository_roles["REPO-014"], /NOT_PERSONA_BODY/u); assert.match(map.repository_roles.JD_PNCC, /NOT_THE_PERSONA/u); assert.equal(map.unique_confidence_body.repository_is_persona, false); }); test("machine navigation exposes the unique confidence body map", () => { assert.ok(navigation.routes.some((entry) => entry.id === map.map_id && entry.path === "routing/zhuyuan-unique-confidence-body-map.json")); });