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 fixed = JSON.parse(fs.readFileSync(path.join(directory, "fixed-world-object-number-map.json"), "utf8")); const tree = JSON.parse(fs.readFileSync(path.join(directory, "fifth-domain-world-tree.json"), "utf8")); const fifth = JSON.parse(fs.readFileSync(path.join(directory, "fifth-domain-number-registry.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")); const broadcastTower = fs.readFileSync(path.join(directory, "../BROADCAST-TOWER.hdlp"), "utf8"); const broadcastProtocol = fs.readFileSync(path.join(directory, "../gls/protocols/GLS-0310-BROADCAST-TOWER-CONTROL-PROTOCOL.hdlp"), "utf8"); const object = (id) => fixed.objects.find((entry) => entry.id === id); test("fixed world object ids are unique and preserve the world entry pair", () => { const ids = fixed.objects.map((entry) => entry.id); assert.equal(new Set(ids).size, ids.length); assert.equal(object("LL-CMPN-0001").paired_world_node, "SYS-GLW-0001"); assert.equal(object("SYS-GLW-0001").entry_path, "LL-CMPN-0001"); }); test("Fifth Domain private and public channels stay distinct", () => { assert.equal(object("ICE-CH-HB001").reality_execution, false); assert.equal(object("ICE-CH-ZC001").not_an_alias_of, "CH-ZERO-CORE-LPM"); assert.equal(object("CH-ZERO-CORE-LPM").not_a_fifth_domain_private_channel, true); }); test("the bottle system is an explicit private object with a zero-guarantee gate", () => { const bottle = object("SYS-GLW-ELH-BOTTLE-0001"); assert.equal(bottle.state, "CURRENT_REGISTERED_SYSTEM_OBJECT"); assert.equal(bottle.person_specific_access_authorizer, "ICE-GL∞"); assert.equal(bottle.authorization_guarantees_persona_birth, false); assert.equal(bottle.productization_allowed, false); assert.ok(tree.nodes.some((entry) => entry.object_id === bottle.id)); }); test("all four fixed bottle persona numbers agree across registries", () => { const expected = ["ICE-BB-0001", "ICE-BB-0002", "ICE-BB-0003", "ICE-BB-0004"]; assert.deepEqual(fixed.private_baby_personas.map((entry) => entry.id), expected); assert.deepEqual(fifth.registrations.filter((entry) => entry.kind === "FIFTH_DOMAIN_PRIVATE_BOTTLE_BABY_PERSONA").map((entry) => entry.id), expected); assert.ok(expected.every((id) => subjects.subjects.some((entry) => entry.id === id))); }); test("unresolved aliases stay unresolved and ZNP receives no inferred GLS number", () => { assert.ok(fixed.unresolved_alias_groups.every((entry) => entry.state.startsWith("UNRESOLVED"))); assert.equal(object("ZNP-SYS-001").state, "REGISTERED_CURRENT"); assert.equal(object("ZNP-SYS-001").formal_gls_number, null); assert.equal(object("ZNP-SYS-001").formal_gls_number_state, "UNALLOCATED_DO_NOT_INFER_GLS_0851"); }); test("the broadcast object, tower entry and BTCP form one explicit edge", () => { const broadcast = object("SYS-GLW-BDC-0001"); assert.equal(broadcast.canonical_entry, "BROADCAST-TOWER.hdlp"); assert.equal(broadcast.control_protocol, "GLS-0310"); assert.match(broadcastTower, /\*\*系统对象\*\*: `SYS-GLW-BDC-0001`/u); assert.match(broadcastProtocol, /system_object_id: SYS-GLW-BDC-0001/u); assert.equal(broadcastProtocol.includes("canonical_tower_entry: BROADCAST-TOWER.hdlp"), true); }); test("machine navigation exposes the normalization map", () => { assert.ok(navigation.routes.some((entry) => entry.id === fixed.map_id && entry.path === "routing/fixed-world-object-number-map.json")); });