feat(provider): runnable affect-server entrypoint + ratatoskr-provider script

Stand-up glue for the live affect negotiation smoke vs Worldtree v0.35.2.

- ratatoskr.provider.serve: build_app_from_env (tested env->app seam) + main
  (uvicorn shell). Config from env: RATATOSKR_HEIMDALL_KEY (required),
  RATATOSKR_AFFECT_DB, RATATOSKR_CONSUMER_ID, RATATOSKR_PROVIDER_HOST/PORT.
- console-script ratatoskr-provider = ratatoskr.provider.serve:main.
- Heimdall key utf-8-encoded into HS256 key_bytes; revisit if Worldtree signs
  with base64/raw bytes (confirm format at wire-up).
This commit is contained in:
vh
2026-06-14 16:28:29 -07:00
parent d90a58dc48
commit bcdcd71090
4 changed files with 68 additions and 4 deletions
+23
View File
@@ -0,0 +1,23 @@
"""Tests for the affect-provider serve entrypoint (ratatoskr.provider.serve).
Only the env -> app seam is unit-tested; uvicorn.run is the untestable shell.
"""
from __future__ import annotations
import pytest
from ratatoskr.provider.serve import build_app_from_env
def test_build_app_from_env_requires_heimdall_key():
with pytest.raises(RuntimeError):
build_app_from_env({"RATATOSKR_AFFECT_DB": ":memory:"})
def test_build_app_from_env_builds_app_with_routes():
app = build_app_from_env(
{"RATATOSKR_HEIMDALL_KEY": "shared-secret", "RATATOSKR_AFFECT_DB": ":memory:"}
)
paths = {getattr(r, "path", None) for r in app.routes}
assert "/bifrost/handshake" in paths
assert "/bifrost/affect-call" in paths