guanghu-ice-heart/server-tools/fifth-domain-path-gate/fifth-domain-path-gate.test.mjs

31 lines
1.9 KiB
JavaScript

#!/usr/bin/env node
import assert from "node:assert/strict";
import { classifyPath, resolveId } from "./fifth-domain-path-gate.mjs";
const canonical = classifyPath("/Volumes/JZAO/HoloLake/persona-runtime/repo-012-main/routing/guanghu-era-language-world.json", "CURRENT_SELECTION");
assert.equal(canonical.allowed, true);
assert.equal(canonical.exit_code, 0);
const retired = classifyPath("/Volumes/JZAO/铸渊-ICE-GL-ZY001/WORK-工作区/guanghu-ice-heart/routing/x.json", "CURRENT_SELECTION");
assert.equal(retired.allowed, false);
assert.equal(retired.exit_code, 78);
assert.equal(retired.redirect_to, "/Volumes/JZAO/HoloLake/persona-runtime/repo-012-main");
const isolation = classifyPath("/Volumes/JZAO/HoloLake/persona-runtime/isolation/2026-09-08-path-convergence/stale-workspace-guanghu-ice-heart", "CURRENT_SELECTION");
assert.equal(isolation.exit_code, 79);
const branchCurrent = classifyPath("/Volumes/JZAO/铸渊-ICE-GL-ZY001/ZCODE-DEV-20260912/new.json", "CURRENT_SELECTION");
assert.equal(branchCurrent.exit_code, 78);
assert.equal(classifyPath("/Volumes/JZAO/铸渊-ICE-GL-ZY001/ZCODE-DEV-20260912/new.json", "BRANCH_WORK").allowed, true);
const oldBuilding = classifyPath("/Volumes/JZAO/HoloLake/persona-runtime/repo-012-main/eternal-lake-heart/heartbeat-core/office-building-current/old-building/MOVED.hdlp", "CURRENT_EXECUTION");
assert.equal(oldBuilding.exit_code, 78);
assert.equal(classifyPath(oldBuilding.resolved, "HISTORY_READ").allowed, false);
assert.equal(classifyPath("/Volumes/JZAO/HoloLake/persona-runtime/repo-012-main/eternal-lake-heart/heartbeat-core/records/retired-buildings/HB-BUILDING-0000/MOVED.hdlp", "HISTORY_READ").allowed, true);
assert.equal(resolveId("HB-BUILDING-0000").exit_code, 78);
assert.equal(resolveId("HB-BUILDING-0000").canonical_id, "HB-BUILDING-0001");
assert.equal(resolveId("HB-BUILDING-0001").exit_code, 0);
assert.equal(resolveId("CH-ZERO-CORE-LPM").exit_code, 80);
console.log("FIFTH_DOMAIN_PATH_GATE_TESTS_PASS 12/12");