Add fake external adapter packs

This commit is contained in:
2026-05-18 22:40:53 +02:00
parent e92c8f8c89
commit d1b46ad2f3
8 changed files with 472 additions and 13 deletions

View File

@@ -0,0 +1,57 @@
# External Adapter Packs
`phase-memory` can resolve runtime configuration values that declare adapter
mode `external`. Missing external adapters still fail resolution, but supplied
adapter packs can satisfy the public runtime ports.
## Fake External Pack
`phase_memory.external_adapters.fake_external_adapter_pack()` returns a local
fake pack for conformance and integration tests. It provides:
- `FakeExternalGraphStore`
- `FakeExternalEventLog`
- `FakeExternalPolicyGateway`
- `FakeTelemetryAuditSink`
- `FakeMarkitectPackageCompiler`
- `FakeExternalSemanticIndex`
- `FakeKontextualRuntimeRegistry`
The pack is not a production adapter. It is intentionally deterministic and
dependency-light so that service wiring, conformance helpers, and runtime
envelopes can be tested before live Markitect, Kontextual, or telemetry
services exist.
## Runtime Wiring
```python
from phase_memory.external_adapters import (
fake_external_adapter_pack,
fake_external_runtime_config,
)
from phase_memory.service import runtime_from_config
config = fake_external_runtime_config()
pack = fake_external_adapter_pack()
runtime = runtime_from_config(config, external_adapters=pack.adapters)
```
`resolve_runtime_adapters(config, external_adapters=pack.adapters)` returns a
`RuntimeAdapterBundle` with diagnostics. External declarations produce
`external_adapter_declared` warnings. Missing adapters produce
`missing_external_adapter` errors and block runtime construction.
## Conformance
The fake pack passes the same public helpers expected of live adapters:
- `assert_graph_store_conformance`
- `assert_event_log_conformance`
- `assert_context_compiler_conformance`
- `assert_policy_gateway_conformance`
- `assert_audit_sink_conformance`
- `assert_semantic_index_conformance`
- `assert_runtime_registry_conformance`
Live adapter packs should pass those helpers before being wired into a runtime
or service runner.

View File

@@ -59,6 +59,18 @@ External adapter modes are valid configuration values, but they must be
supplied explicitly by the caller. The local resolver reports
`missing_external_adapter` instead of silently replacing them.
## External Adapter Packs
`phase_memory.external_adapters.fake_external_adapter_pack()` supplies a
deterministic fake external pack for conformance and integration tests. It
includes fake Markitect package compilation, Kontextual-shaped graph/event and
runtime registry adapters, a fake semantic index, a fake policy gateway, and a
fake telemetry audit sink.
Use it with `fake_external_runtime_config()` and
`resolve_runtime_adapters(config, external_adapters=pack.adapters)` to exercise
the external wiring path without live services.
## Health
`health_report` emits: