Seed Python daemon shard logs

This commit is contained in:
Meta Vens 2026-06-14 15:44:21 +01:00
commit ed5774d7b4
4 changed files with 25 additions and 4 deletions

View file

@ -102,7 +102,8 @@ CultCache, CultNet, and CultMesh. It is evidence, not confetti.
body and emits a bounded readiness document for process supervisors while the
served CultNet endpoint remains the capability owner. The daemon can register
and seed the package interop-note document so launched processes advertise a
real payload schema and serve a real snapshot over the same CultNet lane.
real payload schema and serve both a real snapshot and a real shard-log entry
over the same CultNet lane.
- Python CultMesh authority leases:
Lease objects own validity and peer/role/shard coverage checks; the catalog
owns sorted listing, lookup, upsert, signature verification policy, and

View file

@ -315,14 +315,15 @@ The same local server can be launched as a package daemon when another runtime
or operator process needs a CultNet endpoint without embedding Python glue:
```powershell
python -m cultmesh_py.daemon --runtime-id python-runtime --display-name "Python Runtime" --host 127.0.0.1 --port 3075 --cache-file mesh.cc --enable-durable-shard-logs --seed-interop-note --ready-file mesh.ready.json
python -m cultmesh_py.daemon --runtime-id python-runtime --display-name "Python Runtime" --host 127.0.0.1 --port 3075 --cache-file mesh.cc --enable-durable-shard-logs --seed-interop-note --seed-shard-id interop --ready-file mesh.ready.json
```
The ready file and stdout line are process readiness hints. The served state and
capability truth still live on the framed CultNet/CultMesh endpoint. Use
`--register-interop-note` to expose the package interop-note schema without
seeding a note, or `--seed-interop-note` to register it and publish one local
record for wire probes.
record for wire probes. Seeded records are committed through the raw mutation
path, so peers can read them through both snapshot and shard-log catch-up.
```python

View file

@ -30,6 +30,8 @@ def main(argv: list[str] | None = None) -> int:
parser.add_argument("--ready-file")
parser.add_argument("--register-interop-note", action="store_true")
parser.add_argument("--seed-interop-note", action="store_true")
parser.add_argument("--seed-shard-id", default="interop")
parser.add_argument("--seed-shard-epoch", type=int, default=1)
args = parser.parse_args(argv)
stop = threading.Event()
@ -57,7 +59,7 @@ def start_server(args: argparse.Namespace) -> CultMeshLocalServer:
if args.cache_file:
node.database.pull()
if args.seed_interop_note:
node.database.put(
node.database.put_raw_message(
interop_note_document,
f"note:{args.runtime_id}",
{
@ -68,6 +70,9 @@ def start_server(args: argparse.Namespace) -> CultMeshLocalServer:
"body": "The Python CultMesh daemon is serving typed state over CultNet.",
"tags": [args.runtime_id, "python", "cultmesh", "daemon"],
},
message_id=f"daemon-seed:{args.runtime_id}",
shard_id=args.seed_shard_id,
shard_epoch=args.seed_shard_epoch,
)
return CultMesh.serve_node(
node,

View file

@ -3044,6 +3044,8 @@ class CultCacheTests(unittest.TestCase):
"--ready-file",
str(ready_path),
"--seed-interop-note",
"--seed-shard-id",
"daemon-interop",
],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
@ -3086,6 +3088,18 @@ class CultCacheTests(unittest.TestCase):
note = interop_note_document.decode_payload(snapshot_response.documents[0].payload)
self.assertEqual(note["authorRuntimeId"], "daemon-test-peer")
self.assertIn("daemon", note["tags"])
shard_catalog = client.fetch_shard_catalog(schema_ids=["cultcache.interop-note"])
self.assertEqual(shard_catalog["shards"][0]["shardId"], "daemon-interop")
self.assertEqual(shard_catalog["shards"][0]["schemaIds"], ["cultcache.interop-note"])
shard_log = client.fetch_shard_log_response(shard_id="daemon-interop", shard_epoch=1)
self.assertFalse(shard_log.resync_required)
self.assertEqual(shard_log.entries[0].sequence, 1)
self.assertEqual(shard_log.entries[0].change_kind, "added")
self.assertIsNotNone(shard_log.entries[0].raw_document)
assert shard_log.entries[0].raw_document is not None
self.assertEqual(shard_log.entries[0].raw_document.record_key, "note:daemon-test-peer")
finally:
process.terminate()
try: