Commit 4400a70
feat(decisioning): ProposalManager v1 — Protocol + MockProposalManager forwarder + tenant binding
Foundation for the two-platform composition established in the product
architecture design doc (PR #502, docs/proposals/product-architecture.md).
Adopters can now wire a separate ProposalManager that handles
get_products / refine, while DecisioningPlatform handles create_media_buy
and lifecycle. The recipe (typed implementation_config) is the contract
between them.
v1 surface:
- ProposalManager Protocol (sync/async, capability-gated refine)
- ProposalCapabilities dataclass (sales_specialism + flags)
- Recipe Pydantic base with recipe_kind discriminator
- MockProposalManager v1 default forwarder (symmetric with Phase 2's
upstream_for mock-mode dispatch on DecisioningPlatform)
- proposal_manager= kwarg on serve() / create_adcp_server_from_platform
- Dispatcher routing in PlatformHandler.get_products: routes to
ProposalManager when wired (with refine/get_products selection by
buying_mode + capability + method-presence); falls through to
platform.get_products otherwise — backward-compat by construction
Out of scope (deferred to subsequent PRs, called out in module doc):
- Session cache for in-flight proposals
- finalize transition (buying_mode='refine' + action='finalize')
- expires_at enforcement
- capability_overlap declaration on Recipe + framework validation
- Recipe persistence through buy lifecycle (hydration in
create_media_buy / update_media_buy / get_delivery)
- Per-tenant ProposalManager binding via PlatformRouter
- MIGRATION.md updates for v3 reference seller
Tests: 16 new in tests/test_proposal_manager.py covering Protocol
conformance, capability validation, MockProposalManager forwarding
(respx-mocked), dispatcher routing with/without proposal_manager,
adopter subclass dispatch, sync+async support, and refine routing
across all four (capability, method, buying_mode, fall-through) cases.
Full regression suite (3718 tests) green.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent b584e70 commit 4400a70
7 files changed
Lines changed: 1283 additions & 5 deletions
File tree
- examples
- src/adcp/decisioning
- tests
| 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 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
124 | 131 | | |
125 | 132 | | |
126 | 133 | | |
| |||
313 | 320 | | |
314 | 321 | | |
315 | 322 | | |
| 323 | + | |
316 | 324 | | |
317 | 325 | | |
318 | 326 | | |
319 | 327 | | |
320 | 328 | | |
321 | 329 | | |
322 | 330 | | |
| 331 | + | |
| 332 | + | |
323 | 333 | | |
324 | 334 | | |
325 | 335 | | |
| |||
339 | 349 | | |
340 | 350 | | |
341 | 351 | | |
| 352 | + | |
342 | 353 | | |
343 | 354 | | |
344 | 355 | | |
345 | 356 | | |
346 | 357 | | |
| 358 | + | |
347 | 359 | | |
348 | 360 | | |
349 | 361 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
| 165 | + | |
165 | 166 | | |
166 | 167 | | |
167 | 168 | | |
| |||
708 | 709 | | |
709 | 710 | | |
710 | 711 | | |
| 712 | + | |
711 | 713 | | |
712 | 714 | | |
713 | 715 | | |
| |||
721 | 723 | | |
722 | 724 | | |
723 | 725 | | |
| 726 | + | |
724 | 727 | | |
725 | 728 | | |
726 | 729 | | |
| |||
1068 | 1071 | | |
1069 | 1072 | | |
1070 | 1073 | | |
1071 | | - | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
1072 | 1089 | | |
1073 | 1090 | | |
1074 | | - | |
| 1091 | + | |
1075 | 1092 | | |
1076 | 1093 | | |
1077 | 1094 | | |
| |||
1096 | 1113 | | |
1097 | 1114 | | |
1098 | 1115 | | |
1099 | | - | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
1100 | 1122 | | |
1101 | 1123 | | |
1102 | 1124 | | |
| |||
1124 | 1146 | | |
1125 | 1147 | | |
1126 | 1148 | | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
1127 | 1159 | | |
1128 | | - | |
1129 | | - | |
| 1160 | + | |
| 1161 | + | |
1130 | 1162 | | |
1131 | 1163 | | |
1132 | 1164 | | |
| |||
1185 | 1217 | | |
1186 | 1218 | | |
1187 | 1219 | | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
1188 | 1254 | | |
1189 | 1255 | | |
1190 | 1256 | | |
| |||
0 commit comments