Implement live-shaped readiness workplan

This commit is contained in:
2026-05-19 01:06:41 +02:00
parent 3a52b3df41
commit 635d999621
21 changed files with 1507 additions and 54 deletions

View File

@@ -1,6 +1,6 @@
# Operational Readiness Recipe
Updated: 2026-05-18
Updated: 2026-05-19
This recipe exercises the local operational surface without requiring live
Markitect, Kontextual, or telemetry services. It is the expected smoke path for
@@ -60,6 +60,30 @@ Expected checks:
audit sink retention mode.
- `health["ok"]` is true.
## Service Binding Drill
`ServiceBinding` wraps `LocalServiceRunner` in an HTTP-shaped API without
starting a listener:
```python
from phase_memory import ServiceBinding
binding = ServiceBinding(runner)
health_response = binding.route("GET", "/health")
ready_response = binding.route("GET", "/ready")
contracts_response = binding.route("GET", "/contracts")
package_response = binding.route(
"POST",
"/operations/package.compile",
{"selection": activation["data"]["activation_plan"]["selection"]},
)
```
The WSGI adapter returned by `binding.as_wsgi_app()` is also callable in tests
without opening a socket. Use this for deployment wrappers so the core service
operation contract stays framework-neutral.
## Review-Gated Apply
Lifecycle actions that require review are denied until an approval marker or
@@ -90,6 +114,12 @@ from phase_memory import RuntimeConfig, LocalServiceRunner
config = RuntimeConfig.from_profile(profile, local_store_path=".phase-memory-local")
runner = LocalServiceRunner(config=config)
repair = runner.runtime.repair_diagnostics(source_ref=config.local_store_path)
migration_plan = runner.runtime.plan_store_migration(source_ref=config.local_store_path)
migration_apply = runner.runtime.apply_store_migration(
migration_plan["data"]["migration_plan"],
actor="operator",
source_ref=config.local_store_path,
)
```
Repair diagnostics distinguish:
@@ -100,6 +130,22 @@ Repair diagnostics distinguish:
- `missing_edge_source` / `missing_edge_target` for graph reference damage.
- `orphaned_path_event` when paths reference absent event-log records.
Migration apply is audited as `store.migration.apply` and updates metadata
atomically when changes are needed.
## Audit Export And Retention Drill
Runtime audit behavior is inspectable beyond point queries:
```python
export = runner.runtime.export_audit_events({"operation": "package.compile"})
retention = runner.runtime.audit_retention_plan(retention_days=30)
```
The export batch includes matching audit events and sink retention metadata.
The retention plan identifies eligible operation ids but does not prune records;
retention apply is a follow-on operational task.
## Adapter Pack Compatibility
Fake and future live adapter packs should publish a manifest with:
@@ -108,13 +154,16 @@ Fake and future live adapter packs should publish a manifest with:
- ownership boundaries for every adapter;
- required conformance helpers.
Validate a pack before wiring it into the runtime:
Validate fake or live-shaped packs before wiring them into the runtime:
```python
from phase_memory import fake_external_adapter_pack, validate_adapter_pack_manifest
from phase_memory import fake_external_adapter_pack, live_shaped_adapter_pack, validate_adapter_pack_manifest
diagnostics = validate_adapter_pack_manifest(fake_external_adapter_pack())
assert diagnostics == ()
live_diagnostics = validate_adapter_pack_manifest(live_shaped_adapter_pack())
assert live_diagnostics == ()
```
Missing capabilities are reported as `missing_adapter_capability` diagnostics
@@ -129,8 +178,12 @@ The stable embedding surface is:
`service_contracts()["operations"]`.
- `RuntimeConfig` and `resolve_runtime_adapters` for local/external adapter
resolution.
- `ServiceBinding` and `service_binding_from_config` for optional service
wrappers.
- Adapter conformance helpers in `phase_memory.service`.
- External adapter pack manifests and validation helpers.
- Public export and service operation snapshots in
`tests/fixtures/public-api-snapshot.json`.
New public operations should be added to the service contract first, then to
the local runner, runtime tests, and docs in the same change.