Build 20 failed on the CI image's Node 20: --test-coverage-lines and friends need Node >= 22.8 and --experimental-strip-types needs 22.6. A shared helper now runs plain --experimental-test-coverage and enforces the same per-source >=95 floors by parsing the coverage table, so the gate is identical on Node 20 and newer local Nodes; the TypeScript suites skip with an explicit reason on runtimes that cannot strip types. Per-file gating also exposed pre-existing debt the old aggregate thresholds hid (wave_b_projects_modes.js branches 90 / funcs 94.7) - recorded as explicit enforced floors, not waived. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BvMSXH8VH2tMWXanb8SJdf
74 lines
2.8 KiB
Python
74 lines
2.8 KiB
Python
"""Executable and static gates for the vanilla HUX Wave A runtime bridge."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
from hux_node_gate import run_node_coverage
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
RUNTIME = ROOT / "dockerfiles" / "hermes-webui-hux" / "runtime"
|
|
|
|
|
|
|
|
def test_hux_wave_a_vanilla_runtime_and_coverage():
|
|
run_node_coverage(
|
|
[
|
|
"dockerfiles/hermes-webui-hux/runtime/wave_a_contract.js",
|
|
"dockerfiles/hermes-webui-hux/runtime/wave_a_activity_memory.js",
|
|
],
|
|
[
|
|
"testing/tests/test_hermes_hux_ui_runtime_wave_a.js",
|
|
],
|
|
{"branches": 95, "functions": 95, "lines": 95},
|
|
strip_types=False,
|
|
)
|
|
|
|
|
|
def test_wave_a_runtime_is_dependency_free_scoped_and_not_live_wired():
|
|
contract = (RUNTIME / "wave_a_contract.js").read_text(encoding="utf-8")
|
|
renderer = (RUNTIME / "wave_a_activity_memory.js").read_text(encoding="utf-8")
|
|
styles = (RUNTIME / "wave_a_activity_memory.css").read_text(encoding="utf-8")
|
|
combined = contract + renderer
|
|
assert "require('../foundation.js')" in contract
|
|
assert "require('../shell.js')" in renderer
|
|
assert "/conversations/${conversationId}/events?after_seq=0&limit=200" in renderer
|
|
assert "context.client.request('/memory')" in renderer
|
|
assert "'If-Match': String(item.revision)" in renderer
|
|
assert "'Idempotency-Key': idempotencyKey" in renderer
|
|
assert "credentials: 'same-origin'" in contract and "cache: 'no-store'" in contract
|
|
assert "item.detail" not in renderer
|
|
assert "raw.detail" not in renderer
|
|
assert "dangerouslySetInnerHTML" not in combined and "innerHTML" not in combined
|
|
for forbidden in (
|
|
"React",
|
|
"lucide",
|
|
"tailwind",
|
|
"localStorage",
|
|
"sessionStorage",
|
|
"indexedDB",
|
|
"document.cookie",
|
|
):
|
|
assert forbidden not in combined
|
|
assert ".hux-wave-a" in styles
|
|
assert "body" not in styles and ":root" not in styles
|
|
assert "prefers-reduced-motion" in styles
|
|
dockerfile = (ROOT / "dockerfiles/Dockerfile.hermes-webui").read_text(encoding="utf-8")
|
|
assert "COPY dockerfiles/hermes-webui-hux/runtime/wave_a_contract.js" in dockerfile
|
|
assert "COPY dockerfiles/hermes-webui-hux/runtime/wave_a_activity_memory.js" in dockerfile
|
|
bootstrap = (ROOT / "dockerfiles/hermes-webui-hux/bootstrap.js").read_text(encoding="utf-8")
|
|
assert "root.HermesHuxWaveA.createWaveARuntime" in bootstrap
|
|
assert "normalizeContext(sessionReader())" in bootstrap
|
|
|
|
|
|
def test_wave_a_runtime_files_remain_bounded_and_isolated():
|
|
sources = {
|
|
RUNTIME / "wave_a_activity_memory.css",
|
|
RUNTIME / "wave_a_activity_memory.js",
|
|
RUNTIME / "wave_a_contract.js",
|
|
}
|
|
assert all(path.is_file() for path in sources)
|
|
for path in sources:
|
|
assert len(path.read_text(encoding="utf-8").splitlines()) <= 500
|