Commit 5567e2b
* feat(decisioning): ProposalCapabilities.auto_commit_on_put_draft (#723)
Closes #723 (option B).
Pre-#723 the storyboard ``media_buy_seller/proposal_finalize/create_media_buy``
was unreachable for managers that didn't declare ``finalize=True``:
brief mode returned proposals as DRAFT, next call's
``try_reserve_consumption`` raised ``PROPOSAL_NOT_COMMITTED``, and the
only framework path that promoted DRAFT → COMMITTED was
``finalize_proposal`` (which most v1 adopters didn't ship). Adopters
worked around it by writing ``state=COMMITTED`` directly inside their
``put_draft`` implementations (salesagent PR #390).
This adds the framework-side equivalent. When a manager declares
``auto_commit_on_put_draft=True``, the dispatcher calls
``ProposalStore.commit`` immediately after ``put_draft`` on every
proposal returned by ``get_products`` / ``refine_products``,
promoting DRAFT → COMMITTED in a single dispatch.
New ProposalCapabilities fields:
- ``auto_commit_on_put_draft: bool = False``
- ``auto_commit_ttl_seconds: int = 604800`` (7 days, salesagent default)
Construction-time validation:
- auto_commit + finalize mutually exclusive (both on would race).
- ``auto_commit_ttl_seconds <= 0`` rejected (would expire on commit).
Tests: 7 new in tests/test_proposal_auto_commit.py.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(decisioning): address review feedback on auto-commit capability (#725)
- Loud-fail ``auto_commit_on_put_draft=True`` on ``sales-guaranteed``
specialism. Product-expert catch: a 7-day default TTL inventory hold
issued silently from every ``get_products`` call would burn
guaranteed-direct inventory across thousands of catalog probes per
day. GAM / ad-server proposal lifecycles require explicit
buyer-driven reservation precisely because trafficking ops won't
accept silent holds. Loud-fail with a clear migration path
(switch to ``sales-non-guaranteed`` or set ``finalize=True``).
- Implement the >30-day TTL soft-cap warning the docstring promised.
The framework permits longer TTLs (long-running RFPs legitimately
need them) but warns at boot so the choice is visible at
declaration time. Boundary check pins that exactly 30 days does
not trigger.
- Move ``from datetime import timedelta`` to the module-level import
(was inline inside the per-proposal loop).
- 3 new tests: ``sales-guaranteed`` rejection, >30d warning + 30d
boundary, catalog-mode (store wired but manager unwired stays in
DRAFT regardless).
- Rename local variable ``_SOFT_CAP_SECONDS`` → ``_soft_cap_seconds``
per ruff N806 (function-local should be lowercase).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent a65185e commit 5567e2b
3 files changed
Lines changed: 423 additions & 2 deletions
File tree
- src/adcp/decisioning
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| |||
417 | 417 | | |
418 | 418 | | |
419 | 419 | | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
420 | 429 | | |
421 | | - | |
| 430 | + | |
422 | 431 | | |
423 | 432 | | |
424 | 433 | | |
| |||
428 | 437 | | |
429 | 438 | | |
430 | 439 | | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
431 | 448 | | |
432 | 449 | | |
433 | 450 | | |
| |||
453 | 470 | | |
454 | 471 | | |
455 | 472 | | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
456 | 486 | | |
457 | 487 | | |
458 | 488 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
140 | 160 | | |
141 | 161 | | |
142 | 162 | | |
| |||
152 | 172 | | |
153 | 173 | | |
154 | 174 | | |
| 175 | + | |
| 176 | + | |
155 | 177 | | |
156 | 178 | | |
157 | 179 | | |
| |||
185 | 207 | | |
186 | 208 | | |
187 | 209 | | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
188 | 291 | | |
189 | 292 | | |
190 | 293 | | |
| |||
0 commit comments