chore: clarify source ownership observability

This commit is contained in:
lda
2026-06-04 17:55:46 +07:00 Unverified
parent 00305c1398
commit 65ac9c5c0f
3 changed files with 16 additions and 0 deletions
+2
View File
@@ -2,6 +2,8 @@
prefer asserts actual['field'] == expected['field'] over assert actual == expected unless we know better (eg. no extra fields allowed) prefer asserts actual['field'] == expected['field'] over assert actual == expected unless we know better (eg. no extra fields allowed)
Prefer pytest `tmp_path` for test-local filesystem state. Avoid fixed paths under `local_temp_root()` for tests that create durable files unless the test explicitly cleans or needs cross-process persistence; stale files there can change later test runs.
more later more later
# Test suite # Test suite
@@ -101,6 +101,15 @@ class ConnectionService:
connection.source_config_ownership == "seed" connection.source_config_ownership == "seed"
and registry_entry is not None and registry_entry is not None
): ):
self.events.record_kind(
"source_registry_seed_existing_entry_wins",
connection_id=registry_entry.id,
payload={
"server": registry_entry.provider,
"account": registry_entry.account,
"reason": "seed_config_yields_to_registry_entry",
},
)
merged_connections.append( merged_connections.append(
registry_entry_to_connection_config(registry_entry) registry_entry_to_connection_config(registry_entry)
) )
@@ -324,6 +324,7 @@ def test_connection_service_sync_seed_config_materializes_registry_entry(
service.sync_connections_from_config(config, source_registry_store=store) service.sync_connections_from_config(config, source_registry_store=store)
registry = store.load_registry() registry = store.load_registry()
assert len(registry.sources) == 1
assert registry.sources[0].id == "demo.default" assert registry.sources[0].id == "demo.default"
assert registry.sources[0].provider == "demo" assert registry.sources[0].provider == "demo"
assert service.get("demo.default").metadata["source_registry"] is True assert service.get("demo.default").metadata["source_registry"] is True
@@ -370,6 +371,10 @@ def test_connection_service_sync_seed_existing_registry_entry_wins(
connection = service.get("demo.default") connection = service.get("demo.default")
assert connection.server == "registry" assert connection.server == "registry"
assert connection.account == "stored" assert connection.account == "stored"
assert any(
event.kind == "source_registry_seed_existing_entry_wins"
for event in service.events.list_events()
)
def test_wfmcpservice_sync_connections_delegates_registry_store() -> None: def test_wfmcpservice_sync_connections_delegates_registry_store() -> None: