Release v2.3.0: Eliminate container host paths, add 4-Ring hardened Guile/TS/Rust polyglot lens & 5-state selector, add hs-highlights (untracked output), and expose all 20 MCP/Chatbot REST tools & 14 URN resources
This commit is contained in:
1 parent
b465312e3d
commit
0f64b38725
49 files changed
+2067
-523
No files matched your search
+116
-3
@@ -83,6 +83,43 @@ def test_offline_urn_namespaces_and_no_external_https_fonts() -> None:
|
||||
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")]
|
||||
for fn in files:
|
||||
fp = Path(root_s) / fn
|
||||
if fp.suffix in (".png", ".mp3", ".db", ".gz", ".br", ".ttf", ".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",
|
||||
):
|
||||
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()
|
||||
@@ -213,8 +250,10 @@ def test_ipld_quant_and_mcp_server() -> None:
|
||||
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"]) == 15
|
||||
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",
|
||||
@@ -839,13 +878,87 @@ def test_ipld_quant_and_mcp_server() -> None:
|
||||
"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.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);",
|
||||
],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
check=False,
|
||||
)
|
||||
assert node_guile_test.returncode == 0, f"Node Guile REPL check failed: {node_guile_test.stderr}"
|
||||
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-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")
|
||||
assert cat_st_code == 200 and "version_bump_heuristics" in cat_st_body["data"]
|
||||
|
||||
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-INTROSPECTIVE-PROTECT-SYSTEM-STRICT-EROFS-TEST-HARNESS
|
||||
from hyperstitionstud_io.ci.erofs_harness import run_introspective_erofs_suite
|
||||
|
||||
Reference in new issue
Block a user