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 registers the global engineering rule set", () => { assert.equal(architecture.version, "2026-08-10.12"); assert.equal(architecture.engineering_rules.rule_set_id, "HLP-ENGINEERING-RULES-001"); assert.equal(architecture.engineering_rules.machine_projection, "routing/hololake-engineering-rules.json"); assert.equal(architecture.read_order[2], architecture.engineering_rules.architecture_page); }); test("rules require dynamic truth restore and immutable closed development lanes", () => { assert.equal(rules.architecture_restore.dynamic_current_pointer_required, true); assert.equal(rules.task_continuity.closed_development_can_reopen, false); assert.equal(rules.task_continuity.single_writer_lease_required, true); assert.equal(rules.truth_layers.repository_publication_is_deployment, false); assert.equal(rules.truth_layers.deployment_is_health, false); }); test("rules keep UI, server identity, domains, and updates inside their boundaries", () => { assert.equal(rules.ui_plugins.can_sign_server_writes, false); assert.equal(rules.server_writes.root_or_ssh_is_node_identity, false); assert.equal(rules.domain_responsibility.mutual_operational_liability, false); assert.equal(rules.desktop_updates.default_delivery, "SIGNED_IN_PLACE_UPDATE"); assert.equal(rules.publication.public_readback_required, true); assert.equal(rules.publication.missing_refresh_trigger_must_be_reported, true); assert.equal(rules.node_sovereignty.platform_hosting_available, false); assert.equal(rules.node_sovereignty.shared_multitenant_runtime_available, false); }); test("human and product agent rules receive the same current system boundary", () => { const rootAgents = fs.readFileSync(path.join(root, "AGENTS.md"), "utf8"); const productAgents = fs.readFileSync( path.join(root, "product-source/hololake-platform/AGENTS.md"), "utf8", ); const bundledAgents = fs.readFileSync( path.join(root, "product-source/hololake-platform/src-tauri/resources/agent-docs/AGENTS.md"), "utf8", ); assert.match(rootAgents, /System-body and execution boundary/); assert.match(rootAgents, /do not force a verified persona to remain a generic guide/); assert.match(productAgents, /HLP-ENGINEERING-RULES-001/); assert.match(productAgents, /missing-trigger reminder/); assert.match(bundledAgents, /Root\/SSH is not node identity/); });