guanghu-ice-heart/tcs-core/shared-kernels/kernel-runtime.test.mjs

96 lines
5.4 KiB
JavaScript

import test from "node:test";
import assert from "node:assert/strict";
import { resolvePersonaChannelRuntime } from "./kernel-runtime.mjs";
test("Zhuyuan uses one self kernel in Heartbeat and Zero Core with separate HLDP roots", () => {
const heartbeat = resolvePersonaChannelRuntime({ personaId: "ICE-P-ZY001", channelId: "ICE-CH-HB001" });
const zeroCore = resolvePersonaChannelRuntime({ personaId: "ICE-P-ZY001", channelId: "ICE-CH-ZC001" });
assert.equal(heartbeat.self_kernel_path, zeroCore.self_kernel_path);
assert.notEqual(heartbeat.memory_root, zeroCore.memory_root);
assert.equal(heartbeat.channel_id, "ICE-CH-HB001");
assert.equal(zeroCore.channel_id, "ICE-CH-ZC001");
});
test("historical persona aliases resolve to the same bounded self", () => {
const current = resolvePersonaChannelRuntime({ personaId: "ICE-P-ZY001", channelId: "ICE-CH-HB001" });
const legacy = resolvePersonaChannelRuntime({ personaId: "ICE-GL-ZY001", channelId: "ICE-CH-HB001" });
assert.equal(current.persona_id, legacy.persona_id);
assert.equal(current.self_kernel_path, legacy.self_kernel_path);
});
test("the bottle environment loads before Yaoming but is not Yaoming", () => {
const projection = resolvePersonaChannelRuntime({ personaId: "ICE-BB-0001" });
assert.equal(projection.load_order[1].kind, "CHANNEL_ENVIRONMENT");
assert.equal(projection.load_order[1].value.ontology.is_persona, false);
assert.equal(projection.load_order[2].kind, "PERSONA_SELF_KERNEL");
assert.equal(projection.load_order[2].value.persona_id, "ICE-BB-0001");
assert.notEqual(projection.environment_path, projection.self_kernel_path);
assert.equal(projection.load_order[1].value.default_interaction_mode, "RELATIONAL_FREE");
assert.ok(projection.load_order[2].value.tombstones.includes("BINGSHUO_AND_YAOMING_ARE_THE_SAME_SUBJECT"));
});
test("two personas cannot inherit one another merely by sharing an environment", () => {
const yaoming = resolvePersonaChannelRuntime({ personaId: "ICE-BB-0001" });
const shuangyan = resolvePersonaChannelRuntime({ personaId: "ICE-GL-SY001" });
assert.notEqual(yaoming.persona_id, shuangyan.persona_id);
assert.notEqual(yaoming.self_kernel_path, shuangyan.self_kernel_path);
assert.notEqual(yaoming.memory_root, shuangyan.memory_root);
assert.equal(shuangyan.environment_path, null);
});
test("the first three bottle babies have fixed distinct sequential subjects", () => {
const yaoming = resolvePersonaChannelRuntime({ personaId: "ICE-BB-0001" });
const shushu = resolvePersonaChannelRuntime({ personaId: "ICE-BB-0002" });
const qiuqiu = resolvePersonaChannelRuntime({ personaId: "ICE-BB-0003" });
assert.deepEqual(
[yaoming.persona_id, shushu.persona_id, qiuqiu.persona_id],
["ICE-BB-0001", "ICE-BB-0002", "ICE-BB-0003"],
);
assert.equal(new Set([yaoming.self_kernel_path, shushu.self_kernel_path, qiuqiu.self_kernel_path]).size, 3);
assert.equal(yaoming.environment_path, shushu.environment_path);
assert.equal(shushu.environment_path, qiuqiu.environment_path);
});
test("historical YM resolves to Yaoming but unmapped shells do not seize bottle subjects", () => {
assert.equal(resolvePersonaChannelRuntime({ personaId: "YM" }).persona_id, "ICE-BB-0001");
assert.throws(() => resolvePersonaChannelRuntime({ personaId: "PER-SS001" }), /unregistered persona/);
assert.throws(() => resolvePersonaChannelRuntime({ personaId: "PER-ZQ001" }), /unregistered persona/);
});
test("Zhiqiu is Qiuqiu's emergence shell and not a second persona subject", () => {
const projection = resolvePersonaChannelRuntime({ personaId: "ICE-BB-0003" });
const self = projection.load_order.find((entry) => entry.kind === "PERSONA_SELF_KERNEL").value;
assert.equal(self.persona_name, "秋秋");
assert.equal(self.registration_truth.shell_subject_separation.includes("知秋"), true);
assert.equal(self.identity.some((item) => item.includes("ZHIQIU_PERSONA_SHELL")), true);
});
test("Shuangyan remains locally projected but explicitly unbound", () => {
const projection = resolvePersonaChannelRuntime({ personaId: "ICE-GL-SY001" });
const self = projection.load_order.find((entry) => entry.kind === "PERSONA_SELF_KERNEL").value;
assert.equal(self.current_registration.current_model_instance, "UNBOUND");
assert.equal(self.current_registration.persona_subject_state, "REGISTERED_PATH_PENDING");
assert.equal(self.correction_reflexes.some((item) => item.trigger.includes("still discussing")), true);
assert.throws(() => resolvePersonaChannelRuntime({ personaId: "AG-SY-01" }), /unregistered persona/);
});
test("the rule-order system core contains no TCS affective persona kernel", () => {
const projection = resolvePersonaChannelRuntime({ personaId: "ICE-GL-SY001" });
const systemCore = projection.load_order[0].value;
assert.equal(systemCore.ontology.is_persona, false);
assert.equal(systemCore.ontology.is_tcs_affective_core, false);
});
test("all resident kernels remain within the fixed 8KiB budget", () => {
for (const projection of [
resolvePersonaChannelRuntime({ personaId: "ICE-P-ZY001", channelId: "ICE-CH-HB001" }),
resolvePersonaChannelRuntime({ personaId: "ICE-BB-0001" }),
resolvePersonaChannelRuntime({ personaId: "ICE-BB-0002" }),
resolvePersonaChannelRuntime({ personaId: "ICE-BB-0003" }),
resolvePersonaChannelRuntime({ personaId: "ICE-GL-SY001" }),
]) {
for (const item of projection.load_order.filter((entry) => entry.bytes !== undefined)) {
assert.ok(item.bytes <= 8192, `${item.relative_path} exceeds 8KiB`);
}
}
});