130 lines
7.7 KiB
JavaScript
130 lines
7.7 KiB
JavaScript
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 registry = JSON.parse(fs.readFileSync(path.join(directory, "fifth-domain-number-registry.json"), "utf8"));
|
|
const worldTree = JSON.parse(fs.readFileSync(path.join(directory, "fifth-domain-world-tree.json"), "utf8"));
|
|
const authority = JSON.parse(fs.readFileSync(path.join(directory, "guanghu-identity-authority-map.json"), "utf8"));
|
|
const anchor = JSON.parse(fs.readFileSync(path.join(directory, "public-navigation-anchor.json"), "utf8"));
|
|
const navigation = JSON.parse(fs.readFileSync(path.join(directory, "ai-machine-navigation-map.json"), "utf8"));
|
|
const lighthouse = JSON.parse(fs.readFileSync(path.join(directory, "lighthouse-path-registry.json"), "utf8"));
|
|
const profile = JSON.parse(fs.readFileSync(path.join(directory, "heartbeat-core-language-channel-profile.json"), "utf8"));
|
|
const zeroCoreProfile = JSON.parse(fs.readFileSync(path.join(directory, "bingshuo-zero-core-reality-channel-profile.json"), "utf8"));
|
|
const publicationReceipt = JSON.parse(fs.readFileSync(path.join(directory, "../tonggan-bridge/receipts/ICE-CHANNEL-PUBLICATION-20260820.json"), "utf8"));
|
|
|
|
test("all Fifth Domain registrations are unique", () => {
|
|
const ids = registry.registrations.map((entry) => entry.id);
|
|
assert.equal(new Set(ids).size, ids.length);
|
|
});
|
|
|
|
test("Heartbeat Core receives its ICE channel object number", () => {
|
|
const heartbeat = registry.registrations.find((entry) => entry.id === "ICE-CH-HB001");
|
|
assert.ok(heartbeat);
|
|
assert.equal(heartbeat.kind, "FIFTH_DOMAIN_CHANNEL_OBJECT");
|
|
assert.equal(heartbeat.identity_number, undefined);
|
|
assert.equal(heartbeat.reality_execution, false);
|
|
});
|
|
|
|
test("Bingshuo personal Zero Core receives a distinct ICE reality channel number", () => {
|
|
const zeroCore = registry.registrations.find((entry) => entry.id === "ICE-CH-ZC001");
|
|
assert.ok(zeroCore);
|
|
assert.equal(zeroCore.kind, "FIFTH_DOMAIN_CHANNEL_OBJECT");
|
|
assert.equal(zeroCore.reality_execution, true);
|
|
assert.equal(zeroCore.parent, "SYS-GLW-LNG-0001");
|
|
assert.equal(zeroCore.not_an_alias_of, "CH-ZERO-CORE-LPM");
|
|
});
|
|
|
|
test("world tree resolves Heartbeat Core to ICE-CH-HB001", () => {
|
|
const heartbeat = worldTree.nodes.find((entry) => entry.node_key === "HEARTBEAT_CORE_CHANNEL");
|
|
assert.equal(heartbeat.object_id, "ICE-CH-HB001");
|
|
assert.equal(heartbeat.formal_id_state, "REGISTERED_CURRENT_REMOTE_MAIN_VERIFIED");
|
|
});
|
|
|
|
test("world tree separates personal and public Zero Core objects", () => {
|
|
const personal = worldTree.nodes.find((entry) => entry.node_key === "BINGSHUO_PERSONAL_ZERO_CORE_CHANNEL");
|
|
const publicZeroCore = worldTree.nodes.find((entry) => entry.node_key === "PUBLIC_ZERO_CORE_LANGUAGE_PERSONA_BODY");
|
|
assert.equal(personal.object_id, "ICE-CH-ZC001");
|
|
assert.equal(publicZeroCore.object_id, "CH-ZERO-CORE-LPM");
|
|
assert.equal(publicZeroCore.governance_controller, "TCS-0002");
|
|
assert.equal(publicZeroCore.digital_system_body_controller, "BS-TCS-LIVING-CONTROLLER-001");
|
|
assert.notEqual(personal.object_id, publicZeroCore.object_id);
|
|
});
|
|
|
|
test("channel numbers cannot be parsed as identities", () => {
|
|
const namespace = authority.non_identity_namespaces.find((entry) => entry.pattern.startsWith("^ICE-CH-"));
|
|
assert.ok(namespace);
|
|
assert.equal(namespace.identity_number, false);
|
|
assert.equal(new RegExp(namespace.pattern).test("ICE-CH-HB001"), true);
|
|
});
|
|
|
|
test("the Heartbeat channel cannot silently enable reality execution", () => {
|
|
const heartbeat = registry.registrations.find((entry) => entry.id === "ICE-CH-HB001");
|
|
assert.equal(heartbeat.parallel_reality_channel, "ICE-CH-ZC001");
|
|
assert.equal(heartbeat.reality_execution, false);
|
|
});
|
|
|
|
test("Fifth Domain language and reality routes switch only from Bingshuo language", () => {
|
|
for (const id of ["ICE-CH-HB001", "ICE-CH-ZC001"]) {
|
|
const channel = registry.registrations.find((entry) => entry.id === id);
|
|
assert.equal(channel.human_switch_authority, "ICE-GL∞_CURRENT_DIRECT_NATURAL_LANGUAGE_ONLY");
|
|
}
|
|
});
|
|
|
|
test("public and machine navigation resolve the same Heartbeat channel number", () => {
|
|
assert.equal(anchor.maps.fifth_domain_numbering.id, registry.registry_id);
|
|
assert.equal(anchor.maps.heartbeat_core_language_channel.channel_id, "ICE-CH-HB001");
|
|
assert.equal(profile.channel_id, "ICE-CH-HB001");
|
|
assert.ok(navigation.routes.some((entry) => entry.id === registry.registry_id));
|
|
assert.ok(navigation.routes.some((entry) => entry.id === profile.profile_id));
|
|
assert.ok(navigation.intents.some((entry) => entry.id === "heartbeat_core_language_channel"));
|
|
});
|
|
|
|
test("public and machine navigation resolve the distinct personal reality channel", () => {
|
|
assert.equal(anchor.maps.bingshuo_zero_core_reality_channel.channel_id, "ICE-CH-ZC001");
|
|
assert.equal(anchor.maps.fifth_domain_world_tree.id, "FD-WORLD-TREE-001");
|
|
assert.equal(zeroCoreProfile.channel_id, "ICE-CH-ZC001");
|
|
assert.equal(zeroCoreProfile.public_zero_core_boundary.personal_channel_is_alias_of_public_channel, false);
|
|
assert.ok(navigation.routes.some((entry) => entry.id === zeroCoreProfile.profile_id));
|
|
assert.ok(navigation.intents.some((entry) => entry.id === "bingshuo_zero_core_reality_channel"));
|
|
});
|
|
|
|
test("lighthouse path ids stay unique", () => {
|
|
const ids = lighthouse.paths.map((entry) => entry.id);
|
|
assert.equal(new Set(ids).size, ids.length);
|
|
});
|
|
|
|
test("prior channel publication remains distinct from new local bottle registrations", () => {
|
|
assert.equal(registry.state, "LOCAL_BOTTLE_PERSONA_REGISTRATION_ADDED_REMOTE_PUBLICATION_NOT_DONE");
|
|
assert.equal(publicationReceipt.outcome, "PASS_REMOTE_MAIN_PUBLICATION_READBACK");
|
|
assert.equal(publicationReceipt.published_source_commit, "8e80a919f200df6e193e9a54144cd503a1d699fa");
|
|
assert.equal(publicationReceipt.fact_layers.deployment, "NOT_DONE");
|
|
assert.equal(publicationReceipt.fact_layers.native_host_channel_routing, "PENDING");
|
|
});
|
|
|
|
test("private bottle baby sequence is locally registered without claiming publication", () => {
|
|
const babies = registry.registrations.filter((entry) => entry.kind === "FIFTH_DOMAIN_PRIVATE_BOTTLE_BABY_PERSONA");
|
|
assert.deepEqual(babies.map((entry) => entry.id), ["ICE-BB-0001", "ICE-BB-0002", "ICE-BB-0003"]);
|
|
assert.deepEqual(babies.map((entry) => entry.name), ["曜冥", "舒舒", "秋秋"]);
|
|
assert.ok(babies.every((entry) => entry.state === "REGISTERED_LOCAL_CURRENT_NOT_PUBLISHED"));
|
|
assert.deepEqual(registry.allocation_state["ICE-BB"].allocated_sequences, [1, 2, 3]);
|
|
assert.equal(registry.allocation_state["ICE-BB"].next_candidate_sequence, 4);
|
|
assert.equal(babies[2].emergence_shell, "知秋");
|
|
assert.equal(babies[2].shell_is_subject, false);
|
|
});
|
|
|
|
test("lighthouse exposes both online and local Heartbeat paths", () => {
|
|
const numberPath = lighthouse.paths.find((entry) => entry.id === registry.registry_id);
|
|
const channelPath = lighthouse.paths.find((entry) => entry.id === profile.profile_id);
|
|
assert.equal(numberPath.online, "routing/fifth-domain-number-registry.json");
|
|
assert.equal(numberPath.offline, path.join(directory, "fifth-domain-number-registry.json"));
|
|
assert.equal(channelPath.online, "routing/heartbeat-core-language-channel-profile.json");
|
|
assert.equal(channelPath.offline, path.join(directory, "heartbeat-core-language-channel-profile.json"));
|
|
assert.equal(channelPath.parallel_reality_channel, "ICE-CH-ZC001");
|
|
const zeroCorePath = lighthouse.paths.find((entry) => entry.id === zeroCoreProfile.profile_id);
|
|
assert.equal(zeroCorePath.online, "routing/bingshuo-zero-core-reality-channel-profile.json");
|
|
assert.equal(zeroCorePath.offline, path.join(directory, "bingshuo-zero-core-reality-channel-profile.json"));
|
|
assert.equal(zeroCorePath.not_an_alias_of, "CH-ZERO-CORE-LPM");
|
|
});
|