Fix: Implement creative assignment in update_media_buy #560
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the
update_media_buyendpoint to properly handle creative assignments. Previously, the endpoint ignoredcreative_idsin package updates and returned emptyaffected_packagesarrays.Problem
The
update_media_buyimplementation was incomplete:creative_idsin package updatesaffected_packagesarraySolution
Added complete creative assignment logic to
_update_media_buy_impl:CreativeAssignmenttableaffected_packageswithPackageUpdateResultExample Response
{ "media_buy_id": "buy_123", "buyer_ref": "buyer_ref_123", "affected_packages": [ { "buyer_package_ref": "pkg_default", "changes_applied": { "creative_ids": { "added": ["creative_1", "creative_2"], "removed": [], "current": ["creative_1", "creative_2"] } } } ] }AdCP Compliance
✅ Fully compliant with AdCP v2.2.0 specification
affected_packagesincludesbuyer_package_ref+changes_appliedcreative_idsshowsadded/removed/currentarraysPackageUpdateResultinterface from specTesting
Unit Tests (4 tests)
affected_packagesstructureuv run pytest tests/unit/test_update_media_buy_affected_packages.py -v # ✅ 4 passedIntegration Tests (3 tests - requires PostgreSQL)
Files Changed
Impact
update_media_buytool now supports creative assignmentsupdate_media_buyendpoint now supports creative assignmentsTest Plan
Documentation
🤖 Generated with Claude Code