Commit fbdcb31
feat(decisioning): PgBuyerAgentRegistry — durable Tier 2 commercial-identity store (#364)
Postgres-backed BuyerAgentRegistry implementation for adopters who
need durable commercial-identity gating without forking the
SQLAlchemy reference example. Mirrors the design of
adcp.signing.pg.PgReplayStore — caller-owned ConnectionPool,
table-name validation, idempotent ``create_schema()``, raw DDL
ships separately for migration tools (Alembic, Flyway, psql).
* ``src/adcp/decisioning/pg/buyer_agent_registry.py`` — sync
psycopg-pool implementation; the async BuyerAgentRegistry
Protocol methods bridge via ``asyncio.to_thread`` so the
framework's dispatch event loop stays responsive.
* ``src/adcp/decisioning/pg/buyer_agent_registry.sql`` — canonical
schema for migration tools. JSONB columns for billing_capabilities,
default_terms, allowed_brands, ext. CHECK constraint on status.
Partial index on api_key_id for the bearer-credential lookup
path. Partial index on status WHERE status <> 'active' for
admin tools.
* Admin CRUD: upsert(), set_status(), delete(). Status validated
against the framework's literal enum.
* SQL injection / Unicode-homoglyph defenses on the table_name
kwarg matching PgReplayStore's posture.
* 15 conformance tests gated on ADCP_PG_TEST_URL — all 15 pass
against postgres:16. CI's existing pg job (renamed
pg-replay-store → pg-conformance) now runs them too.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent dc37318 commit fbdcb31
6 files changed
Lines changed: 830 additions & 3 deletions
File tree
- .github/workflows
- src/adcp/decisioning/pg
- tests/conformance/decisioning
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
43 | | - | |
| 42 | + | |
| 43 | + | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
| 76 | + | |
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
82 | 83 | | |
83 | 84 | | |
84 | 85 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
0 commit comments