Repository navigation
Commit 55ec2fd
feat(serving): ControlPlaneStore port + embedded adapter — webhook queue/log behind it (ADR 0010 slice 1) (#131)
First rollout slice of ADR 0010: the webhook durable delivery queue and the
delivery attempt log move behind a ControlPlaneStore port. Pure extraction —
table DDL, SQL shapes, catalog-DDL-lock behavior and the dispatcher's public
method signatures are byte-compatible with the pre-port code; no behavior
change on the embedded (default) profile.
- NEW src/serving/control_plane/: store.py (port ABC + WebhookQueueRow +
get_control_plane_store resolver), embedded.py (EmbeddedControlPlaneStore
over the serving DuckDB; ensure_* DDL helpers moved here verbatim,
including the shared catalog_ddl_lock discipline).
- Claim semantics are part of the port contract, not adapter detail:
enqueue returns True only for the inserting caller (inline delivery
belongs to the enqueue winner), claim_due returns rows this worker owns
(embedded: degenerate single-process exclusivity; the PG adapter in
slice 5 implements the same contract with FOR UPDATE SKIP LOCKED + lease).
- webhook_dispatcher and routers/webhooks.py no longer reach into
query_engine._conn; the single sanctioned reach is the composition seam
in control_plane/store.py (documented), pinned by a structural ratchet
test. The outcome state machine (delivered / backoff-pending / dead at
max attempts) moved into the store; retry policy stays dispatcher config.
- get_control_plane_store: lazy per-app resolution (mirrors
ensure_alert_dispatcher so unit stubs keep working), eager boot-time
resolution in the lifespan. AGENTFLOW_CONTROLPLANE_STORE env knob:
'embedded' (default) runs; 'postgres' raises NotImplementedError until
slice 5 ships the adapter (fail-closed ratchet, pinned by test); unknown
values are a boot error.
- Tests: NEW tests/unit/test_control_plane_store.py (13 tests: enqueue-win,
claim ordering/bounds/due-ness, outcome transitions, park, log roundtrip,
resolver caching + ratchets + live-engine rebinding, structural _conn
ratchet); test_webhook_dispatcher_unit / test_catalog_ddl_concurrency /
integration test_webhooks rewired to the new module; the DDL-lock
identity pin now covers control_plane.embedded.
Verified: unit 42 (store+dispatcher+ddl) + integration webhooks 12 + full
unit suite green locally; ruff check+format clean; mypy strict clean on all
touched src files.
Co-authored-by: JuliaEdom <uedomskikh@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>1 parent 88e726b commit 55ec2fd
11 files changed
Lines changed: 819 additions & 235 deletions
File tree
- src/serving
- api
- routers
- control_plane
- tests
- integration
- unit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
7 | 26 | | |
8 | 27 | | |
9 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
| |||
195 | 196 | | |
196 | 197 | | |
197 | 198 | | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
198 | 205 | | |
199 | 206 | | |
200 | 207 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | 15 | | |
17 | 16 | | |
18 | 17 | | |
19 | 18 | | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
0 commit comments