From 5dc2a74fa7223f2d1e33af04946858b8b737f018 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 14 Jun 2026 16:57:48 +0100 Subject: [PATCH] Advertise Python simulation observer role --- packages/cultcache-py/PARITY.md | 5 ++++- packages/cultcache-py/src/cultmesh_py/daemon.py | 6 ++++-- packages/cultcache-py/tests/test_cultcache.py | 7 +++++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/packages/cultcache-py/PARITY.md b/packages/cultcache-py/PARITY.md index 375ad0b7..8342243b 100644 --- a/packages/cultcache-py/PARITY.md +++ b/packages/cultcache-py/PARITY.md @@ -122,7 +122,10 @@ CultCache, CultNet, and CultMesh. It is evidence, not confetti. instead of silently looking empty. Simulation observation serving is opt-in: the daemon only advertises `cultnet.simulation_observation.v0` when an observation hub is attached, and an opt-in launched daemon answers witness - observations with schema-v0 consensus candidates. + observations with schema-v0 consensus candidates. When such a daemon + self-advertises into a Verse, its peer card includes the `simulation-observer` + role so discovery clients can find the peer by the capability it actually + serves. The daemon CLI snapshot document/byte limits feed the same public server edge; oversized daemon snapshot responses are returned as structured `cultnet.error.v0` peer errors rather than partial payloads. diff --git a/packages/cultcache-py/src/cultmesh_py/daemon.py b/packages/cultcache-py/src/cultmesh_py/daemon.py index 121fd25d..39bf8019 100644 --- a/packages/cultcache-py/src/cultmesh_py/daemon.py +++ b/packages/cultcache-py/src/cultmesh_py/daemon.py @@ -124,7 +124,9 @@ def advertise_self( return endpoint = f"cultnet://{server.host}:{server.port}" shard_ids = tuple(server.node.database.shard_ids()) - roles = tuple(args.roles or ("read-replica",)) + roles = list(args.roles or ("read-replica",)) + if server.observation_hub is not None and "simulation-observer" not in roles: + roles.append("simulation-observer") verse_catalog.upsert(CultMeshVerseDescriptor( verse_id=verse_id, display_name=args.verse_display_name or verse_id, @@ -140,7 +142,7 @@ def advertise_self( peer_id=server.node.runtime_id, verse_id=verse_id, endpoints=(endpoint,), - roles=roles, + roles=tuple(roles), shard_ids=shard_ids, )) diff --git a/packages/cultcache-py/tests/test_cultcache.py b/packages/cultcache-py/tests/test_cultcache.py index 19d051f7..398498b8 100644 --- a/packages/cultcache-py/tests/test_cultcache.py +++ b/packages/cultcache-py/tests/test_cultcache.py @@ -3606,6 +3606,8 @@ class CultCacheTests(unittest.TestCase): "2", "--simulation-quorum-ratio", "1.0", + "--verse-id", + "simulation-verse", "--ready-file", str(ready_path), ], @@ -3624,6 +3626,11 @@ class CultCacheTests(unittest.TestCase): expected_schema_version="cultnet.hello.v0", ) self.assertEqual(ready["supportedMessageVersions"], hello_response["supportedMessageVersions"]) + discovery_client = CultMesh.create_verse_discovery_client("127.0.0.1", int(ready["port"]), timeout_seconds=2.0) + peers = discovery_client.fetch_peers(verse_id="simulation-verse", roles=["simulation-observer"]) + self.assertEqual(peers[0].peer_id, "simulation-daemon-peer") + self.assertIn("simulation-observer", peers[0].roles) + self.assertIn("read-replica", peers[0].roles) claim_hash = compute_simulation_claim_hash("hit", "alice", "bob", "frame:100") first = client.request(