Skip to content

Commit decd7e4

Browse files
mattj-monadclaude
andcommitted
test(conformance): drive the Python router in live mode
Parameterizes the Python conformance server from env, matching TS/Go. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_011ASKA2VrufrNLGGrcFjY7n
1 parent 03c7a8f commit decd7e4

1 file changed

Lines changed: 18 additions & 6 deletions

File tree

conformance/servers/py_server.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
"""Boot the Python router for conformance testing, pointed at the mock Monad."""
1+
"""Boot the Python router for conformance testing.
2+
3+
Default (mock) mode points at the in-memory mock via ``MONAD_API_BASE``; live
4+
mode sets the same knobs to real Monad staging values. Every value falls back to
5+
the mock fixture default, so nothing changes for the existing hermetic run.
6+
"""
27

38
import os
49

@@ -7,16 +12,23 @@
712

813
from monad_embed import EmbedConfig, Provision, embed_router
914

15+
# A provisioned id may be intentionally empty (a live tenant with no store) →
16+
# treat "" as "not provisioned" so the router falls back to a dev/null sink.
17+
_store = os.environ.get("MONAD_STORE_ID", "out_store") or None
18+
_source = os.environ.get("MONAD_SOURCE_ID", "in_source") or None
19+
# Empty allow-list → expose the whole catalog (None), never the empty set.
20+
_allow = [s.strip() for s in os.environ.get("MONAD_CATALOG_ALLOW", "aws-cloudtrail,okta-systemlog").split(",") if s.strip()] or None
21+
1022
app = FastAPI()
1123
app.include_router(
1224
embed_router(
1325
EmbedConfig(
14-
api_key="conf-key",
26+
api_key=os.environ.get("MONAD_API_KEY", "conf-key"),
1527
api_base=os.environ["MONAD_API_BASE"],
16-
frame_origin="https://app.monad.com/embed",
17-
get_customer_org_id=lambda req: "org_conf",
18-
get_provisioned_components=lambda org: Provision(destination_output_id="out_store", source_input_id="in_source"),
19-
catalog_allow=["aws-cloudtrail", "okta-systemlog"],
28+
frame_origin=os.environ.get("MONAD_FRAME_ORIGIN", "https://app.monad.com/embed"),
29+
get_customer_org_id=lambda req: os.environ.get("MONAD_ORG_ID", "org_conf"),
30+
get_provisioned_components=lambda org: Provision(destination_output_id=_store, source_input_id=_source),
31+
catalog_allow=_allow,
2032
)
2133
),
2234
prefix="/embed",

0 commit comments

Comments
 (0)