fix: v2/v3 backwards compat for create_media_buy, update_media_buy, get_products#274
Conversation
…et_products - Strip brand_manifest before strict Zod validation for create/update media buy - Convert brand → brand_manifest (bare domain URL) when adapting for v2 servers - Throw on proposal_id for v2 servers (proposal mode is v3-only) - Strip catalog from package items for v2 servers (v3-only field) - Fix dead-code delete: account_id → account in adaptGetProductsRequestForV2 - Align brand URL format: both get_products and create_media_buy use https://<domain>
nastassiafulconis
left a comment
There was a problem hiding this comment.
Overall approach is solid — lifting brand_manifest normalization to cover more task types and the new v2 adaptation for brand/catalog/proposal_id all make sense. A couple things to fix up before this is good to go though.
|
Addressed all 5 review comments — pushed the fixes: #1 ( #2 ( #3 ( #4 ( #5 ( |
nastassiafulconis
left a comment
There was a problem hiding this comment.
All 5 comments addressed in ca7fc3b. Looks good to merge.
…lization, and test coverage - brand?.domain guard prevents "https://undefined" in adaptCreateMediaBuyRequestForV2 - preserve brand in output when it has no domain (consistent with adaptGetProductsRequestForV2) - remove update_media_buy from brand_manifest normalization (neither v2/v3 schema has brand) - add mock-based test verifying brand_manifest is not forwarded as an object to the server - add tests for brand-with-no-domain case and adaptUpdateMediaBuyRequestForV2 brand semantics
ca7fc3b to
022c840
Compare
Summary
brand_manifestbefore strict Zod validation fires forcreate_media_buyandupdate_media_buy— v2.5 callers no longer hit "Request validation failed: Unrecognized key: brand_manifest"brand(BrandReference) →brand_manifestbare domain URL when adapting requests for v2 servers — previouslybrandpassed through and v2 servers rejected itproposal_idis sent to a v2 server (proposal mode is v3-only; v2 requires explicitpackages)catalogfrom package items for v2 servers (optimization_goalswas already stripped;catalogwas missed)account_id→accountinadaptGetProductsRequestForV2get_productsandcreate_media_buyboth now usehttps://<domain>(bare domain) consistentlyTest plan
request-validation.test.js:brand_manifeststripped pre-validation forcreate_media_buy,brandwins when both supplied, mock-based test verifying conversion at the transport layerv3-compatibility.test.js: brand → brand_manifest conversion, brand-with-no-domain preserved, proposal_id throws, catalog stripped from packages,adaptUpdateMediaBuyRequestForV2brand passthrough documented