hololake-system-architecture/routing/hololake-one-human-one-node.test.mjs

72 lines
3.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 root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
const readJson = (relative) => JSON.parse(fs.readFileSync(path.join(root, relative), "utf8"));
const architecture = readJson("routing/hololake-current-architecture.json");
const rules = readJson("routing/hololake-engineering-rules.json");
test("current architecture makes one human one independently operated node canonical", () => {
assert.equal(architecture.version, "2026-08-10.13");
assert.deepEqual(architecture.access_modes, [
"LOCAL_TERMINAL_NODE",
"USER_OWNED_REMOTE_NODE",
]);
assert.equal(architecture.node_sovereignty.principle, "ONE_HUMAN_ONE_INDEPENDENT_NODE");
assert.equal(architecture.node_sovereignty.canonical_user_root_nodes, 1);
assert.equal(architecture.node_sovereignty.maximum_human_owners_per_user_node, 1);
const sovereigntyIndex = architecture.read_order.indexOf(
architecture.node_sovereignty.architecture_page,
);
const systemBodyIndex = architecture.read_order.indexOf(
architecture.digital_bingshuo_system_body.architecture_page,
);
assert.ok(sovereigntyIndex >= 0 && sovereigntyIndex < systemBodyIndex);
});
test("platform hosting, pooled tenancy, private-data custody, and user workload concurrency are all zero", () => {
const policy = architecture.node_sovereignty;
assert.equal(policy.platform_provides_user_runtime_server, false);
assert.equal(policy.future_platform_hosting_route_allowed, false);
assert.equal(policy.platform_user_runtime_capacity, 0);
assert.equal(policy.platform_operates_shared_multitenant_user_runtime, false);
assert.equal(policy.platform_custodies_private_user_data, false);
assert.equal(policy.platform_assumes_user_workload_concurrency, false);
assert.equal(policy.platform_fallback_runtime, false);
assert.equal(policy.team_deployment_transfers_node_ownership, false);
});
test("the only user-node origins are user local terminal, user-purchased server, or user-owned IDE server", () => {
assert.deepEqual(architecture.node_sovereignty.allowed_origins, [
"USER_LOCAL_COMPUTER_TERMINAL",
"USER_PURCHASED_SERVER",
"USER_OWNED_IDE_SERVER_DEPLOYED_BY_EXPLICITLY_AUTHORIZED_TEAM",
]);
assert.equal(architecture.node_sovereignty.server_is_optional, true);
assert.equal(architecture.node_sovereignty.local_terminal_can_be_canonical_node, true);
});
test("global engineering rules and agent instructions receive the same zero-hosting boundary", () => {
assert.equal(rules.version, "2026-08-10.4");
assert.equal(rules.node_sovereignty.one_human_one_independent_node, true);
assert.equal(rules.node_sovereignty.platform_hosting_available, false);
assert.equal(rules.node_sovereignty.future_platform_hosting_route_allowed, false);
assert.equal(rules.node_sovereignty.platform_user_runtime_capacity, 0);
assert.equal(rules.node_sovereignty.shared_multitenant_runtime_available, false);
assert.equal(rules.node_sovereignty.platform_private_user_data_custody, false);
assert.equal(rules.node_sovereignty.platform_user_workload_concurrency, false);
for (const relative of [
"AGENTS.md",
"product-source/hololake-platform/AGENTS.md",
"product-source/hololake-platform/src-tauri/resources/agent-docs/AGENTS.md",
"product-source/hololake-platform/src-tauri/gen/apple/assets/agent-docs/AGENTS.md",
]) {
const content = fs.readFileSync(path.join(root, relative), "utf8");
assert.match(content, /One human has one independently operated canonical node/);
assert.match(content, /never provides user\s+runtime servers/);
}
});