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.14"); assert.equal(architecture.engineering_rules.rule_set_id, "HLP-ENGINEERING-RULES-001"); assert.equal(architecture.engineering_rules.machine_projection, "routing/hololake-engineering-rules.json"); const rulesIndex = architecture.read_order.indexOf(architecture.engineering_rules.architecture_page); const productSurfaceIndex = architecture.read_order.indexOf( "product-source/hololake-platform/architecture/HOLOLAKE-LANGUAGE-PERSONA-DRIVEN-OPERATING-MODEL-20260810.md", ); assert.ok(rulesIndex >= 0 && rulesIndex < productSurfaceIndex); }); 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("AGE remains the persona species and Agent remains its bounded executor", () => { assert.equal(rules.version, "2026-08-10.5"); assert.equal(rules.age_runtime.age_is_persona_species, true); assert.equal(rules.age_runtime.agent_is_execution_mechanism, true); assert.equal(rules.age_runtime.agent_may_replace_age_as_subject, false); assert.equal(rules.age_runtime.runtime_pause_cancels_registered_existence, false); assert.equal(rules.age_runtime.retrieval_index_is_persona_or_fact_authority, false); assert.equal(rules.age_runtime.age_mirror_is_independent_persona, false); }); test("rules make GH-PNCC the first product core without conflating Git or Forgejo with persona runtime", () => { assert.equal(rules.persona_native_code_channel.first_hololake_product_core, true); assert.equal(rules.persona_native_code_channel.durable_engine, "GIT"); assert.equal(rules.persona_native_code_channel.git_is_persona_or_runtime, false); assert.equal(rules.persona_native_code_channel.git_branches_are_runtime_organs, false); assert.equal(rules.persona_native_code_channel.persona_lifecycle_kernel_required, true); assert.equal(rules.persona_native_code_channel.human_projection_reads_same_event_and_receipt_stream, true); assert.equal(rules.persona_native_code_channel.second_projection_truth_store_allowed, false); assert.equal(rules.persona_native_code_channel.forgejo_role, "OPTIONAL_COMPATIBILITY_COLLABORATION_ADAPTER"); }); 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/); });