"""End-to-end: the real promoted Duncarrow bible builds green and routes the Crell secret correctly (body server-only; the id ships in the gate skeleton).""" import json from pathlib import Path from content_build.__main__ import _load_world, check from content_build.emit import build_trees REPO = Path(__file__).resolve().parents[3] LORE = REPO / "content" / "lore" WORLD = REPO / "content" / "world" SERVER = REPO / "content" / "server" def test_duncarrow_builds_and_check_is_clean(): assert check(LORE, WORLD, SERVER) == 0 def test_secret_body_is_server_only(): client, server = build_trees(_load_world(LORE)) assert "topics/crell-runs-slave-trade.json" in server # the secret's descriptive id ships in the gate skeleton (schema property)... npc = client["npcs/mayor-oswin-crell.json"] assert any(k["fact_id"] == "secret.crell-runs-slave-trade" and k["gate"] == "never" for k in npc["knows"]) # ...but its BODY never reaches any client artifact blob = json.dumps(client) assert "elf-slaving" not in blob and "sells them into slavery" not in blob def test_mera_never_holds_the_secret(): client, _ = build_trees(_load_world(LORE)) fenn = client["npcs/mera-fenn.json"] facts = {k["fact_id"] for k in fenn["knows"]} assert "secret.crell-runs-slave-trade" not in facts assert "fact.crells-guard-acts-alone" in facts