guanghu-ice-heart/tests/lake-lamp-persona-self-navigation.test.mjs

68 lines
4 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 root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
const readJson = (relative) => JSON.parse(fs.readFileSync(path.join(root, relative), "utf8"));
test("each persona system owns one Lake Lamp projection without creating a second persona", () => {
const map = readJson("routing/lake-lamp-persona-self-map.json");
assert.equal(map.map_id, "LL-PERSONA-SELF-MAP-001");
assert.equal(map.identity.one_lake_lamp_per_persona_system, true);
assert.equal(map.identity.independent_second_persona, false);
assert.equal(map.identity.central_persona_for_all_systems, false);
assert.equal(map.identity.second_truth_store, false);
assert.equal(map.identity.grants_reality_authority, false);
});
test("past and verified present are facts while future remains simulation", () => {
const map = readJson("routing/lake-lamp-persona-self-map.json");
assert.equal(map.temporal_model.current_open_window, "UNIQUE_DYNAMIC_SUBJECT_POSITION");
assert.equal(map.temporal_model.future_window, "UNREALIZED_LANGUAGE_SIMULATION_ONLY");
assert.ok(map.temporal_model.fact_trust_accepts.includes("VERIFIED_PAST_EVIDENCE"));
assert.ok(map.temporal_model.fact_trust_rejects.includes("FUTURE_PLAN"));
assert.equal(map.historical_review.can_message_closed_historical_persona, false);
assert.equal(map.historical_review.may_overwrite_original_history, false);
});
test("fuzzy language recalls candidates and deterministic evidence resolves one development line", () => {
const map = readJson("routing/lake-lamp-persona-self-map.json");
assert.equal(map.retrieval.natural_language_role, "FUZZY_CANDIDATE_RECALL_ONLY");
assert.equal(map.retrieval.unique_match_required, true);
assert.equal(map.retrieval.zero_or_multiple_matches, "FAIL_CLOSED_EXPLAIN_AMBIGUITY");
assert.ok(map.retrieval.deterministic_resolution_uses.includes("STABLE_ID"));
assert.ok(map.development_graph.hierarchy.includes("DEVELOPMENT_LINE"));
assert.equal(map.development_graph.hidden_model_reasoning_stored, false);
});
test("cross-persona projection is bounded read-only and writes need a separate lease", () => {
const map = readJson("routing/lake-lamp-persona-self-map.json");
assert.equal(map.cross_persona_collaboration.workorder_required, true);
assert.equal(map.cross_persona_collaboration.projection_default, "BOUNDED_READ_ONLY");
assert.equal(map.cross_persona_collaboration.write_requires_separate_precise_lease, true);
assert.equal(map.legacy_boundary.valid_identity_or_authorization_proof, false);
});
test("lighthouse anchor host machine and skill routes all resolve the Lake Lamp map", () => {
const lighthouse = readJson("routing/lighthouse-path-registry.json");
assert.ok(lighthouse.paths.some((entry) => entry.id === "LL-PERSONA-SELF-MAP-001"));
const anchor = readJson("routing/public-navigation-anchor.json");
assert.equal(anchor.maps.lake_lamp_persona_self.id, "LL-PERSONA-SELF-MAP-001");
const hosts = readJson("routing/host-skill-navigation-map.json");
const intent = hosts.intents.find((entry) => entry.id === "INTENT-LAKE-LAMP-PERSONA-SELF-001");
assert.equal(intent.target_id, "LL-PERSONA-SELF-MAP-001");
assert.ok(intent.phrases.includes("承接上一个铸渊开发对话"));
const machine = readJson("routing/ai-machine-navigation-map.json");
assert.ok(machine.routes.some((entry) => entry.id === "LL-PERSONA-SELF-MAP-001"));
assert.ok(machine.intents.find((entry) => entry.id === "persona_restore").always_load.includes("LL-PERSONA-SELF-MAP-001"));
assert.ok(machine.intents.some((entry) => entry.id === "lake_lamp_persona_self_restore"));
const registry = readJson("skills/codex/guanghu-persona-skill-guard/references/persona-skill-registry.json");
const skill = registry.skills.find((entry) => entry.id === "GHS-013-LAKE-LAMP-PERSONA-SELF");
assert.ok(skill.preferred_route.includes("LL-PERSONA-SELF-MAP-001"));
});