Verify Python exports and health probes

This commit is contained in:
Meta Vens 2026-06-14 14:56:11 +01:00
commit 432e5443e4
4 changed files with 19 additions and 8 deletions

View file

@ -89,8 +89,9 @@ CultCache, CultNet, and CultMesh. It is evidence, not confetti.
endpoints, apply peer snapshots through a caller-owned database, run
lightweight scheduled snapshot and simulation-observation fanout loops, probe
peer-card endpoints for hello-level reachability, preserve hello capability
metadata on health results, and upsert results into local catalogs with the
same count-returning ergonomics as the C# discovery clients.
metadata on health results, run immediate scheduled health probes on start,
and upsert results into local catalogs with the same count-returning
ergonomics as the C# discovery clients.
- Python CultMesh facade:
Exposes C#-matching client entrypoints for Verse discovery, peer exchange,
raw CultNet client construction, local nodes, catalogs, sessions, streams,
@ -173,10 +174,10 @@ CultCache, CultNet, and CultMesh. It is evidence, not confetti.
committed-fact watch points as the C# session facade.
- Python package health:
`cultcache-py-verify --json` checks the public CultCache/CultNet/CultMesh
export surface, `py.typed` markers, a live local CultMesh framed-wire smoke
over hello/schema/snapshot/shard catalog/shard log, typed peer-error export
availability, peer-advertised mutation contracts, payload schema wire
contracts, and benchmark sanity for
export surface declared by each package `__all__`, `py.typed` markers, a live
local CultMesh framed-wire smoke over hello/schema/snapshot/shard
catalog/shard log, typed peer-error export availability, peer-advertised
mutation contracts, payload schema wire contracts, and benchmark sanity for
Python-owned hot paths.
- Python/C# public cache baseline:
`cultcache_py.compare_csharp` runs Python and C# `CultCache` upsert/get

View file

@ -168,7 +168,7 @@ def _check_exports() -> dict[str, Any]:
missing: dict[str, list[str]] = {}
for module_name, names in EXPECTED_EXPORTS.items():
module = importlib.import_module(module_name)
missing_names = [name for name in names if not hasattr(module, name)]
missing_names = [name for name in _expected_module_exports(module, names) if not hasattr(module, name)]
if missing_names:
missing[module_name] = missing_names
return {
@ -178,6 +178,12 @@ def _check_exports() -> dict[str, Any]:
}
def _expected_module_exports(module: Any, required_names: tuple[str, ...]) -> tuple[str, ...]:
exported = getattr(module, "__all__", ())
export_names = tuple(str(name) for name in exported)
return tuple(sorted({*required_names, *export_names}))
def _check_typed_markers() -> dict[str, Any]:
missing = []
for module_name in EXPECTED_EXPORTS:

View file

@ -579,6 +579,7 @@ class CultMeshPeerHealthMonitor:
verse_id: str,
roles: list[str] | None,
) -> None:
self.probe_catalog(catalog, verse_id=verse_id, roles=roles)
while not self._stop.wait(self.interval_seconds):
self.probe_catalog(catalog, verse_id=verse_id, roles=roles)

View file

@ -3001,7 +3001,10 @@ class CultCacheTests(unittest.TestCase):
)
monitor.start(peers, verse_id="mesh", roles=["read-replica"])
deadline = time.monotonic() + 2.0
while not seen and time.monotonic() < deadline:
while time.monotonic() < deadline:
latest = monitor.latest()
if latest and latest[0].is_reachable:
break
time.sleep(0.01)
monitor.stop()
finally: