Release v2.0.25: Dark-mode hs-pdf-build, bidirectional 14-point census & Dose 0..3+, FRED macro indicators, 5-agenda Bayesian daily brief, one-shot .png+.json chatbot stats cards, Group 3 unified style, and minimal /donate/ reduction

This commit is contained in:
Hermes Agent committed 2026-11-30 21:47:08 +00:00
1 parent 74ef8b60a6
commit d91d36ca5e
35 files changed
+14332 -2898

No files matched your search

+101 -1
View File
@@ -214,7 +214,7 @@ def test_ipld_quant_and_mcp_server() -> None:
assert init_resp and init_resp["result"]["serverInfo"]["name"] == "hyperstitionstudio-mcp"
t_list = dispatch_jsonrpc({"jsonrpc": "2.0", "id": 2, "method": "tools/list"})
assert t_list and len(t_list["result"]["tools"]) == 12
assert t_list and len(t_list["result"]["tools"]) == 15
t_call = dispatch_jsonrpc({
"jsonrpc": "2.0",
@@ -350,6 +350,30 @@ def test_ipld_quant_and_mcp_server() -> None:
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():
@@ -529,6 +553,82 @@ def test_ipld_quant_and_mcp_server() -> None:
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)
from pypdf import PdfReader
from hyperstitionstud_io.publishing.pdf_compiler import compile_markdown_to_pdf
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"
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)
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
finally:
if prev_tel_env is None:
os.environ.pop("HYPERSTITION_TELEMETRY_DB_PATH", None)