atlas-iac/testing/tests/test_hermes_hux_ui_foundation.py
jenkins b66c762f5d hermes(webui): add HUX card UI models with contract-locked suites
Standalone per-card browser model/security/view modules for HUX-01..10
plus node+pytest suites that read the hux.v1 contract schemas directly.
Reconciled drift found on integration: the activity model now accepts
all 32 hux.event.v1 kinds (delegation.*, memory.suppressed,
memory.retrieval_removed, budget.exhausted, side_effect.*), the
autonomy model carries the external_side_effect capability, and the
foundation boundary test now asserts the shipped static HUX surface
exists on disk and that images never bake activated HUX_FLAGS.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BvMSXH8VH2tMWXanb8SJdf
2026-08-24 04:12:03 -03:00

69 lines
2.3 KiB
Python

"""Execute the dependency-free HUX browser foundation contract tests."""
from __future__ import annotations
import subprocess
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
NODE_TEST = ROOT / "testing/tests/test_hermes_hux_ui_foundation_node.js"
HUX_UI = ROOT / "dockerfiles/hermes-webui-hux"
def test_hux_ui_foundation_node_contracts():
"""The browser modules pass their functional and isolation checks."""
result = subprocess.run(
["node", "--test", str(NODE_TEST)],
cwd=ROOT,
capture_output=True,
check=False,
text=True,
)
assert result.returncode == 0, result.stdout + result.stderr
assert "fail 0" in result.stdout
def test_hux_ui_foundation_is_inert_and_bounded():
"""The foundation stays separate from the active image patch surface."""
production = sorted(path for path in HUX_UI.iterdir() if path.suffix in {".js", ".css"})
assert {path.name for path in production} == {
"bootstrap.css",
"bootstrap.js",
"foundation.css",
"foundation.js",
"shell.js",
}
for path in production:
assert len(path.read_text(encoding="utf-8").splitlines()) < 500
dockerfile = (ROOT / "dockerfiles/Dockerfile.hermes-webui").read_text(encoding="utf-8")
# The WebUI image ships the HUX browser surface, but only from sources that
# exist in this tree, and it never bakes activated HUX flags into the image:
# the single HUX_FLAGS occurrence is the empty-flag build-time router check.
copies = [
line.split()[1]
for line in dockerfile.splitlines()
if line.startswith("COPY dockerfiles/hermes-webui-hux")
]
assert copies
for source in copies:
assert (ROOT / source).is_file(), source
assert dockerfile.count("HUX_FLAGS") == 1
assert '"HUX_FLAGS": ""' in dockerfile
def test_hux_ui_foundation_never_persists_or_renders_raw_payloads():
"""Static guardrails forbid browser storage and raw-record display paths."""
source = (HUX_UI / "foundation.js").read_text(encoding="utf-8")
assert "localStorage" not in source
assert "sessionStorage" not in source
assert "innerHTML" not in source
assert "record.detail" not in source
assert "item.uri" not in source
assert "item.hash" not in source
assert "credentials: 'same-origin'" in source