1419 lines
85 KiB
Python
1419 lines
85 KiB
Python
"""
|
|
Pytest verification suite for hyperstitionstudio-core (hyperstitionstud_io.*).
|
|
Tests:
|
|
1. Zero-HTTPS offline namespace & HTML portability (urn:io:hyperstitionstud:*).
|
|
2. Base-36 AQ, Prime Rank, and G1-G6 vector parity across all 190 bilingual specimens.
|
|
3. Offline CMUdict phonetics fallback (zero --workdir dependency).
|
|
4. ReadOnlyIsolationGuard SHA-256 verification on glossary-registry.json & encyclopedia-manifest.json.
|
|
5. Local-config citation URL resolution ([citations.path_mounts]) and verify_draft() across all 5 proposals.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import hashlib
|
|
import json
|
|
import re
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
_SRC_DIR = Path(__file__).resolve().parents[1] / "src"
|
|
if _SRC_DIR.is_dir() and str(_SRC_DIR) not in sys.path:
|
|
sys.path.insert(0, str(_SRC_DIR))
|
|
|
|
from hyperstitionstud_io.ciphers import (
|
|
assert_zero_d_filter,
|
|
compute_aq,
|
|
evaluate_bidirectional_lock,
|
|
is_repdigit_37,
|
|
prime_rank,
|
|
)
|
|
from hyperstitionstud_io.ci.citation_sources import (
|
|
load_ledger,
|
|
resolve_citation_target,
|
|
verify_draft,
|
|
)
|
|
from hyperstitionstud_io.ci.doctor import run_diagnostics
|
|
from hyperstitionstud_io.config import load_workspace_config
|
|
from hyperstitionstud_io.glossary import ReadOnlyIsolationGuard
|
|
from hyperstitionstud_io.graph import URN_GRAPH_NS, make_entity_urn
|
|
from hyperstitionstud_io.phonetics import translate_batch
|
|
|
|
|
|
def test_offline_urn_namespaces_and_no_external_https_fonts() -> None:
|
|
assert URN_GRAPH_NS == "urn:io:hyperstitionstud:ns:kg:1.0"
|
|
assert make_entity_urn("zoology", "build", "S1") == "urn:io:hyperstitionstud:zoology:build:S1"
|
|
|
|
cfg = load_workspace_config()
|
|
for html_p in (
|
|
cfg.core_dir / "site" / "index.html",
|
|
cfg.core_dir / "site" / "donate" / "index.html",
|
|
cfg.core_dir / "site" / "learn" / "index.html",
|
|
cfg.core_dir / "site" / "quant" / "index.html",
|
|
cfg.core_dir / "site" / "gallery" / "index.html",
|
|
cfg.knowledge_graph_dir / "index.html",
|
|
cfg.knowledge_graph_dir / "docs" / "cross-repo-dependency-and-audit-flow-diagram.html",
|
|
cfg.paths["gematria_js_dir"] / "index.html",
|
|
):
|
|
txt = html_p.read_text(encoding="utf-8")
|
|
assert "fonts.googleapis.com" not in txt
|
|
assert "https://hyperstitionstud.io" not in txt
|
|
assert "by Lemurs." in txt, f"Missing global Lemurs footer in {html_p}"
|
|
assert ("♥" in txt or "♥" in txt), f"Missing Unicode heart in {html_p}"
|
|
|
|
g3_css_txt = (cfg.core_dir / "site" / "assets" / "hs-group3-basalt-chamfer.css").read_text(encoding="utf-8")
|
|
for req_donate_sel in (".nav-donate-sep {", ".btn-donate-pill {", ".btn-donate-pill:hover {", ".donate-pill-emblem {"):
|
|
assert req_donate_sel in g3_css_txt, f"Missing canonical {req_donate_sel} in hs-group3-basalt-chamfer.css"
|
|
|
|
for nav_p in (
|
|
cfg.core_dir / "site" / "index.html",
|
|
cfg.core_dir / "site" / "learn" / "index.html",
|
|
cfg.core_dir / "site" / "quant" / "index.html",
|
|
cfg.core_dir / "site" / "engineering" / "index.html",
|
|
cfg.core_dir / "site" / "math" / "index.html",
|
|
):
|
|
nav_txt = nav_p.read_text(encoding="utf-8")
|
|
assert "hs-group3-basalt-chamfer.css" in nav_txt, f"Missing shared stylesheet in {nav_p}"
|
|
assert "btn-donate-pill" in nav_txt, f"Missing distinct stadium-pill Donate button in {nav_p}"
|
|
assert '<span class="donate-pill-emblem" aria-hidden="true">♥</span><span>DONATE</span>' in nav_txt, (
|
|
f"Missing canonical circular 1:2 Donate emblem markup in {nav_p}"
|
|
)
|
|
assert "margin-left: auto" in nav_txt, f"Missing right-justification margin-left: auto in {nav_p}"
|
|
assert ".btn-donate-pill {" not in nav_txt and ".donate-pill-emblem {" not in nav_txt, (
|
|
f"Inline .btn-donate-pill/.donate-pill-emblem override found in {nav_p} (must inherit from hs-group3-basalt-chamfer.css)"
|
|
)
|
|
|
|
schemas_dir = cfg.core_dir / "schemas" / "v1"
|
|
for sp in schemas_dir.glob("*.schema.json"):
|
|
s_obj = json.loads(sp.read_text(encoding="utf-8"))
|
|
assert s_obj["$id"].startswith("urn:io:hyperstitionstud:schema:v1:")
|
|
assert "https://hyperstitionstud.io" not in sp.read_text(encoding="utf-8")
|
|
|
|
# Verify all visible site version numbers match hyperstitionstud_io.__version__
|
|
from hyperstitionstud_io import __version__ as cur_ver
|
|
from hyperstitionstud_io.version_sync import sync_workspace_version
|
|
|
|
v_sync = sync_workspace_version(cur_ver, check_only=True, ws_root=cfg.workspace_root)
|
|
assert v_sync["all_in_sync"] is True, f"Site version drift detected: {v_sync['mismatched_files']}"
|
|
|
|
# Verify PLAN-ELIMINATE-CONTAINER-HOST-PATHS-AND-TARGET-PUBLIC-WEB-ROUTES (0 container host paths in codebase)
|
|
import os
|
|
import tarfile
|
|
|
|
forbidden_host_prefix = "/home/" + "m00t"
|
|
for rdir in (
|
|
cfg.core_dir,
|
|
cfg.archive_dir.parent,
|
|
cfg.zoology_dir,
|
|
cfg.knowledge_graph_dir,
|
|
cfg.paths["gematria_js_dir"],
|
|
cfg.paths.get("ci_repo_dir", cfg.workspace_root / "hyperdope-ci-build"),
|
|
):
|
|
if not rdir.is_dir():
|
|
continue
|
|
for root_s, dirs, files in os.walk(rdir):
|
|
dirs[:] = [d for d in dirs if d not in (".git", "node_modules", "__pycache__", ".cache", "untracked")]
|
|
for fn in files:
|
|
if fn.startswith(".~lock."):
|
|
continue
|
|
fp = Path(root_s) / fn
|
|
if fp.suffix in (".png", ".mp3", ".db", ".gz", ".br", ".ttf", ".woff", ".woff2", ".pdf"):
|
|
continue
|
|
try:
|
|
ftxt = fp.read_text(encoding="utf-8")
|
|
except Exception:
|
|
continue
|
|
assert forbidden_host_prefix not in ftxt, f"Forbidden container host path found in {fp}"
|
|
for tgz in (
|
|
cfg.knowledge_graph_dir / "docs" / "archive" / "completed-plans-archive.tar.gz",
|
|
cfg.zoology_dir / "docs" / "archive" / "completed-plans-archive.tar.gz",
|
|
cfg.knowledge_graph_dir / "docs" / "plans" / "inactive" / "inactive-plans-archive.tar.gz",
|
|
):
|
|
if tgz.is_file():
|
|
with tarfile.open(tgz, "r:gz") as tf:
|
|
for m in tf.getmembers():
|
|
if m.name.endswith(".md"):
|
|
m_txt = tf.extractfile(m).read().decode("utf-8", errors="replace")
|
|
assert forbidden_host_prefix not in m_txt, f"Forbidden host path in {tgz}:{m.name}"
|
|
|
|
|
|
def test_ciphers_and_bilingual_ledger_parity() -> None:
|
|
cfg = load_workspace_config()
|
|
gl_path = cfg.zoology_dir / "taxonomy" / "glossary-registry.json"
|
|
gl_data = json.loads(gl_path.read_text(encoding="utf-8"))
|
|
for item in gl_data["bilingual_vocabulary_ledger"]:
|
|
lock = evaluate_bidirectional_lock(item["eng"], item["ing"])
|
|
assert lock["eng_aq"] == item["eng_aq"]
|
|
assert lock["ing_aq"] == item["ing_aq"]
|
|
assert lock["delta"] == item["delta"]
|
|
assert lock["isometric"] == item["isometric"]
|
|
assert lock["twin_prime_mutation"] == item["twin_prime"]
|
|
assert compute_aq("Dario Amodei") == 193
|
|
assert prime_rank(193) == 44
|
|
assert is_repdigit_37(333) and is_repdigit_37(666) and is_repdigit_37(777)
|
|
assert_zero_d_filter("Pure Base-36 Alphanumeric Qabbala")
|
|
|
|
|
|
def test_offline_phonetics_fallback_zero_workdir() -> None:
|
|
res = translate_batch(
|
|
["schizoanalysis", "abstract machine", "synthetic data", "Anthropic", "flash crash", "Blackwell"],
|
|
workdir="/nonexistent/offline/path",
|
|
)
|
|
assert res["schizoanalysis"] == "shizohnalizis"
|
|
assert res["abstract machine"] == "abstrakt masheen"
|
|
assert res["synthetic data"] == "sinthetik dayta"
|
|
assert res["Anthropic"] == "anthropik"
|
|
assert res["flash crash"] == "flash krash"
|
|
assert res["Blackwell"] == "blakwel"
|
|
|
|
|
|
def test_read_only_isolation_guard() -> None:
|
|
cfg = load_workspace_config()
|
|
with ReadOnlyIsolationGuard(cfg.read_only_files) as guard:
|
|
_ = [p.stat().st_size for p in cfg.read_only_files]
|
|
receipt = guard.audit_receipt()
|
|
assert receipt["all_unchanged"] is True
|
|
|
|
|
|
def test_local_config_citation_resolution_and_proposals() -> None:
|
|
mounts = {
|
|
"/workspace/ingglish-hyperdope-gematria": "https://git.libre.audio/m00t/ingglish-hyperdope-gematria/src/branch/main"
|
|
}
|
|
# Mapped prefix resolves to configured remote URL
|
|
u1 = resolve_citation_target(
|
|
"/workspace/ingglish-hyperdope-gematria/ingglish-aq-archive/70-dossier-news-2026-11-28.md",
|
|
path_mounts=mounts,
|
|
)
|
|
assert u1 == "https://git.libre.audio/m00t/ingglish-hyperdope-gematria/src/branch/main/ingglish-aq-archive/70-dossier-news-2026-11-28.md"
|
|
|
|
# Unmapped prefix NEVER resolves to a global namespace URL; stays local filesystem path
|
|
u2 = resolve_citation_target(
|
|
"/workspace/technocapital-singularity-zoology/dossiers/65-dossier-technocapital-singularity-autoregressive-ai.md",
|
|
path_mounts=mounts,
|
|
)
|
|
assert u2 == "/workspace/technocapital-singularity-zoology/dossiers/65-dossier-technocapital-singularity-autoregressive-ai.md"
|
|
|
|
cfg = load_workspace_config()
|
|
common_sources = load_ledger(cfg.zoology_dir / "taxonomy" / "citations-ledger-common.json")["sources"]
|
|
for fname in (
|
|
"proposal-fantasy-football-technocapital-roster-engine.md",
|
|
"proposal-corporate-board-technocapital-allocation.md",
|
|
"proposal-fund-manager-novel-investment-discovery.md",
|
|
):
|
|
code, errors, _ = verify_draft(cfg.zoology_dir / fname, common_sources, require_evidence=True)
|
|
assert code == 0, f"{fname} failed: {errors}"
|
|
|
|
eng_sources = load_ledger(cfg.zoology_dir / "taxonomy" / "citations-ledger-english-aq.json")["sources"]
|
|
for fname in (
|
|
"proposal-corporate-board-standard-english-aq.md",
|
|
"proposal-fund-manager-standard-english-aq.md",
|
|
):
|
|
code, errors, _ = verify_draft(cfg.zoology_dir / fname, eng_sources, require_evidence=True)
|
|
assert code == 0, f"{fname} failed: {errors}"
|
|
|
|
|
|
def test_doctor_all_checks_pass() -> None:
|
|
diag = run_diagnostics()
|
|
assert diag["all_checks_passed"] is True
|
|
|
|
|
|
def test_ipld_quant_and_mcp_server() -> None:
|
|
from hyperstitionstud_io.ipld import compute_dag_json_cidv1, encode_dag_json
|
|
from hyperstitionstud_io.mcp.server import dispatch_jsonrpc
|
|
from hyperstitionstud_io.quant.collector import build_financial_quant_harvest
|
|
|
|
# 1. IPLD dag-json & CIDv1 deterministic parity
|
|
b1 = encode_dag_json({"b": 2, "a": 1})
|
|
b2 = encode_dag_json({"a": 1, "b": 2})
|
|
assert b1 == b2 == b'{"a":1,"b":2}'
|
|
cid = compute_dag_json_cidv1({"a": 1, "b": 2})
|
|
assert cid.startswith("baguqeera")
|
|
|
|
# 2. Quantitative Financial Telemetry Collector (100% Real Exchange Observations — Zero Synthesized Data)
|
|
from hyperstitionstud_io.quant.collector import CANONICAL_WATCHLIST_24, NO_DATA_AVAILABLE
|
|
|
|
assert all("close_usd" not in item for item in CANONICAL_WATCHLIST_24), "Watchlist metadata must not hardcode fake prices"
|
|
q_harvest = build_financial_quant_harvest(live_fetch=False)
|
|
assert q_harvest["harvest_mode"] == "us-closing-bell"
|
|
assert q_harvest["synthetic_data_eliminated"] is True
|
|
assert q_harvest["regime_summary"]["instrument_count"] == 24
|
|
assert q_harvest["regime_summary"]["instruments_with_data_count"] == 23
|
|
assert q_harvest["regime_summary"]["instruments_without_data"] == ["ANTHR-PVT"]
|
|
assert q_harvest["isolation_receipt"]["all_unchanged"] is True
|
|
assert q_harvest["ipld_dag_json_cidv1"]["/"].startswith("baguqeera")
|
|
|
|
anthr_inst = next(x for x in q_harvest["instruments"] if x["symbol"] == "ANTHR-PVT")
|
|
assert anthr_inst["data_available"] is False
|
|
assert NO_DATA_AVAILABLE in anthr_inst["status"]
|
|
assert anthr_inst["metrics"]["close_usd"] is None
|
|
assert anthr_inst["quant_encodings"]["close_spoken_ing"] == NO_DATA_AVAILABLE
|
|
|
|
nvda_inst = next(x for x in q_harvest["instruments"] if x["symbol"] == "NVDA")
|
|
assert nvda_inst["data_available"] is True
|
|
assert nvda_inst["metrics"]["close_usd"] == 150.49
|
|
assert nvda_inst["metrics"]["market_cap_str"] == NO_DATA_AVAILABLE
|
|
|
|
sol_inst = next(x for x in q_harvest["instruments"] if x["symbol"] == "SOL-USD")
|
|
assert sol_inst["data_available"] is True
|
|
assert sol_inst["metrics"]["close_usd"] == 71.71
|
|
assert sol_inst["metrics"]["market_cap_str"] == "$43B"
|
|
|
|
q_rollover = build_financial_quant_harvest(harvest_mode="utc-rollover", live_fetch=False)
|
|
assert q_rollover["harvest_mode"] == "utc-rollover"
|
|
assert q_rollover["isolation_receipt"]["all_unchanged"] is True
|
|
|
|
# 3. MCP Server JSON-RPC 2.0 Dispatch (initialize, tools/list, tools/call, resources/read, prompts/get)
|
|
init_resp = dispatch_jsonrpc({"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {"protocolVersion": "2025-03-26"}})
|
|
assert init_resp and init_resp["result"]["serverInfo"]["name"] == "hyperstitionstudio-mcp"
|
|
|
|
from hyperstitionstud_io.mcp.tools import MCP_TOOLS_SCHEMA
|
|
|
|
t_list = dispatch_jsonrpc({"jsonrpc": "2.0", "id": 2, "method": "tools/list"})
|
|
assert t_list and len(t_list["result"]["tools"]) == len(MCP_TOOLS_SCHEMA) and len(MCP_TOOLS_SCHEMA) >= 20
|
|
|
|
t_call = dispatch_jsonrpc({
|
|
"jsonrpc": "2.0",
|
|
"id": 3,
|
|
"method": "tools/call",
|
|
"params": {"name": "hs_evaluate_aq_and_ingglish", "arguments": {"terms": ["schizoanalysis", "abstract machine", "synthetic data"]}},
|
|
})
|
|
assert t_call and t_call["result"]["isError"] is False
|
|
parsed_tool = json.loads(t_call["result"]["content"][0]["text"])
|
|
assert parsed_tool["exact_gen1_singularity"] is True
|
|
|
|
q_call = dispatch_jsonrpc({
|
|
"jsonrpc": "2.0",
|
|
"id": 4,
|
|
"method": "tools/call",
|
|
"params": {"name": "hs_scan_financial_quant_harvest", "arguments": {"symbol_filter": "NVDA"}},
|
|
})
|
|
assert q_call and q_call["result"]["isError"] is False
|
|
parsed_q = json.loads(q_call["result"]["content"][0]["text"])
|
|
assert len(parsed_q["instruments"]) == 1 and parsed_q["instruments"][0]["symbol"] == "NVDA"
|
|
|
|
r_read = dispatch_jsonrpc({
|
|
"jsonrpc": "2.0",
|
|
"id": 5,
|
|
"method": "resources/read",
|
|
"params": {"uri": "urn:io:hyperstitionstud:dossier:65"},
|
|
})
|
|
assert r_read and "292" in r_read["result"]["contents"][0]["text"]
|
|
|
|
p_get = dispatch_jsonrpc({
|
|
"jsonrpc": "2.0",
|
|
"id": 6,
|
|
"method": "prompts/get",
|
|
"params": {"name": "analyze_headline_zoology", "arguments": {"headline": "Nvidia Blackwell halts"}},
|
|
})
|
|
assert p_get and len(p_get["result"]["messages"]) == 1
|
|
|
|
# 4. Periodic Time-Series Bundle, LENS_REGISTRY Reversibility & REST API v1 (/api/v1/*)
|
|
from hyperstitionstud_io.mcp.rest import dispatch_rest_v1
|
|
from hyperstitionstud_io.quant.timeseries import build_quant_timeseries_bundle
|
|
|
|
ts_full = build_quant_timeseries_bundle(write_files=False)
|
|
assert ts_full["synthetic_data_eliminated"] is True
|
|
assert ts_full["periodicity_gate"]["enforced"] is True
|
|
assert ts_full["periodicity_gate"]["non_periodic_records_ingested"] == 0
|
|
assert ts_full["periodicity_gate"]["dated_news_dossiers_ingested"] >= 20
|
|
assert len(ts_full["dates_utc"]) == 30
|
|
assert all(re.match(r"^\d{4}-\d{2}-\d{2}$", d) for d in ts_full["dates_utc"])
|
|
assert len(ts_full["instruments"]) == 24
|
|
|
|
anthr_ts = next(x for x in ts_full["instruments"] if x["symbol"] == "ANTHR-PVT")
|
|
assert anthr_ts["data_available"] is False
|
|
assert anthr_ts["available_trading_days"] == 0
|
|
assert all(b["data_available"] is False and b["status"] == NO_DATA_AVAILABLE and b["close_usd"] is None for b in anthr_ts["bars"])
|
|
assert all(b["contingent_points"] is None for b in anthr_ts["bars"] if not b["co_present_in_news_wire"])
|
|
assert anthr_ts["timeseries_moments"]["ts_duty_cycle_pct"] is None
|
|
assert anthr_ts["timeseries_moments"]["ts_weighted_resonance"] is None
|
|
assert anthr_ts["timeseries_moments"]["ts_excess_over_replacement"] is None
|
|
assert anthr_ts["timeseries_moments"]["ts_optimal_lag_days"] is None
|
|
assert anthr_ts["timeseries_moments"]["ts_sparkline_30d"] is None
|
|
assert anthr_ts["timeseries_moments"]["ts_quantile_profile"]["p20_floor"] is None
|
|
assert all(v is None for v in anthr_ts["timeseries_moments"]["ts_lag_correlation_curve"].values())
|
|
assert all(v is None for v in anthr_ts["timeseries_moments"]["ts_regime_splits"].values())
|
|
assert anthr_ts["pokedex_profile"]["level"] is None
|
|
assert anthr_ts["pokedex_profile"]["nature"] is None
|
|
|
|
pltr_ts = next(x for x in ts_full["instruments"] if x["symbol"] == "PLTR")
|
|
assert pltr_ts["data_available"] is True
|
|
assert any("CLOSE_SELF_LOCK (159==palanter)" in (b["scope1_locks"] or []) for b in pltr_ts["bars"])
|
|
|
|
nvda_ts = next(x for x in ts_full["instruments"] if x["symbol"] == "NVDA")
|
|
assert nvda_ts["data_available"] is True
|
|
assert nvda_ts["available_trading_days"] == 19
|
|
assert sum(1 for b in nvda_ts["bars"] if not b["data_available"] and b["status"] == NO_DATA_AVAILABLE) == 11
|
|
assert nvda_ts["tradingview_symbol"] == "NASDAQ:NVDA"
|
|
assert "tradingview.com/chart/?symbol=NASDAQ%3ANVDA" in nvda_ts["tradingview_url"]
|
|
assert "doc_references" in nvda_ts
|
|
assert "#page=" in nvda_ts["doc_references"]["encyclopedia_deep_link"]
|
|
assert "search=" in nvda_ts["doc_references"]["encyclopedia_deep_link"]
|
|
assert "?select=aq:137" in nvda_ts["doc_references"]["knowledge_graph_deep_link"]
|
|
assert "#:~:text=" in nvda_ts["doc_references"]["exemplar_dossier_deep_link"]
|
|
assert "struct_isometric_armor" in nvda_ts["structural_vector"]
|
|
assert "ts_duty_cycle_pct" in nvda_ts["timeseries_moments"]
|
|
assert "fund_manager" in nvda_ts["lens_projections"]
|
|
assert "pokedex_scanner" in nvda_ts["lens_projections"]
|
|
|
|
sample_wire_day = next(d for d in ts_full["daily_wire_series"] if d["sample_equations"])
|
|
sample_eq = sample_wire_day["sample_equations"][0]
|
|
assert "#:~:text=" in sample_eq["dossier_deep_link"]
|
|
assert "?highlight=" in sample_eq["api_highlight_link"]
|
|
assert any("?select=aq:" in gl for gl in sample_eq["graph_hub_links"])
|
|
|
|
# Verify 100% lens-removal invariance when pokedex_scanner, tierzoo_ecology, and fantasy_sabermetrics are disabled
|
|
ts_stripped = build_quant_timeseries_bundle(enabled_lenses=("neutral_math", "fund_manager"), write_files=False)
|
|
assert ts_stripped["enabled_lenses"] == ["neutral_math", "fund_manager"]
|
|
nvda_stripped = next(x for x in ts_stripped["instruments"] if x["symbol"] == "NVDA")
|
|
assert set(nvda_stripped["lens_projections"].keys()) == {"neutral_math", "fund_manager"}
|
|
assert "pokedex_profile" not in nvda_stripped
|
|
assert ts_stripped["isolation_receipt"]["all_unchanged"] is True
|
|
|
|
# Verify REST API v1 endpoints (/api/v1/*)
|
|
st_code, _, st_body = dispatch_rest_v1("GET", "/api/v1/status")
|
|
assert st_code == 200 and st_body["ok"] is True and st_body["isolation_verified"] is True
|
|
|
|
oa_code, _, oa_body = dispatch_rest_v1("GET", "/api/v1/openapi.json")
|
|
assert oa_code == 200 and oa_body["openapi"] == "3.1.0" and "/api/v1/ciphers/evaluate" in oa_body["paths"]
|
|
|
|
ev_code, _, ev_body = dispatch_rest_v1("GET", "/api/v1/ciphers/evaluate?terms=schizoanalysis,abstract%20machine,synthetic%20data")
|
|
assert ev_code == 200 and ev_body["data"]["exact_gen1_singularity"] is True
|
|
|
|
qi_code, _, qi_body = dispatch_rest_v1("GET", "/api/v1/quant/instruments/NVDA?raw=1")
|
|
assert qi_code == 200 and len(qi_body["instruments"]) == 1 and qi_body["instruments"][0]["symbol"] == "NVDA"
|
|
|
|
gn_code, _, gn_body = dispatch_rest_v1("GET", "/api/v1/graph/nodes/aq:125")
|
|
assert gn_code == 200 and gn_body["ok"] is True
|
|
|
|
pk_code, _, pk_body = dispatch_rest_v1("GET", "/api/v1/zoology/pokedex/NVDA")
|
|
assert pk_code == 200 and pk_body["data"]["instruments"][0]["pokedex_profile"]["dex_number"] == "DEX #137"
|
|
|
|
d_code, d_ctype, d_body = dispatch_rest_v1("GET", "/api/v1/dossiers/65?format=raw")
|
|
assert d_code == 200 and "text/markdown" in d_ctype and "292" in d_body
|
|
|
|
hl_code, _, hl_body = dispatch_rest_v1("GET", "/api/v1/dossiers/65?highlight=292")
|
|
assert hl_code == 200 and hl_body["data"]["match_count"] >= 1 and len(hl_body["data"]["matched_passages"]) >= 1
|
|
|
|
qts_code, _, qts_body = dispatch_rest_v1("GET", "/api/v1/quant/timeseries?symbol=NVDA")
|
|
assert qts_code == 200 and qts_body["ok"] is True and len(qts_body["data"]["instruments"]) == 1
|
|
|
|
# Verify every single link in quant-tutorials.js, doc_references, and OPERATORS-MANUAL-QUANT-TIMESERIES-WORKBENCH.md resolves cleanly
|
|
cfg = load_workspace_config()
|
|
tut_js_path = cfg.core_dir / "site" / "quant" / "quant-tutorials.js"
|
|
tut_js_txt = tut_js_path.read_text(encoding="utf-8")
|
|
assert "let speechEnabled = true;" in tut_js_txt, "Tutorial voice narration must be enabled by default"
|
|
assert "playWebAudioTelemetryChime" in tut_js_txt, "WebAudio fallback chime must be present when OS TTS voices are absent"
|
|
|
|
# Verify QUANT_TERM_GLOSSARY (27 inline ⓘ info icons, <= 1 paragraph plain-English definitions & hyperlinked PDF Glossary quotes)
|
|
quant_html_txt = (cfg.core_dir / "site" / "quant" / "index.html").read_text(encoding="utf-8")
|
|
quant_app_txt = (cfg.core_dir / "site" / "quant" / "quant-app.js").read_text(encoding="utf-8")
|
|
assert "hs-info-icon" in quant_html_txt and "quantInfoPopover" in quant_html_txt
|
|
assert "const QUANT_TERM_GLOSSARY = {" in quant_app_txt
|
|
expected_term_ids = (
|
|
"guild_filter", "ticker_select", "projection_lens", "metric_mode",
|
|
"entity_threshold", "scope1_self_lock", "scope2_ring_migration", "scope3_wire_copresence",
|
|
"wire_velocity_bars", "vol20d_regimes", "heatmap_matrix",
|
|
"box_close_usd", "box_spoken_close", "box_scaled_cap", "box_bps_vol", "box_active_locks", "box_wire_copresent",
|
|
"lens_archetype", "ts_duty_cycle_pct", "ts_weighted_resonance", "ts_excess_over_replacement",
|
|
"ts_quantile_profile", "ts_optimal_lag_days", "ts_regime_splits",
|
|
"lag_correlation_explorer", "periodicity_gate_badge", "cidv1_provenance",
|
|
)
|
|
assert len(expected_term_ids) == 27
|
|
for tid in expected_term_ids:
|
|
assert f"{tid}: {{" in quant_app_txt, f"Missing QUANT_TERM_GLOSSARY entry: {tid}"
|
|
for m_plain in re.finditer(r'plain_english:\s*"([^"]+)"', quant_app_txt):
|
|
p_txt = m_plain.group(1)
|
|
assert "\n\n" not in p_txt and 40 <= len(p_txt) <= 450, f"Invalid plain_english length/paragraph: {p_txt}"
|
|
for m_glink in re.finditer(r'glossary_pdf_link:\s*GLOSSARY_PDF\s*\+\s*"#page=(\d+)&search=([^"]+)"', quant_app_txt):
|
|
pg_i = int(m_glink.group(1))
|
|
assert 1 <= pg_i <= 19, f"Glossary PDF page {pg_i} out of range 1..19"
|
|
|
|
all_quant_links: set[str] = set(re.findall(r'href:\s*"([^"]+)"', tut_js_txt))
|
|
for inst in ts_full["instruments"]:
|
|
for v in (inst.get("doc_references") or {}).values():
|
|
if isinstance(v, str) and v.startswith("/"):
|
|
all_quant_links.add(v)
|
|
for b_item in ts_full["builds"]:
|
|
for v in (b_item.get("doc_references") or {}).values():
|
|
if isinstance(v, str) and v.startswith("/"):
|
|
all_quant_links.add(v)
|
|
|
|
route_prefix_map = {
|
|
"/encyclopedia/": cfg.zoology_dir / "encyclopedia",
|
|
"/zoology/": cfg.zoology_dir,
|
|
"/archive/": cfg.archive_dir / "ingglish-aq-archive",
|
|
"/graph/": cfg.knowledge_graph_dir,
|
|
"/learn/": cfg.core_dir / "site" / "learn",
|
|
"/quant/": cfg.core_dir / "site" / "quant",
|
|
"/donate/": cfg.core_dir / "site" / "donate",
|
|
"/schemas/": cfg.core_dir / "schemas",
|
|
}
|
|
for link in sorted(all_quant_links):
|
|
if link.startswith("https://"):
|
|
continue
|
|
no_frag = link.split("#")[0]
|
|
base_p = no_frag.split("?")[0]
|
|
if base_p.startswith("/api/v1"):
|
|
l_code, _, _ = dispatch_rest_v1("GET", no_frag)
|
|
assert l_code == 200, f"Broken tutorial/doc_references REST API link: {link} (status {l_code})"
|
|
else:
|
|
matched_fs = None
|
|
for pref, fs_dir in route_prefix_map.items():
|
|
if base_p.startswith(pref):
|
|
matched_fs = fs_dir / base_p[len(pref):]
|
|
break
|
|
assert matched_fs is not None and matched_fs.is_file(), f"Broken tutorial/doc_references static link: {link} -> {matched_fs}"
|
|
|
|
err_code, _, err_body = dispatch_rest_v1("GET", "/api/v1/ciphers/evaluate")
|
|
assert err_code == 422 and err_body["ok"] is False
|
|
|
|
# 5. SQLite + FTS5 Catalog, Automatic REST/MCP Telemetry Population, Inactive Plan Isolation & Quiescent Logrotate Truncation
|
|
import os
|
|
import sqlite3
|
|
import tempfile
|
|
|
|
from hyperstitionstud_io.db.sqlite_meta import (
|
|
DEFAULT_MAX_TELEMETRY_BYTES,
|
|
build_catalog_sqlite_db,
|
|
get_api_telemetry_summary,
|
|
get_default_telemetry_db_path,
|
|
parse_size_spec_bytes,
|
|
query_coordinate_join,
|
|
query_fts_catalog,
|
|
query_registry_manifests,
|
|
query_timeseries_bars,
|
|
run_logrotate_directive,
|
|
truncate_telemetry_db_quiescent,
|
|
)
|
|
|
|
assert DEFAULT_MAX_TELEMETRY_BYTES == 100 * 1024 * 1024
|
|
assert parse_size_spec_bytes("100M") == 100 * 1024 * 1024
|
|
assert parse_size_spec_bytes("100MB") == 100 * 1024 * 1024
|
|
|
|
prev_env_chk = os.environ.pop("HYPERSTITION_TELEMETRY_DB_PATH", None)
|
|
try:
|
|
def_tel_p = get_default_telemetry_db_path()
|
|
assert str(def_tel_p) == "/var/lib/hyperstitionstud.io/api-telemetry.db" or ".cache/hyperstitionstud.io" in str(def_tel_p)
|
|
finally:
|
|
if prev_env_chk is not None:
|
|
os.environ["HYPERSTITION_TELEMETRY_DB_PATH"] = prev_env_chk
|
|
|
|
with tempfile.TemporaryDirectory() as tmp_dir:
|
|
tmp_path = Path(tmp_dir)
|
|
cat_db = tmp_path / "test-catalog.db"
|
|
tel_db = tmp_path / "test-telemetry.db"
|
|
|
|
cat_res = build_catalog_sqlite_db(cat_db)
|
|
assert cat_res["isolation_receipt"]["all_unchanged"] is True
|
|
assert cat_res["counts"]["registry_manifests"] >= 7
|
|
assert cat_res["counts"]["glossary_entries"] >= 282
|
|
assert cat_res["counts"]["kg_nodes"] == 388
|
|
assert cat_res["counts"]["kg_edges"] == 1282
|
|
assert cat_res["counts"]["dossiers"] >= 71
|
|
assert cat_res["counts"]["quant_timeseries_bars"] == 720
|
|
|
|
manifests = query_registry_manifests(cat_db)
|
|
assert any(m["registry_slug"] == "encyclopedia-graph" and m["dag_json_cidv1"].startswith("baguqeera") for m in manifests)
|
|
|
|
fts_res = query_fts_catalog("envideea", db_path=cat_db)
|
|
assert fts_res["match_count"] >= 1
|
|
|
|
coord_163 = query_coordinate_join(163, db_path=cat_db)
|
|
assert coord_163["coordinate_aq"] == 163
|
|
assert len(coord_163["kg_nodes"]) >= 1
|
|
assert len(coord_163["quant_timeseries_bars"]) >= 1
|
|
|
|
nvda_bars = query_timeseries_bars(symbol="NVDA", min_points=None, db_path=cat_db)
|
|
assert len(nvda_bars) == 30 and sum(1 for b in nvda_bars if b["data_available"] == 1) == 19
|
|
assert any(b["contingent_points"] is None for b in nvda_bars if b["data_available"] == 0)
|
|
|
|
# Verify MCP and REST API calls automatically populate the SQLite REST API metadata database
|
|
prev_tel_env = os.environ.get("HYPERSTITION_TELEMETRY_DB_PATH")
|
|
os.environ["HYPERSTITION_TELEMETRY_DB_PATH"] = str(tel_db)
|
|
try:
|
|
s1, _, _ = dispatch_rest_v1("GET", "/api/v1/status")
|
|
s2, _, _ = dispatch_rest_v1("GET", "/api/v1/quant/instruments/NVDA")
|
|
m1 = dispatch_jsonrpc({"jsonrpc": "2.0", "id": 99, "method": "tools/list"})
|
|
assert s1 == 200 and s2 == 200 and m1 is not None
|
|
|
|
# Verify inactive plan routes (/api/v1/meta/*, hs_query_sqlite_catalog) remain unexposed (404)
|
|
inact_meta_code, _, _ = dispatch_rest_v1("GET", "/api/v1/meta/manifests")
|
|
inact_tool_code, _, _ = dispatch_rest_v1("GET", "/api/v1/tools/hs_query_sqlite_catalog")
|
|
assert inact_meta_code == 404
|
|
assert inact_tool_code == 404
|
|
|
|
summary_before = get_api_telemetry_summary(tel_db)
|
|
assert summary_before["total_requests"] == 5
|
|
assert summary_before["internal_test_requests"] == 5
|
|
assert summary_before["external_production_requests"] == 0
|
|
assert summary_before["market_demand_confidence"] == "No data available"
|
|
assert summary_before["ringbuffer_count"] == 5
|
|
protocols_seen = {ep["protocol"] for ep in summary_before["endpoints"]}
|
|
assert protocols_seen == {"rest_v1", "mcp_jsonrpc"}
|
|
patterns_seen = {ep["endpoint_pattern"] for ep in summary_before["endpoints"]}
|
|
assert "/api/v1/status" in patterns_seen
|
|
assert "/api/v1/quant/instruments/{symbol}" in patterns_seen
|
|
assert "tools/list" in patterns_seen
|
|
assert all(ev["isolation_ok"] == 1 for ev in summary_before["recent_audit_events"])
|
|
assert all(ev["traffic_source"] == "internal_test" for ev in summary_before["recent_audit_events"])
|
|
|
|
# Verify logrotate.d file configuration (default 100M = 100MB, compress enabled, rotate >= 12) & no-op when below limit
|
|
import gzip
|
|
|
|
lr_noop = run_logrotate_directive(telemetry_db_path=tel_db)
|
|
assert lr_noop["configured_size_directive"].upper() == "100M"
|
|
assert lr_noop["configured_default_bytes"] == 100 * 1024 * 1024
|
|
assert lr_noop["compress_enabled"] is True
|
|
assert lr_noop["rotate_count"] >= 12
|
|
assert lr_noop["truncated"] is False
|
|
assert get_api_telemetry_summary(tel_db)["total_requests"] == 5
|
|
|
|
# Verify logrotate.d quiescent compression + truncation when DB size >= configured limit
|
|
lr_trunc = run_logrotate_directive(telemetry_db_path=tel_db, max_bytes_override=1024)
|
|
assert lr_trunc["truncated"] is True
|
|
assert lr_trunc["quiescent"] is True
|
|
assert lr_trunc["integrity_check"] == "ok"
|
|
assert lr_trunc["compressed_archive_path"] == f"{tel_db}.1.gz"
|
|
assert lr_trunc["compressed_archive_bytes"] > 0
|
|
assert Path(lr_trunc["compressed_archive_path"]).is_file()
|
|
|
|
# Verify the compressed .1.gz archive preserved all 5 pre-truncation requests & passes SQLite integrity_check
|
|
restored_db = tmp_path / "restored-from-gz.db"
|
|
with gzip.open(lr_trunc["compressed_archive_path"], "rb") as f_gz:
|
|
restored_db.write_bytes(f_gz.read())
|
|
with sqlite3.connect(str(restored_db)) as r_conn:
|
|
assert r_conn.execute("PRAGMA integrity_check;").fetchone()[0] == "ok"
|
|
assert get_api_telemetry_summary(restored_db)["total_requests"] == 5
|
|
|
|
summary_after = get_api_telemetry_summary(tel_db)
|
|
assert summary_after["total_requests"] == 0
|
|
assert summary_after["ringbuffer_count"] == 0
|
|
|
|
# Verify SQLite integrity_check == 'ok' and continued automatic population after quiescent truncation
|
|
with sqlite3.connect(str(tel_db)) as check_conn:
|
|
assert check_conn.execute("PRAGMA integrity_check;").fetchone()[0] == "ok"
|
|
|
|
s_post, _, _ = dispatch_rest_v1(
|
|
"GET",
|
|
"/api/v1/status?surface=quant&donate_from=quant&donate_copy=BTC&export_action=quant_csv&free_text_ignored=secret123",
|
|
traffic_source="external_production",
|
|
)
|
|
assert s_post == 200
|
|
summary_ext = get_api_telemetry_summary(tel_db)
|
|
assert summary_ext["total_requests"] == 1
|
|
assert summary_ext["external_production_requests"] == 1
|
|
assert summary_ext["internal_test_requests"] == 0
|
|
assert summary_ext["market_demand_confidence"] == "No data available"
|
|
assert summary_ext["recent_audit_events"][0]["traffic_source"] == "external_production"
|
|
param_map = {(r["param_category"], r["param_value"]): r["external_requests"] for r in summary_ext["parameter_rollups"]}
|
|
assert param_map.get(("surface", "quant")) == 1
|
|
assert param_map.get(("donate_from", "quant")) == 1
|
|
assert param_map.get(("donate_copy", "BTC")) == 1
|
|
assert param_map.get(("export_action", "quant_csv")) == 1
|
|
assert all(k[0] != "free_text_ignored" for k in param_map)
|
|
|
|
# Verify Strategy 3A (ingest_caddy_route_counts) & Strategy 2C (get_longitudinal_telemetry_summary)
|
|
from hyperstitionstud_io.db.sqlite_meta import (
|
|
get_longitudinal_telemetry_summary,
|
|
ingest_caddy_route_counts,
|
|
)
|
|
|
|
sample_caddy_log = tmp_path / "sample-caddy-access.json"
|
|
sample_caddy_log.write_text(
|
|
'{"status":200,"request":{"uri":"/quant/index.html"}}\n'
|
|
'{"status":200,"request":{"uri":"/zoology/proposal-fund-manager-novel-investment-discovery.pdf"}}\n'
|
|
'{"status":304,"request":{"uri":"/"}}\n',
|
|
encoding="utf-8",
|
|
)
|
|
c_ing = ingest_caddy_route_counts(sample_caddy_log, telemetry_db_path=tel_db)
|
|
assert c_ing["matched_hits"] == 3
|
|
assert sample_caddy_log.read_text(encoding="utf-8") == ""
|
|
|
|
# Also verify second rotation shifts .1.gz -> .2.gz and writes new .1.gz, and Strategy 2C aggregates across generations
|
|
direct_trunc = truncate_telemetry_db_quiescent(tel_db, max_bytes=512, force=False)
|
|
assert direct_trunc["truncated"] is True
|
|
assert direct_trunc["quiescent"] is True
|
|
assert direct_trunc["integrity_check"] == "ok"
|
|
assert Path(f"{tel_db}.1.gz").is_file()
|
|
assert Path(f"{tel_db}.2.gz").is_file()
|
|
|
|
long_sum = get_longitudinal_telemetry_summary(tel_db)
|
|
assert long_sum["generations_count"] >= 2
|
|
assert long_sum["total_requests"] == 6
|
|
assert long_sum["external_production_requests"] == 1
|
|
assert long_sum["internal_test_requests"] == 5
|
|
|
|
# Verify Strategy 1B (compute_corpus_delta_report / --corpus-delta)
|
|
from hyperstitionstud_io.publishing.highlights import compute_corpus_delta_report
|
|
|
|
cdelta = compute_corpus_delta_report()
|
|
assert cdelta["llm_tokens_used"] == 0
|
|
assert "deltas_since_baseline" in cdelta and "dossiers_count" in cdelta["deltas_since_baseline"]
|
|
|
|
# Verify regression guard: read-only / unwritable SQLite path (sqlite3.OperationalError) never causes 502/crash
|
|
os.environ["HYPERSTITION_TELEMETRY_DB_PATH"] = "/sys/hyperstition-readonly-telemetry.db"
|
|
ro_code, _, ro_body = dispatch_rest_v1("GET", "/api/v1/quant/timeseries?symbol=NVDA")
|
|
assert ro_code == 200 and ro_body["ok"] is True
|
|
ro_mcp = dispatch_jsonrpc({"jsonrpc": "2.0", "id": 100, "method": "ping"})
|
|
assert ro_mcp is not None and "result" in ro_mcp
|
|
|
|
# Verify Plan 1: Dark-Mode hs-pdf-build (0 <br/>, 0 LaTeX escapes, 0 missing glyphs, 0 /Helvetica)
|
|
import importlib.util
|
|
from hyperstitionstud_io.publishing.pdf_compiler import (
|
|
_format_inline,
|
|
_split_markdown_table_row,
|
|
compile_markdown_to_pdf,
|
|
discover_web_and_repo_pdf_pairs,
|
|
)
|
|
|
|
web_pdf_pairs = discover_web_and_repo_pdf_pairs()
|
|
assert len(web_pdf_pairs) >= 48
|
|
assert all("archive" not in pdf_p.parts for _, pdf_p in web_pdf_pairs)
|
|
assert all(not ("plans" in pdf_p.parts and "inactive" in pdf_p.parts) for _, pdf_p in web_pdf_pairs)
|
|
assert any("encyclopedia/" in str(pdf_p) for _, pdf_p in web_pdf_pairs[:25])
|
|
|
|
row_cells = _split_markdown_table_row(r"| **3** | Pipes `a|b` & \| | $\mathbb{E}[|\Delta\text{bps}_{i,t}|] \in \{0..4\}$<br/>Line 2 & ⓘ |")
|
|
assert len(row_cells) == 3
|
|
fmt_c2 = _format_inline(row_cells[2])
|
|
assert "<br/>" in fmt_c2 and "<br/>" not in fmt_c2
|
|
assert "\\mathbb" not in fmt_c2 and "\\Delta" not in fmt_c2 and "Δ" in fmt_c2 and "∈" in fmt_c2 and "[i]" in fmt_c2
|
|
|
|
if importlib.util.find_spec("reportlab") is not None and importlib.util.find_spec("pypdf") is not None:
|
|
from pypdf import PdfReader
|
|
|
|
md_test = tmp_path / "torture-test.md"
|
|
pdf_test = tmp_path / "torture-test.pdf"
|
|
md_test.write_text(
|
|
"# Torture Test PDF\n\n"
|
|
"| Col A | Col B |\n| :--- | :--- |\n"
|
|
"| Line 1<br/>Line 2 | $\\mathbb{E}[|\\Delta\\text{bps}_{i,t}|] \\in \\{0..4\\}$ & ⓘ `a|b` |\n",
|
|
encoding="utf-8",
|
|
)
|
|
pdf_res = compile_markdown_to_pdf(md_test, pdf_test, title="Dark-Mode Torture Test")
|
|
assert pdf_res["dark_mode_style"] == "group_3_stealth_basalt"
|
|
from reportlab.lib.fonts import ps2tt
|
|
from hyperstitionstud_io.publishing.fonts import _reportlab_vera_fallback
|
|
|
|
assert ps2tt("DejaVu-Bold") == ("dejavu", 1, 0)
|
|
assert ps2tt("DejaVuMono-Bold") == ("dejavumono", 1, 0)
|
|
assert _reportlab_vera_fallback("DejaVuSans-Bold.ttf") is not None
|
|
r_pdf = PdfReader(str(pdf_test))
|
|
pdf_txt = "\n".join(pg.extract_text() or "" for pg in r_pdf.pages)
|
|
assert "<br/>" not in pdf_txt and "\\mathbb" not in pdf_txt and "\\Delta" not in pdf_txt
|
|
assert "[i]" in pdf_txt
|
|
for pg in r_pdf.pages:
|
|
f_res = (pg.get("/Resources") or {}).get("/Font") or {}
|
|
for f_val in f_res.values():
|
|
base_f = str(f_val.get_object().get("/BaseFont"))
|
|
assert "Helvetica" not in base_f
|
|
|
|
# Verify Plan 2: Bidirectional 14-Point Census & 4-Species Confluence Dose (D in {0..4})
|
|
sol_code, _, sol_body = dispatch_rest_v1("GET", "/api/v1/quant/timeseries?symbol=SOL-USD")
|
|
assert sol_code == 200
|
|
sol_inst = sol_body["data"]["instruments"][0]
|
|
assert sol_inst["symbol_clean"] == "SOL" and sol_inst["symbol_eng_aq"] == 73
|
|
sol_nov19 = next(b for b in sol_inst["bars"] if b["date_utc"] == "2026-11-19")
|
|
assert sol_nov19["close_usd"] == 73.07
|
|
assert any("SYMBOL_SELF_LOCK (73==SOL)" in lk for lk in sol_nov19["scope1_locks"])
|
|
assert sol_nov19["confluence_dose"] >= 3
|
|
|
|
goog_code, _, goog_body = dispatch_rest_v1("GET", "/api/v1/quant/timeseries?symbol=GOOGL")
|
|
goog_nov24 = next(b for b in goog_body["data"]["instruments"][0]["bars"] if b["date_utc"] == "2026-11-24")
|
|
assert goog_nov24["bps_spoken_eng_aq"] == 292 and 292 in goog_nov24["shared_dossier_coordinates"]
|
|
assert goog_nov24["confluence_dose"] == 2
|
|
|
|
# Verify Plan 3: FRED Macroeconomic Indicators (0 synthetic data, native cadence, holiday null)
|
|
mac_code, _, mac_body = dispatch_rest_v1("GET", "/api/v1/tools/hs_inspect_macro_indicators")
|
|
assert mac_code == 200 and mac_body["data"]["synthetic_data_eliminated"] is True
|
|
assert mac_body["data"]["series_count"] == 14
|
|
assert mac_body["data"]["series"]["effr"]["aq_evaluation"]["face_int"] == 388
|
|
assert mac_body["data"]["derived_indicators"]["m1_vs_m2_spread"]["m2_minus_m1_trillions_str"] == "$3.37T"
|
|
|
|
# Verify Plan 4: 5-Agenda Daily Portfolio & Memetic Regime Update (hs-daily-brief)
|
|
brf_code, _, brf_body = dispatch_rest_v1("GET", "/api/v1/tools/hs_generate_daily_portfolio_brief")
|
|
assert brf_code == 200 and brf_body["data"]["synthetic_data_eliminated"] is True
|
|
post_p = brf_body["data"]["agenda_1_executive_summary"]["bayesian_regime_inference"]["posterior_probabilities"]
|
|
assert abs(sum(post_p.values()) - 1.0) < 1e-3
|
|
assert "Q-RUN-" in brf_body["data"]["agenda_5_daily_key_macro_question_and_rigor"]["active_daily_question"]["question_id"]
|
|
|
|
# Verify Plan 5: One-Shot Ticker Stats Card (.png + .json via Chatbot REST & MCP, 0 new REST endpoints)
|
|
from hyperstitionstud_io.quant.cards import export_ticker_stats_card_pair
|
|
|
|
card_ro = export_ticker_stats_card_pair("NVDA", out_dir="/proc/nonexistent-readonly-cards", include_base64_png=True)
|
|
assert card_ro["artifacts"]["persisted_to_disk"] is False
|
|
assert len(card_ro["artifacts"]["png_base64"]) > 1000
|
|
|
|
card_code, _, card_body = dispatch_rest_v1("GET", "/api/v1/tools/hs_generate_ticker_stats_card?symbol=NVDA")
|
|
assert card_code == 200 and card_body["data"]["synthetic_data_eliminated"] is True
|
|
assert card_body["data"]["visual_style"] == "group_3_stealth_basalt_plate_and_micro_pip"
|
|
png_p = Path(card_body["data"]["artifacts"]["png_file_path"])
|
|
assert png_p.is_file() and png_p.read_bytes()[:8] == b"\x89PNG\r\n\x1a\n"
|
|
|
|
pkx_card_code, _, pkx_card_body = dispatch_rest_v1("GET", "/api/v1/zoology/pokedex/ANTHR-PVT?include_card=true")
|
|
assert pkx_card_code == 200
|
|
anthr_card = pkx_card_body["data"]["stats_card"]
|
|
assert anthr_card["sports_card_box_score"]["data_available"] is False
|
|
assert anthr_card["sports_card_box_score"]["close_usd"] is None
|
|
|
|
# Confirm 0 new bespoke /api/v1/cards/* routes were added to rest.py
|
|
no_bespoke_code, _, _ = dispatch_rest_v1("GET", "/api/v1/cards/NVDA")
|
|
assert no_bespoke_code == 404
|
|
|
|
# Verify Plan 6: Group 3 Unified Stylesheet & Retained 999px Donate Pill
|
|
cfg_test = load_workspace_config()
|
|
g3_css = (cfg_test.core_dir / "site" / "assets" / "hs-group3-basalt-chamfer.css").read_text(encoding="utf-8")
|
|
assert ".btn-donate-pill" in g3_css and "border-radius: 999px !important;" in g3_css
|
|
assert ".tactile-donate-btn" in g3_css
|
|
|
|
# Produce & verify the Periodic Harvest -> CI/CD -> VPS Infrastructure Flow Diagram PNG
|
|
from hyperstitionstud_io.publishing.flow_diagram import render_periodic_harvest_cicd_flow_diagram_png
|
|
|
|
flow_res = render_periodic_harvest_cicd_flow_diagram_png()
|
|
flow_png_p = Path(flow_res["png_path"])
|
|
assert flow_png_p == (cfg_test.knowledge_graph_dir / "docs" / "periodic-harvest-cicd-to-vps-flow-diagram.png").resolve()
|
|
assert flow_png_p.is_file() and flow_png_p.read_bytes()[:8] == b"\x89PNG\r\n\x1a\n"
|
|
assert flow_res["dimensions"] == [1800, 1280] and flow_res["breach_count"] == 0
|
|
|
|
# Verify Archive Rotator (Gematria-Pipeline Immunity, Richness Parity, .md-only 1x bundle, require_companion_md=True, --archive-inactive & Git citation fallback)
|
|
from hyperstitionstud_io.publishing.archive_rotator import (
|
|
INACTIVE_BUNDLE_FILENAME,
|
|
INACTIVE_MANIFEST_FILENAME,
|
|
assert_not_gematria_pipeline_source,
|
|
audit_and_fix_multi_compressed_files,
|
|
extract_archive_member,
|
|
extract_inactive_plan_member,
|
|
rotate_docs_archive_directory,
|
|
snapshot_gematria_pipeline_richness,
|
|
verify_gematria_pipeline_richness_invariant,
|
|
)
|
|
|
|
for protected_p in (
|
|
cfg_test.archive_dir / "00-index-and-methodology.md",
|
|
cfg_test.zoology_dir / "taxonomy" / "glossary-registry.json",
|
|
cfg_test.paths["gematria_js_dir"] / "db.txt",
|
|
):
|
|
try:
|
|
assert_not_gematria_pipeline_source(protected_p)
|
|
raise AssertionError(f"Expected ValueError for protected path {protected_p}")
|
|
except ValueError:
|
|
pass
|
|
|
|
# Verify docs/plans/inactive/ is allowed by Gematria-Pipeline Immunity
|
|
assert_not_gematria_pipeline_source(cfg_test.knowledge_graph_dir / "docs" / "plans" / "inactive")
|
|
|
|
rich_snap = snapshot_gematria_pipeline_richness()
|
|
assert verify_gematria_pipeline_richness_invariant(rich_snap, rich_snap) is True
|
|
|
|
arc_test_dir = tmp_path / "test_arc"
|
|
arc_test_dir.mkdir(parents=True, exist_ok=True)
|
|
(arc_test_dir / "README.md").write_text("# Index\n", encoding="utf-8")
|
|
(arc_test_dir / "PLAN-SAMPLE.md").write_text("# Sample\n", encoding="utf-8")
|
|
(arc_test_dir / "PLAN-SAMPLE.pdf").write_bytes(b"%PDF-1.4 sample")
|
|
(arc_test_dir / "STANDALONE-NO-MD.pdf").write_bytes(b"%PDF-1.4 standalone")
|
|
rot_res = rotate_docs_archive_directory(arc_test_dir, require_companion_md=True, check_allowed_dir=False)
|
|
assert rot_res["member_count"] == 1
|
|
assert rot_res["preserved_standalone_pdfs"] == ["STANDALONE-NO-MD.pdf"]
|
|
assert (arc_test_dir / "STANDALONE-NO-MD.pdf").is_file()
|
|
assert not (arc_test_dir / "PLAN-SAMPLE.pdf").exists()
|
|
sample_man = json.loads((arc_test_dir / "archive-manifest.json").read_text(encoding="utf-8"))
|
|
assert sample_man["manifest_dag_json_cid"].startswith("baguqeera")
|
|
assert sample_man["members"][0]["name"] == "PLAN-SAMPLE.md"
|
|
assert sample_man["members"][0]["companion_pdf_sha256"] == hashlib.sha256(b"%PDF-1.4 sample").hexdigest()
|
|
|
|
# Verify live completed-plans-archive.tar.gz is <= 256 KB (262,144 bytes), .md-only, and long_term_git_storage_citations work
|
|
kg_arc_dir = cfg_test.knowledge_graph_dir / "docs" / "archive"
|
|
kg_tgz = kg_arc_dir / "completed-plans-archive.tar.gz"
|
|
kg_man = json.loads((kg_arc_dir / "archive-manifest.json").read_text(encoding="utf-8"))
|
|
assert kg_tgz.stat().st_size <= 262_144, f"Expected completed-plans-archive.tar.gz <= 256 KB, got {kg_tgz.stat().st_size}"
|
|
assert kg_man["manifest_dag_json_cid"].startswith("baguqeera")
|
|
assert kg_man["long_term_git_rotated_count"] >= 1
|
|
assert all(m["git_citation_url"].startswith("https://git.libre.audio/seasharp/") for m in kg_man["members"])
|
|
assert all(lt["git_citation_url"].startswith("https://git.libre.audio/seasharp/") for lt in kg_man["long_term_git_storage_citations"])
|
|
|
|
# Verify extract_archive_member works for both active bundle members and long-term Git-rotated members
|
|
ext_out = tmp_path / "ext_check"
|
|
active_m_name = kg_man["members"][0]["name"]
|
|
lt_m_name = kg_man["long_term_git_storage_citations"][0]["name"]
|
|
p_act = extract_archive_member(kg_arc_dir, active_m_name, ext_out)
|
|
p_lt = extract_archive_member(kg_arc_dir, lt_m_name, ext_out)
|
|
assert p_act.is_file() and hashlib.sha256(p_act.read_bytes()).hexdigest() == kg_man["members"][0]["sha256"]
|
|
assert p_lt.is_file() and hashlib.sha256(p_lt.read_bytes()).hexdigest() == kg_man["long_term_git_storage_citations"][0]["sha256"]
|
|
|
|
# Verify inactive-plans-archive.tar.gz & inactive-archive-manifest.json
|
|
inact_dir = cfg_test.knowledge_graph_dir / "docs" / "plans" / "inactive"
|
|
inact_tgz = inact_dir / INACTIVE_BUNDLE_FILENAME
|
|
inact_man = json.loads((inact_dir / INACTIVE_MANIFEST_FILENAME).read_text(encoding="utf-8"))
|
|
assert inact_tgz.is_file() and inact_tgz.stat().st_size <= 262_144
|
|
assert inact_man["manifest_dag_json_cid"].startswith("baguqeera")
|
|
assert inact_man["member_count"] >= 6
|
|
p_inact = extract_inactive_plan_member(inact_man["members"][0]["plan_id"], out_dir=ext_out)
|
|
assert p_inact.is_file() and hashlib.sha256(p_inact.read_bytes()).hexdigest() == inact_man["members"][0]["sha256"]
|
|
|
|
# Verify Single-Layer (1x) Compression Invariant across all 6 repositories
|
|
comp_check = audit_and_fix_multi_compressed_files(workspace_root=cfg_test.workspace_root, fix=False)
|
|
assert comp_check["ok"] is True, f"Multi-compression violation detected: {comp_check}"
|
|
assert not comp_check["nested_archive_violations"]
|
|
assert not comp_check["peeled_gzip_files"]
|
|
assert not comp_check["removed_double_sidecars"]
|
|
caddy_txt = (cfg_test.core_dir / "deploy" / "Caddyfile").read_text(encoding="utf-8")
|
|
assert "@compressible not path *.gz *.br *.tgz" in caddy_txt and "encode @compressible zstd gzip" in caddy_txt
|
|
|
|
# Verify VPS Data Production incremental cache merge & static script/timer invariants
|
|
from hyperstitionstud_io.quant.collector import update_real_market_history_cache
|
|
|
|
tmp_hist = tmp_path / "test-real-history.json"
|
|
upd_h = update_real_market_history_cache(
|
|
history_path=tmp_hist,
|
|
new_bars_by_symbol={"NVDA": {"2026-12-01": {"close_usd": 152.10, "change_bps": 107}}},
|
|
allow_live_network=False,
|
|
)
|
|
assert upd_h["appended_bars_count"] == 1
|
|
parsed_h = json.loads(tmp_hist.read_text(encoding="utf-8"))
|
|
assert parsed_h["instruments"]["ANTHR-PVT"]["data_available"] is False
|
|
assert parsed_h["instruments"]["NVDA"]["bars_by_date"]["2026-12-01"]["close_usd"] == 152.10
|
|
|
|
vps_prod_sh = cfg_test.core_dir / "deploy" / "run-vps-data-production.sh"
|
|
assert vps_prod_sh.is_file() and "/dev/null" not in vps_prod_sh.read_text(encoding="utf-8")
|
|
for u_name in (
|
|
"hyperstition-closing-bell-harvest.service",
|
|
"hyperstition-closing-bell-harvest.timer",
|
|
"hyperstition-utc-rollover-harvest.service",
|
|
"hyperstition-utc-rollover-harvest.timer",
|
|
):
|
|
assert (cfg_test.core_dir / "deploy" / u_name).is_file()
|
|
|
|
# Verify /engineering/ (hs-eng-docs) & /math/ (hs-math-docs) Piecewise & Non-Sequential Revertability
|
|
from hyperstitionstud_io.publishing.engineering_docs import build_engineering_site
|
|
from hyperstitionstud_io.publishing.math_docs import build_math_site
|
|
|
|
eng_sub_res = build_engineering_site(
|
|
out_dir=tmp_path / "eng_subset",
|
|
enabled_subpages=("ciphers-and-phonetics", "mcp-chatbot-rest-and-ipld"),
|
|
)
|
|
assert eng_sub_res["enabled_subpages"] == ["ciphers-and-phonetics", "mcp-chatbot-rest-and-ipld"]
|
|
assert (tmp_path / "eng_subset" / "ciphers-and-phonetics" / "index.html").is_file()
|
|
assert not (tmp_path / "eng_subset" / "quant-macro-and-bayesian-brief").exists()
|
|
assert "hs-prereq-ladder" in (tmp_path / "eng_subset" / "index.html").read_text(encoding="utf-8")
|
|
|
|
math_sub_res = build_math_site(
|
|
out_dir=tmp_path / "math_subset",
|
|
enabled_subpages=("base36-algebra-and-primes", "timeseries-moments-and-confluence-dose"),
|
|
)
|
|
assert math_sub_res["enabled_subpages"] == ["base36-algebra-and-primes", "timeseries-moments-and-confluence-dose"]
|
|
math_man = json.loads((tmp_path / "math_subset" / "math-manifest.json").read_text(encoding="utf-8"))
|
|
assert math_man["algebraic_invariants"]["eti_weights_sum"] == 1.0
|
|
assert abs(math_man["algebraic_invariants"]["bayesian_posterior_simplex_sum"] - 1.0) < 1e-3
|
|
assert math_man["algebraic_invariants"]["cluster_292_gen0_variance"] > 300.0
|
|
assert math_man["algebraic_invariants"]["cluster_292_gen1_variance"] == 0.0
|
|
assert math_man["algebraic_invariants"]["g4_isometric_fixed_point_count"] == 21
|
|
|
|
# Verify PLAN-PROGRAMMATIC-VERSION-BUMP-HEURISTICS-ZERO-TOKEN (0 LLM tokens)
|
|
from hyperstitionstud_io.version_sync import (
|
|
compute_programmatic_version_bump,
|
|
evaluate_change_scope_heuristics,
|
|
)
|
|
|
|
r_noop = evaluate_change_scope_heuristics(
|
|
{"current_version": "2.0.30", "total_dirty_files": 0, "total_commits_ahead": 0}
|
|
)
|
|
assert r_noop["recommended_bump_level"] == "noop"
|
|
assert r_noop["next_version"] == "2.0.30"
|
|
assert r_noop["llm_tokens_used"] == 0
|
|
|
|
r_patch = evaluate_change_scope_heuristics(
|
|
{"current_version": "2.0.30", "total_dirty_files": 2, "total_commits_ahead": 0}
|
|
)
|
|
assert r_patch["recommended_bump_level"] == "patch"
|
|
assert r_patch["next_version"] == "2.0.31"
|
|
|
|
r_minor = evaluate_change_scope_heuristics(
|
|
{
|
|
"current_version": "2.0.30",
|
|
"total_dirty_files": 1,
|
|
"newly_archived_plans": ["PLAN-SAMPLE-FEATURE"],
|
|
}
|
|
)
|
|
assert r_minor["recommended_bump_level"] == "minor"
|
|
assert r_minor["next_version"] == "2.1.0"
|
|
|
|
r_major = evaluate_change_scope_heuristics(
|
|
{
|
|
"current_version": "2.0.30",
|
|
"total_dirty_files": 1,
|
|
"removed_cli_scripts": ["hs-doctor"],
|
|
}
|
|
)
|
|
assert r_major["recommended_bump_level"] == "major"
|
|
assert r_major["next_version"] == "3.0.0"
|
|
|
|
live_bump = compute_programmatic_version_bump()
|
|
assert live_bump["llm_tokens_used"] == 0
|
|
assert live_bump["recommended_bump_level"] in ("noop", "patch", "minor", "major")
|
|
|
|
# Verify PLAN-CRONJOB-ARCHIVE-ROTATION-ON-HYPERSTITIONSTUD-IO scripts & cron/systemd units
|
|
vps_rot_sh = cfg.core_dir / "deploy" / "run-vps-archive-rotation.sh"
|
|
cron_rot = cfg.core_dir / "deploy" / "cron.d" / "hyperstition-archive-rotate"
|
|
timer_rot = cfg.core_dir / "deploy" / "hyperstition-archive-rotate.timer"
|
|
svc_rot = cfg.core_dir / "deploy" / "hyperstition-archive-rotate.service"
|
|
for p_rot in (vps_rot_sh, cron_rot, timer_rot, svc_rot):
|
|
assert p_rot.is_file(), f"Missing {p_rot}"
|
|
assert "/dev/null" not in p_rot.read_text(encoding="utf-8")
|
|
assert "unset OPENROUTER_API_KEY OPENAI_API_KEY ANTHROPIC_API_KEY" in vps_rot_sh.read_text(encoding="utf-8")
|
|
assert "20 0 * * * root" in cron_rot.read_text(encoding="utf-8")
|
|
assert "OnCalendar=*-*-* 00:20:00 UTC" in timer_rot.read_text(encoding="utf-8")
|
|
|
|
# Verify PLAN-HOMEPAGE-ENGINEERING-AND-MATH-NAVIGATION-WIRING
|
|
home_html = (cfg.core_dir / "site" / "index.html").read_text(encoding="utf-8")
|
|
assert 'data-route="eng-hub"' in home_html and 'href="/engineering/index.html"' in home_html
|
|
assert 'data-route="math-hub"' in home_html and 'href="/math/index.html"' in home_html
|
|
assert '"./engineering/index.html"' in home_html and '"./math/index.html"' in home_html
|
|
|
|
# Verify PLAN-GUILE-SCHEME-PEDAGOGICAL-TOGGLE-AND-IN-BROWSER-REPL
|
|
guile_scm_p = cfg.core_dir / "src" / "hyperstitionstud_io" / "publishing" / "guile_prelude.scm"
|
|
guile_js_p = cfg.core_dir / "site" / "assets" / "hs-guile-scheme-repl.js"
|
|
assert guile_scm_p.is_file() and "(define Z" in guile_scm_p.read_text(encoding="utf-8")
|
|
assert guile_js_p.is_file() and "hs:guile-scheme-mode:v1" in guile_js_p.read_text(encoding="utf-8")
|
|
|
|
eng_no_guile = build_engineering_site(out_dir=tmp_path / "eng_no_guile", include_guile_lens=False)
|
|
assert eng_no_guile["guile_scheme_lens_enabled"] is False
|
|
assert "hs-guile-cartridge" not in (tmp_path / "eng_no_guile" / "index.html").read_text(encoding="utf-8")
|
|
|
|
import subprocess
|
|
|
|
node_guile_test = subprocess.run(
|
|
[
|
|
"node",
|
|
"-e",
|
|
f"const R = require({json.dumps(str(guile_js_p))});"
|
|
"const s = R.createSession();"
|
|
"if (s.evaluate('(aq-base36 \"LEMUR\")').formatted !== '114') process.exit(1);"
|
|
"if (s.evaluate('(prime-factors 666)').formatted !== '(2 3 3 37)') process.exit(2);"
|
|
"if (s.evaluate('(+ 1/5 9/50 9/50 4/25 7/50 7/50)').formatted !== '1') process.exit(3);"
|
|
"if (s.evaluate('(variance-pop *cluster-292-gen0*)').formatted !== '4634/9') process.exit(4);"
|
|
"if (s.evaluate('(variance-pop *cluster-292-gen1*)').formatted !== '0') process.exit(5);"
|
|
"if (Math.abs(s.evaluate('((derivative (lambda (x) (* x x x)) 1e-5) 2.0)').floatValue - 12.0) > 1e-3) process.exit(6);"
|
|
"if (Math.abs(s.evaluate('(adaptive-simpson (lambda (x) (* x x)) 0.0 3.0 1e-6)').floatValue - 9.0) > 1e-4) process.exit(7);"
|
|
"if (s.evaluate(\"(bayes-update '(1/3 1/3 1/3) '(1/10 3/10 6/10))\").formatted !== '(1/10 3/10 3/5)') process.exit(8);"
|
|
"if (s.evaluatePolyglot('aqBase36(\"LEMUR\")', 'ts').formatted !== '114') process.exit(9);"
|
|
"if (s.evaluatePolyglot('aq_base36(\"LEMUR\")', 'rust').formatted !== '114') process.exit(10);"
|
|
"if (s.evaluatePolyglot('primeFactors(666)', 'ts').formatted !== '[2,3,3,37]') process.exit(11);"
|
|
"if (s.evaluatePolyglot('prime_factors(666_u64)', 'rust').formatted !== 'vec![2, 3, 3, 37]') process.exit(12);"
|
|
"if (s.evaluatePolyglot('(aq-base36 \"LEMUR\")', 'rust').formatted !== '114') process.exit(13);"
|
|
"if (s.evaluatePolyglot('let x: i64 = aq_base36(\"LEMUR\") + 23; x * 2', 'rust').formatted !== '274') process.exit(14);"
|
|
"if (s.evaluatePolyglot('const x: number = aqBase36(\"LEMUR\") + 23; x * 2', 'ts').formatted !== '274') process.exit(15);"
|
|
"if (s.evaluatePolyglot('(1..=5_i64).map(|x| x * x).sum::<i64>()', 'rust').formatted !== '55') process.exit(16);",
|
|
],
|
|
capture_output=True,
|
|
text=True,
|
|
check=False,
|
|
)
|
|
assert node_guile_test.returncode == 0, f"Node Polyglot REPL check failed ({node_guile_test.returncode}): {node_guile_test.stderr}"
|
|
|
|
# Verify 4-Ring Sandbox Security & Resource Quota Guards (polyglot_sandbox.py)
|
|
from hyperstitionstud_io.publishing.polyglot_sandbox import (
|
|
SandboxResourceError,
|
|
SandboxSecurityError,
|
|
evaluate_polyglot_sandbox,
|
|
)
|
|
|
|
for bad_expr, bad_lang in (
|
|
('({}).constructor.constructor("return process")()', "ts"),
|
|
("globalThis.fetch('https://example.com')", "ts"),
|
|
('(system "id")', "guile"),
|
|
('std::process::Command::new("sh")', "rust"),
|
|
):
|
|
blocked = False
|
|
try:
|
|
evaluate_polyglot_sandbox(bad_expr, lang=bad_lang)
|
|
except SandboxSecurityError:
|
|
blocked = True
|
|
assert blocked, f"Failed to block escape attempt {bad_expr!r} in {bad_lang}"
|
|
|
|
for inf_expr, inf_lang in (
|
|
("((Z (lambda (r) (lambda (x) (r (+ x 1))))) 0)", "guile"),
|
|
("Array.from({length: 1000000}, (_, i): number => i + 1).reduce((a, b) => a + b, 0)", "ts"),
|
|
("(1..=1000000_i64).fold(0_i64, |acc, x| acc + x)", "rust"),
|
|
):
|
|
halted = False
|
|
try:
|
|
evaluate_polyglot_sandbox(inf_expr, lang=inf_lang, max_steps=2000)
|
|
except SandboxResourceError:
|
|
halted = True
|
|
assert halted, f"Failed to halt resource exhaustion {inf_expr!r} in {inf_lang}"
|
|
|
|
# Verify 5-state #hsPolyglotModeSelector on /engineering/ and /math/
|
|
eng_idx_txt = (cfg.core_dir / "site" / "engineering" / "index.html").read_text(encoding="utf-8")
|
|
math_idx_txt = (cfg.core_dir / "site" / "math" / "index.html").read_text(encoding="utf-8")
|
|
for m_mode in ('data-lens-mode="off"', 'data-lens-mode="guile"', 'data-lens-mode="ts"', 'data-lens-mode="rust"', 'data-lens-mode="all"'):
|
|
assert m_mode in eng_idx_txt and m_mode in math_idx_txt
|
|
|
|
# Verify PLAN-REMOVE-D-FILTER-DISCUSSION-FROM-ENGINEERING-AND-MATH-HUBS:
|
|
# 0 decagram/d-filter mentions in /engineering/* and /math/*, while preserving geometric/calculus/statistical d/D
|
|
forbidden_d_filter_re = re.compile(r"(?i)(assert_zero_d_filter|zero-d-filter|d-filter|d_filter|d-list|d_list|10-letter|decagram|nuoagmhysl)")
|
|
for hub_dir in (cfg.core_dir / "site" / "engineering", cfg.core_dir / "site" / "math"):
|
|
for f_p in hub_dir.rglob("*"):
|
|
if f_p.is_file() and f_p.suffix in (".html", ".json", ".js"):
|
|
f_txt = f_p.read_text(encoding="utf-8")
|
|
m_bad = forbidden_d_filter_re.search(f_txt)
|
|
assert m_bad is None, f"Forbidden decagram/d-filter discussion {m_bad.group(0)!r} found in {f_p}"
|
|
math_m4_txt = (cfg.core_dir / "site" / "math" / "timeseries-moments-and-confluence-dose" / "index.html").read_text(encoding="utf-8")
|
|
assert "d/dx" in math_m4_txt and "D_{i,t}" in math_m4_txt
|
|
|
|
# Verify PLAN-ADHOC-MESSENGER-HIGHLIGHTS-SUMMARY-FOR-ENGINEERS-AND-MATH (0 Web UI exposure, untracked output)
|
|
hl_code, _, hl_body = dispatch_rest_v1("GET", "/api/v1/tools/hs_generate_highlights_summary")
|
|
assert hl_code == 200
|
|
hl_data = hl_body["data"]
|
|
assert hl_data["paragraph_count"] == 2
|
|
assert 200 <= hl_data["char_count"] <= 1100
|
|
assert hl_data["web_ui_exposed"] is False
|
|
assert "<div" not in hl_data["messenger_text"] and "\\mathbb" not in hl_data["messenger_text"]
|
|
assert "https://hyperstitionstud.io/engineering/" in hl_data["messenger_text"]
|
|
assert "https://hyperstitionstud.io/math/" in hl_data["messenger_text"]
|
|
assert "/untracked/recent-highlights/" in hl_data["untracked_artifacts"]["txt_path"]
|
|
|
|
# Verify PLAN-COMPREHENSIVE-MCP-AND-CHATBOT-REST-API-CAPABILITY-EXPOSURE
|
|
em_code, _, em_body = dispatch_rest_v1("GET", "/api/v1/tools/hs_inspect_engineering_and_math_docs?unit_filter=M2")
|
|
assert em_code == 200 and "engineering" in em_body["data"] and "math" in em_body["data"]
|
|
|
|
dm_code, _, dm_body = dispatch_rest_v1(
|
|
"GET",
|
|
"/api/v1/tools/hs_inspect_documentation_and_manuals?doc_id=PLAN-HS-PDF-BUILD-DARK-MODE-AND-GLYPH-SANITIZATION&include_full_markdown=true",
|
|
)
|
|
assert dm_code == 200 and dm_body["data"]["archived_plans_count"] >= 1
|
|
assert "STEALTH BASALT" in dm_body["data"]["archived_plans"][0]["markdown"] or "ReportLab" in dm_body["data"]["archived_plans"][0]["markdown"]
|
|
|
|
gs_code, _, gs_body = dispatch_rest_v1("GET", "/api/v1/tools/hs_evaluate_guile_scheme_z_calculus?lang=rust&expression=aq_base36(%22LEMUR%22)")
|
|
assert gs_code == 200 and gs_body["data"]["formatted"] == "114"
|
|
|
|
cat_st_code, _, cat_st_body = dispatch_rest_v1("GET", "/api/v1/tools/hs_query_workspace_catalog_and_release_state?fts_query=lemur®istry=all&aq_int=137&symbol=NVDA")
|
|
assert cat_st_code == 200 and "version_bump_heuristics" in cat_st_body["data"]
|
|
assert "registry_manifests" in cat_st_body["data"] and len(cat_st_body["data"]["registry_manifests"]) >= 1
|
|
assert "coordinate_join" in cat_st_body["data"] and cat_st_body["data"]["coordinate_join"]["coordinate_aq"] == 137
|
|
assert "timeseries_bars" in cat_st_body["data"]
|
|
|
|
# Verify HTTP ETag & If-None-Match (304 Not Modified) from PLAN-SQLITE-META-REST-ENDPOINTS-ETAG-AND-VPS-SYNC
|
|
from hyperstitionstud_io.mcp.rest import compute_response_etag, matches_if_none_match
|
|
|
|
st_etag = compute_response_etag(st_body)
|
|
assert st_etag.startswith('"') and st_etag.endswith('"')
|
|
assert matches_if_none_match(st_etag, st_etag) is True
|
|
assert matches_if_none_match(f"W/{st_etag}", st_etag) is True
|
|
nm_code, _, nm_body = dispatch_rest_v1("GET", "/api/v1/status", if_none_match=st_etag)
|
|
assert nm_code == 304 and nm_body == ""
|
|
|
|
res_eng_code, _, res_eng_body = dispatch_rest_v1("GET", "/api/v1/resources/engineering-manifest")
|
|
assert res_eng_code == 200 and res_eng_body["data"]["$id"] == "urn:io:hyperstitionstud:engineering-manifest"
|
|
|
|
# Verify PLAN-SUBTLE-CYBERNETIC-MATRIX-CODE-RAIN-BACKGROUND & PLAN-CYBERNETIC-AND-OCCULT-MICRO-SIGIL-UI-ACCENTS
|
|
matrix_woff2_p = cfg.core_dir / "site" / "assets" / "matrix-font.woff2"
|
|
coderain_js_p = cfg.core_dir / "site" / "assets" / "hs-matrix-coderain.js"
|
|
assert matrix_woff2_p.is_file() and matrix_woff2_p.stat().st_size > 4000
|
|
assert coderain_js_p.is_file()
|
|
assert "@font-face" in g3_css and "matrix-font.woff2" in g3_css
|
|
assert ".hs-sigil-seal" in g3_css and ".hs-plate-g3.plate-lock-gold::after" in g3_css
|
|
for surf_p in (
|
|
cfg.core_dir / "site" / "index.html",
|
|
cfg.core_dir / "site" / "learn" / "index.html",
|
|
cfg.core_dir / "site" / "quant" / "index.html",
|
|
cfg.core_dir / "site" / "donate" / "index.html",
|
|
cfg.core_dir / "site" / "engineering" / "index.html",
|
|
cfg.core_dir / "site" / "math" / "index.html",
|
|
):
|
|
surf_txt = surf_p.read_text(encoding="utf-8")
|
|
assert "hs-matrix-coderain.js?v=" in surf_txt, f"Missing hs-matrix-coderain.js in {surf_p}"
|
|
assert "hs-sigil-seal" in surf_txt, f"Missing hs-sigil-seal in {surf_p}"
|
|
assert "hs-sigil-colophon" in surf_txt, f"Missing hs-sigil-colophon in {surf_p}"
|
|
|
|
node_rain_test = subprocess.run(
|
|
[
|
|
"node",
|
|
"-e",
|
|
f"const CR = require({json.dumps(str(coderain_js_p))});"
|
|
"if (CR.MATRIX_CHARS.length !== 66) process.exit(1);"
|
|
"if (CR.SIGIL_GLINTS.length < 8) process.exit(2);"
|
|
"const sub = CR.PROFILES.subtle;"
|
|
"if (sub.frameIntervalMs !== 80 || sub.colPitchPx !== 24 || sub.canvasOpacity !== 0.45) process.exit(3);"
|
|
"const aCenter = CR.computeColumnAlpha(500, 1000, sub, false);"
|
|
"const aOuter = CR.computeColumnAlpha(50, 1000, sub, false);"
|
|
"if (!(aCenter < aOuter && aCenter <= 0.09 && aOuter >= 0.20)) process.exit(4);",
|
|
],
|
|
capture_output=True,
|
|
text=True,
|
|
check=False,
|
|
)
|
|
assert node_rain_test.returncode == 0, f"Node CodeRain check failed ({node_rain_test.returncode}): {node_rain_test.stderr}"
|
|
|
|
# Verify PLAN-AUTOMATED-PER-COMMIT-REPO-ROOT-README-SYNCHRONIZATION-FOR-GITEA
|
|
# and PLAN-README-AND-GIT-COMMIT-MESSAGE-VERSION-PARITY-FIX
|
|
from hyperstitionstud_io import __version__ as cur_v_str
|
|
from hyperstitionstud_io.publishing.readme_sync import (
|
|
install_git_pre_commit_hooks,
|
|
sync_all_repo_readmes,
|
|
)
|
|
|
|
rm_chk = sync_all_repo_readmes(ws_root=cfg.workspace_root, check_only=True)
|
|
assert rm_chk["all_in_sync"] is True and len(rm_chk["checked_readmes"]) == 6, f"README drift: {rm_chk}"
|
|
for rm_rel in rm_chk["checked_readmes"]:
|
|
rm_p = cfg.workspace_root / Path(rm_rel).relative_to("/workspace")
|
|
rm_txt = rm_p.read_text(encoding="utf-8")
|
|
assert re.search(r"(?<![A-Za-z])EADME\.md", rm_txt) is None, f"Truncated EADME.md found in {rm_p}"
|
|
found_v = set(re.findall(r"\bv(\d+\.\d+\.\d+)\b", rm_txt))
|
|
assert found_v == {cur_v_str}, f"Mixed versions {found_v} in {rm_p} (expected only {cur_v_str})"
|
|
|
|
hk_chk = install_git_pre_commit_hooks(ws_root=cfg.workspace_root, check_only=True)
|
|
assert hk_chk["ok"] is True and len(hk_chk["installed_hooks"]) == 12, f"Missing git hooks: {hk_chk}"
|
|
|
|
# Verify PLAN-HOMEPAGE-LAYOUT-GIT-VELOCITY-PRIORITIZATION-AND-DECLUTTER (Proposal A / Option 2)
|
|
home_txt = (cfg.core_dir / "site" / "index.html").read_text(encoding="utf-8")
|
|
for forbidden_home in ("388 Graph Nodes", "1,282 Typed Edges", "24 Quant Tickers", "stat-row", "-manifest.json"):
|
|
assert forbidden_home not in home_txt, f"Forbidden static marker {forbidden_home!r} found on homepage"
|
|
for q_img in (
|
|
"assets/closeups/quadrant-1-cybermemetics-calc-graph.png",
|
|
"assets/closeups/quadrant-1-tab-2-graph.png",
|
|
"assets/closeups/quadrant-2-esoteric-finance-quant.png",
|
|
"assets/closeups/quadrant-2-tab-2-bayesian-fred.png",
|
|
"assets/closeups/quadrant-2-tab-3-leaderboard-card.png",
|
|
"assets/closeups/quadrant-3-info-science-novice-learn-polyglot.png",
|
|
"assets/closeups/quadrant-3-tab-2-math-guile.png",
|
|
"assets/closeups/quadrant-3-tab-3-math-ts-rust.png",
|
|
"assets/closeups/quadrant-4-operators-deployment-vps.png",
|
|
"assets/closeups/quadrant-4-tab-2-mcp-etag.png",
|
|
"assets/closeups/quadrant-4-tab-3-ci-gates.png",
|
|
):
|
|
assert q_img in home_txt, f"Missing quadrant closeup {q_img} on homepage"
|
|
assert (cfg.core_dir / "site" / q_img).is_file()
|
|
# Verify hs-closeups-sync automatic UI element fingerprint & closeup parity
|
|
from hyperstitionstud_io.publishing.closeups_sync import render_all_quadrant_closeups
|
|
|
|
cu_chk = render_all_quadrant_closeups(workspace_root=cfg.workspace_root, check_only=True)
|
|
if not cu_chk["ok"]:
|
|
cu_sync = render_all_quadrant_closeups(workspace_root=cfg.workspace_root, force=False, check_only=False)
|
|
assert cu_sync["ok"] is True
|
|
cu_chk = render_all_quadrant_closeups(workspace_root=cfg.workspace_root, check_only=True)
|
|
assert cu_chk["ok"] is True and not cu_chk["missing_pngs"], f"Closeup UI drift: {cu_chk}"
|
|
assert home_txt.count('class="closeup-tab-btn"') == 11, "Expected 11 interactive .closeup-tab-btn tabs across the 4 quadrants"
|
|
assert home_txt.count('class="closeup-tab-btn"') <= 12, "Strategy 6A: Homepage must never exceed 3 chamfered tabs per quadrant (12 total)"
|
|
hdr_match = re.search(r"<header>.*?</header>", home_txt, flags=re.S)
|
|
assert hdr_match is not None and len(re.findall(r"<a\b", hdr_match.group(0))) <= 7, "Strategy 6A: Homepage header must not exceed 7 links (6 tools + DONATE)"
|
|
assert "below-closeup-bar" not in home_txt, "Expected strictly one set of interactive chamfered tabs (above closeup, 0 below)"
|
|
home_hrefs = re.findall(r'<a[^>]+href="([^"]+)"', home_txt)
|
|
assert len(home_hrefs) == len(set(home_hrefs)), f"Duplicate href links on homepage: {home_hrefs}"
|
|
quant_html_txt = (cfg.core_dir / "site" / "quant" / "index.html").read_text(encoding="utf-8")
|
|
assert "24 Watchlist Instruments" in quant_html_txt
|
|
for q_ctrl in ('id="timeWindowPills"', 'id="tickerQuickFilter"', 'id="heatmapPaginationBar"', 'id="wireTapeFilterInput"'):
|
|
assert q_ctrl in quant_html_txt, f"Missing Strategy 1A/2A control {q_ctrl} in site/quant/index.html"
|
|
kg_html_txt = (cfg.knowledge_graph_dir / "index.html").read_text(encoding="utf-8")
|
|
assert 'value="syzygy"' in kg_html_txt and 'id="minDegreeFilter"' in kg_html_txt
|
|
assert 'id="filterBookmarkInput"' in (cfg.core_dir / "site" / "learn" / "index.html").read_text(encoding="utf-8")
|
|
assert 'id="engCliFilterInput"' in (cfg.core_dir / "site" / "engineering" / "index.html").read_text(encoding="utf-8")
|
|
assert 'screen") === "dose-d3"' in (cfg.core_dir / "site" / "quant" / "quant-app.js").read_text(encoding="utf-8")
|
|
assert 'uParams.get("repl") === "trace"' in (cfg.core_dir / "site" / "assets" / "hs-guile-scheme-repl.js").read_text(encoding="utf-8")
|
|
assert 'id="live-smoke-probe"' in (cfg.core_dir / "site" / "engineering" / "mcp-chatbot-rest-and-ipld" / "index.html").read_text(encoding="utf-8")
|
|
|
|
# Verify Plan #53 (Strategies 1A, 2B, 3A, 4A, 5A, 6A, 7A): security.py, load_json_cached(), font lru_cache
|
|
from hyperstitionstud_io.config import load_json_cached
|
|
from hyperstitionstud_io.publishing.closeups_sync import _extract_js_ui_signature
|
|
from hyperstitionstud_io.publishing.fonts import load_pillow_font
|
|
from hyperstitionstud_io.security import SecurityBoundaryError, validate_safe_url
|
|
|
|
assert load_pillow_font("DejaVuSansMono.ttf", 12) is load_pillow_font("DejaVuSansMono.ttf", 12)
|
|
assert validate_safe_url("https://fred.stlouisfed.org/graph/fredgraph.csv") == "https://fred.stlouisfed.org/graph/fredgraph.csv"
|
|
assert validate_safe_url("http://127.0.0.1:18090/status", allow_http_localhost=True) == "http://127.0.0.1:18090/status"
|
|
for bad_url in ("file:///etc/passwd", "http://169.254.169.254/latest/meta-data/", "http://example.com/test"):
|
|
blocked_u = False
|
|
try:
|
|
validate_safe_url(bad_url, allow_http_localhost=False)
|
|
except SecurityBoundaryError:
|
|
blocked_u = True
|
|
assert blocked_u, f"Expected SecurityBoundaryError for {bad_url}"
|
|
|
|
tmp_json_f = tmp_path / "cached-test.json"
|
|
tmp_json_f.write_text('{"k": 1}', encoding="utf-8")
|
|
assert load_json_cached(tmp_json_f)["k"] == 1
|
|
tmp_json_f.write_text('{"k": 22}', encoding="utf-8")
|
|
assert load_json_cached(tmp_json_f)["k"] == 22
|
|
|
|
# Verify Plan #51 (Strategies 1B, 2A, 3A, 4A): /quant/ guided tour voice narration, #lensSelect UI indicator & JS closeup introspection
|
|
assert 'id="tutUiElementIndicator"' in quant_html_txt
|
|
quant_tut_js_p = cfg.core_dir / "site" / "quant" / "quant-tutorials.js"
|
|
quant_tut_txt = quant_tut_js_p.read_text(encoding="utf-8")
|
|
js_sig_1 = _extract_js_ui_signature(quant_tut_txt)
|
|
js_sig_2 = _extract_js_ui_signature(quant_tut_txt + '\n// document.getElementById("syntheticTestMutatedId")')
|
|
assert js_sig_1["js_ui_sha256"] != js_sig_2["js_ui_sha256"], "Mutating JS DOM control must change js_ui_sha256 fingerprint"
|
|
assert js_sig_1["has_lens_select_highlight"] is True and js_sig_1["speech_text_count"] == 25
|
|
|
|
node_quant_tut_test = subprocess.run(
|
|
[
|
|
"node",
|
|
"-e",
|
|
f"const QT = require({json.dumps(str(quant_tut_js_p))});"
|
|
"if (QT.episodes.length !== 5) process.exit(1);"
|
|
"let totalScenes = 0;"
|
|
"QT.episodes.forEach((ep) => {"
|
|
" ep.keyframes.forEach((kf) => {"
|
|
" totalScenes++;"
|
|
" if (!Array.isArray(kf.uiTargets) || kf.uiTargets.length === 0) process.exit(2);"
|
|
" if (!kf.uiElementLabel || !kf.speechText) process.exit(3);"
|
|
" });"
|
|
"});"
|
|
"if (totalScenes !== 25) process.exit(4);"
|
|
"const ep04 = QT.episodes[3];"
|
|
"if (!ep04.keyframes.every((kf) => kf.uiTargets.includes('lensSelect') && kf.uiTargets.includes('lensProjectionCard'))) process.exit(5);",
|
|
],
|
|
capture_output=True,
|
|
text=True,
|
|
check=False,
|
|
)
|
|
assert node_quant_tut_test.returncode == 0, f"Node QuantTutorials check failed ({node_quant_tut_test.returncode}): {node_quant_tut_test.stderr}"
|
|
|
|
# Verify Plan #57 (Strategies 1A, 2A, 3A): Zero-Git-Audio deploy-time WAV voice compiler (quant_voice.py) & 0 audio files in Git
|
|
from hyperstitionstud_io.publishing.quant_voice import build_quant_tour_voice_assets
|
|
|
|
tmp_voice_dir = tmp_path / "quant_audio"
|
|
v_res = build_quant_tour_voice_assets(out_dir=tmp_voice_dir, workspace_root=cfg.workspace_root)
|
|
assert v_res["ok"] is True and v_res["clip_count"] == 25
|
|
assert (tmp_voice_dir / "ep01-s1.wav").is_file() and (tmp_voice_dir / "ep01-s1.wav").read_bytes()[:4] == b"RIFF"
|
|
assert (tmp_voice_dir / "ep04-s1.wav").is_file() and (tmp_voice_dir / "voice-manifest.json").is_file()
|
|
git_gitignore = (cfg.core_dir / ".gitignore").read_text(encoding="utf-8")
|
|
assert "site/quant/audio/" in git_gitignore, "site/quant/audio/ must be in .gitignore so 0 audio files enter Git"
|
|
assert "__hsActiveUtterance" in quant_tut_txt and "playDeployTimeWavOrFormant" in quant_tut_txt
|
|
|
|
# Verify Plan #56: Fedora 41 OpenRouter Exegesis Synthesizer, Pre-Solved 333/666/777 Equation Engine & Push Worker
|
|
import importlib.util
|
|
|
|
synth_script_p = cfg.archive_dir / "ingglish-aq-archive" / "scripts" / "synthesize_news_dossier_openrouter.py"
|
|
assert synth_script_p.is_file()
|
|
spec_s = importlib.util.spec_from_file_location("synthesize_news_dossier_openrouter", synth_script_p)
|
|
assert spec_s is not None and spec_s.loader is not None
|
|
mod_s = importlib.util.module_from_spec(spec_s)
|
|
spec_s.loader.exec_module(mod_s)
|
|
sample_harvest = {
|
|
"temporal_metadata": {"target_date_utc": "2026-12-01"},
|
|
"counts": {"total_headlines": 2, "cross_story_collision_classes": 1, "isometric_locks": 1},
|
|
"headlines": [
|
|
{"headline": "Nvidia unveils next-generation Blackwell wafer cluster", "eng_aq": 812, "ing_aq": 834},
|
|
{"headline": "Spanish election coalition talks continue in Madrid", "eng_aq": 745, "ing_aq": 761},
|
|
],
|
|
"entities": [
|
|
{"eng": "Nvidia", "ing": "envideea", "eng_aq": 115, "ing_aq": 137, "story": "Silicon Wire"},
|
|
{"eng": "Spanish", "ing": "spanish", "eng_aq": 149, "ing_aq": 149, "story": "Europe Wire"},
|
|
],
|
|
"isometric_locks": [{"eng": "Spanish", "ing": "spanish", "eng_aq": 149, "ing_aq": 149}],
|
|
"cross_story_collisions": {},
|
|
}
|
|
solved_30 = mod_s.solve_cluster_equations_333_666_777(sample_harvest)
|
|
assert len(solved_30["eq_333"]) == 10 and len(solved_30["eq_666"]) == 10 and len(solved_30["eq_777"]) == 10
|
|
tmp_arc_d = tmp_path / "test_exegesis_arc"
|
|
tmp_arc_d.mkdir(parents=True, exist_ok=True)
|
|
(tmp_arc_d / "00-index-and-methodology.md").write_text("# Index\n\n### Category D:\n", encoding="utf-8")
|
|
tmp_harv_f = tmp_path / "sample-harvest.json"
|
|
tmp_harv_f.write_text(json.dumps(sample_harvest), encoding="utf-8")
|
|
syn_out = mod_s.synthesize_news_dossier(
|
|
harvest_path=tmp_harv_f,
|
|
archive_dir=tmp_arc_d,
|
|
api_key="",
|
|
allow_deterministic_fallback=True,
|
|
)
|
|
assert syn_out["ok"] is True and syn_out["equations_verified_count"] == 30 and syn_out["aq_mismatches"] == 0
|
|
assert Path(syn_out["dossier_path"]).is_file()
|
|
for pkg_f in (
|
|
cfg.archive_dir / "packaging" / "build-fedora41-rpm.sh",
|
|
cfg.archive_dir / "packaging" / "bundle" / "scripts" / "run_exegesis_and_push_fedora41.sh",
|
|
cfg.archive_dir / "packaging" / "rpm" / "ingglish-isopsephic-exegesis.spec",
|
|
cfg.archive_dir / "packaging" / "rpm" / "ingglish-exegesis.sysconfig",
|
|
):
|
|
assert pkg_f.is_file(), f"Missing Fedora 41 packaging file {pkg_f}"
|
|
assert "/dev/null" not in pkg_f.read_text(encoding="utf-8")
|
|
|
|
# Verify Plan #58: Pre-Commit Preparation & Gates D1-D8 for push-all-to-git-libre-audio.sh & deploy/sync-vps-repos.sh
|
|
from hyperstitionstud_io.ci.deploy_scripts_sync import prepare_and_verify_deploy_scripts
|
|
|
|
dep_sync = prepare_and_verify_deploy_scripts(workspace_root=cfg.workspace_root, check_only=False)
|
|
assert dep_sync["ok"] is True, f"Deploy scripts sync failed: {dep_sync}"
|
|
assert all(dep_sync["gates"].values()), f"Deploy scripts gates failed: {dep_sync['gates']}"
|
|
dep_chk = prepare_and_verify_deploy_scripts(workspace_root=cfg.workspace_root, check_only=True)
|
|
assert dep_chk["ok"] is True, f"Deploy scripts check_only failed: {dep_chk}"
|
|
assert (cfg.core_dir / "deploy" / "push-all-to-git-libre-audio.sh").read_text(encoding="utf-8") == (
|
|
cfg.workspace_root / "push-all-to-git-libre-audio.sh"
|
|
).read_text(encoding="utf-8")
|
|
|
|
# Verify Plan #60: /calc/ (haiperdohpjematreeah) Homepage Group 3 UI Parity, Zero "Cypher Calculator" & hyperdope-ci-build Patch Integration
|
|
calc_dir = cfg.paths["gematria_js_dir"]
|
|
calc_html = (calc_dir / "index.html").read_text(encoding="utf-8")
|
|
assert "<title>haiperdohpjematreeah</title>" in calc_html
|
|
assert 'id="hsCalcHeader"' in calc_html and 'class="btn-donate-pill"' in calc_html
|
|
assert "hs-group3-basalt-chamfer.css" in calc_html
|
|
for chk_p in (
|
|
calc_dir / "index.html",
|
|
calc_dir / "config.default.js",
|
|
calc_dir / "manifest.json",
|
|
calc_dir / "docs" / "ONBOARDING-INGGLISH-AQ.md",
|
|
(cfg.paths.get("ci_repo_dir") or (cfg.workspace_root / "hyperdope-ci-build")) / "config.default.js",
|
|
):
|
|
if chk_p.is_file():
|
|
assert re.search(r"(?i)cypher\s*calculator", chk_p.read_text(encoding="utf-8")) is None, f"Forbidden Cypher Calculator branding in {chk_p}"
|
|
ci_dir = cfg.paths.get("ci_repo_dir") or (cfg.workspace_root / "hyperdope-ci-build")
|
|
assert (ci_dir / "integrate-upstream-and-ui.sh").is_file()
|
|
assert (ci_dir / "patches" / "0001-feat-calc-ingglish-priority-toggle.patch").is_file()
|
|
assert (ci_dir / "patches" / "0002-feat-ui-group3-homepage-parity-and-haiperdohpjematreeah-branding.patch").is_file()
|
|
|
|
# Verify Plan #59 (Strategies 1A, 2A, 3A): normalize_speech_prosody(), master_wav_broadcast_warmth(), and WebAudio BiquadFilterNode EQ
|
|
from hyperstitionstud_io.publishing.quant_voice import normalize_speech_prosody
|
|
|
|
norm_p = normalize_speech_prosody("Inspecting NVDA and ASML with CIDv1 and 81 bps.")
|
|
assert "Nvidia" in norm_p and "A S M L" in norm_p and "C I D version 1" in norm_p and "basis points" in norm_p
|
|
assert "createBiquadFilter" in (cfg.core_dir / "site" / "quant" / "quant-tutorials.js").read_text(encoding="utf-8")
|
|
|
|
# Verify Plan #61: Homepage UI Quadrant Closeup Bounding-Box Containment & Geometry Audit (Invariants B1-B3)
|
|
closeups_man_p = cfg.core_dir / "site" / "assets" / "closeups" / "ui-elements-manifest.json"
|
|
assert closeups_man_p.is_file()
|
|
closeups_man_obj = json.loads(closeups_man_p.read_text(encoding="utf-8"))
|
|
geom_audit = closeups_man_obj.get("geometry_audit") or {}
|
|
assert geom_audit.get("all_clean") is True, f"Closeup geometry audit not clean: {geom_audit}"
|
|
assert geom_audit.get("breach_count") == 0
|
|
assert geom_audit.get("border_crossing_count") == 0
|
|
assert geom_audit.get("text_overlap_count") == 0
|
|
|
|
# Verify Plan #63 & Plan #65: Homepage Navigation Immutability + Intra-Page & Cross-Page UI Style/Font/Background Parity (Gates S1-S3)
|
|
from hyperstitionstud_io.ci.public_regression import verify_ui_style_and_navigation_consistency
|
|
|
|
style_audit = verify_ui_style_and_navigation_consistency(workspace_root=cfg.workspace_root)
|
|
assert style_audit["ok"] is True, f"UI style and navigation consistency audit failed: {style_audit}"
|
|
assert all(style_audit["gates"].values()), f"Style gates failed: {style_audit['gates']}"
|
|
|
|
# Verify PLAN-INTROSPECTIVE-PROTECT-SYSTEM-STRICT-EROFS-TEST-HARNESS
|
|
from hyperstitionstud_io.ci.erofs_harness import run_introspective_erofs_suite
|
|
|
|
erofs_res = run_introspective_erofs_suite()
|
|
assert erofs_res["verified"] is True
|
|
assert erofs_res["mcp_tools_swept"] >= 15
|
|
|
|
# Write cached internal test baseline (.cache/internal-test-baseline-latest.json) for hs-public-smoke
|
|
from hyperstitionstud_io.ci.public_regression import write_internal_test_baseline_cache
|
|
|
|
base_cache_p = write_internal_test_baseline_cache(erofs_audit_receipt=erofs_res)
|
|
assert base_cache_p.is_file()
|
|
finally:
|
|
if prev_tel_env is None:
|
|
os.environ.pop("HYPERSTITION_TELEMETRY_DB_PATH", None)
|
|
else:
|
|
os.environ["HYPERSTITION_TELEMETRY_DB_PATH"] = prev_tel_env
|
|
|
|
|
|
if __name__ == "__main__":
|
|
test_offline_urn_namespaces_and_no_external_https_fonts()
|
|
print("[PASS] test_offline_urn_namespaces_and_no_external_https_fonts")
|
|
test_ciphers_and_bilingual_ledger_parity()
|
|
print("[PASS] test_ciphers_and_bilingual_ledger_parity")
|
|
test_offline_phonetics_fallback_zero_workdir()
|
|
print("[PASS] test_offline_phonetics_fallback_zero_workdir")
|
|
test_read_only_isolation_guard()
|
|
print("[PASS] test_read_only_isolation_guard")
|
|
test_local_config_citation_resolution_and_proposals()
|
|
print("[PASS] test_local_config_citation_resolution_and_proposals")
|
|
test_doctor_all_checks_pass()
|
|
print("[PASS] test_doctor_all_checks_pass")
|
|
test_ipld_quant_and_mcp_server()
|
|
print("[PASS] test_ipld_quant_and_mcp_server")
|
|
print("ALL 7 TEST SUITES PASSED.")
|