feat(assets): asset extensions + per-ad-group multi-scope (split 1/4 of #34)#50
Open
illia-sapryga wants to merge 6 commits into
Open
feat(assets): asset extensions + per-ad-group multi-scope (split 1/4 of #34)#50illia-sapryga wants to merge 6 commits into
illia-sapryga wants to merge 6 commits into
Conversation
Add an optional ad_group_id to draft_callouts and draft_structured_snippets so an asset can link at ad-group, campaign, or customer scope (most-specific wins). Generalize the campaign-only _apply_campaign_assets into _apply_assets, which builds AdGroupAsset / CampaignAsset / CustomerAsset links depending on scope. The old _apply_campaign_assets remains as a campaign-scope alias. Claude-Session: https://claude.ai/code/session_01FKcPiYrtXWtg4b7dnW4o5s
draft_call_asset creates a CallAsset at ad-group / campaign / customer scope, canonicalizing the phone number to E.164 and optionally wiring a resource-level call conversion action and ad-schedule windows. add_ad_schedule adds AD_SCHEDULE CampaignCriterion records. Shared _normalize_phone_e164 and _validate_ad_schedule helpers back both tools plus the promotion tools to come. Claude-Session: https://claude.ai/code/session_01FKcPiYrtXWtg4b7dnW4o5s
PromotionAsset and PriceAsset draft tools linked at ad-group / campaign / customer scope, with full field validation (one-of money/percent, mutually exclusive code/orders-over, ISO dates, reachable URLs, 3-8 unique price offerings). Promotion/price enum vocabularies are pulled from the SDK so they don't drift across API versions. update_promotion swaps the immutable asset: create new + link, then unlink the old link found via _find_asset_link. Claude-Session: https://claude.ai/code/session_01FKcPiYrtXWtg4b7dnW4o5s
update_callout, update_sitelink, and update_call_asset patch mutable CalloutAsset / SitelinkAsset / CallAsset fields in place via a partial field mask (only the fields the caller passes). update_structured_snippet swaps the immutable snippet asset (create new + link at the same scope, then unlink the old link) across ad-group / campaign / customer scope. Claude-Session: https://claude.ai/code/session_01FKcPiYrtXWtg4b7dnW4o5s
…omer draft_location_asset creates a LOCATION_SYNC AssetSet backed by a linked Google Business Profile and links it at customer or campaign scope. draft_business_name_asset creates a TEXT asset linked as BUSINESS_NAME. link_asset_to_customer promotes existing assets to account level by creating CustomerAsset link rows (no new Asset rows), validating each field_type against the CustomerAsset-legal set. Claude-Session: https://claude.ai/code/session_01FKcPiYrtXWtg4b7dnW4o5s
_normalize_phone_e164 stripped every leading zero and ignored the "00" international access prefix. Now it removes exactly one domestic trunk zero, keeps Italy's leading zero, and maps a leading "00" to "+". Addresses the maintainer's split-(c) note early, since (a) is where this helper is first introduced (call assets). Claude-Session: https://claude.ai/code/session_01FKcPiYrtXWtg4b7dnW4o5s
This was referenced Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Split 1/4 of #34 — asset extensions + per-ad-group multi-scope
This is the first of the four-way split you asked for in #34, rebuilt fresh on current
main(not a rebase — fresh, curated commits) and registering only its own tools, so nothing references the GTM/ServiceTitan modules that aren't in this PR.What's here
Multi-scope refactor (existing tools gain an optional
ad_group_id— ad-group / campaign / customer scope, most-specific wins):draft_callouts,draft_structured_snippetsNew draft tools:
draft_call_asset(per-ad-group call assets, E.164 normalization, optional call-conversion + ad schedule)draft_price_asset,draft_promotion,draft_location_asset(LOCATION_SYNC/GBP),draft_business_name_assetadd_ad_schedule(AD_SCHEDULE campaign criteria)New editors:
update_callout,update_sitelink,update_call_asset(in-place field-mask patches)update_structured_snippet,update_promotion(immutable-asset swaps: create+link new, unlink old)link_asset_to_customer(promote an existing asset to account level)v0.12 runtime compliance
current_config()— the stale-_configgrep test intest_server.pypasses.configfirst; new operations added to the_execute_plandispatch; handlers(client, cid, changes)._StrList/_DictList/_DictListOpt).draft_image_assetskeeps main'sdeployment_mode() == "server"guard (untouched — the old branch never added ad-group scope to image assets, so it stays campaign-only here).One fix pulled forward
_normalize_phone_e164is introduced in this PR (call assets), so I fixed the bug you flagged for split (c) here rather than ship it: it now strips exactly one domestic trunk zero (not every leading zero), keeps Italy's leading zero, and maps a leading00international prefix to+. Tests cover all three.Notes / intentional asymmetries (match the source branch)
update_promotionis campaign/customer scope only (no ad-group);update_structured_snippetsupports all three.add_geo_exclusionswas not included — it's a targeting tool, andmainalready hasadd_negative_locations.Tests & hygiene
tests/test_ads_extensions.py, covering preview validation and apply-layer mutate ops across campaign / ad-group / customer scope).555-01xx, business names are placeholders, URLs areexample.com.Splits (b) conversion-action CRUD, (c) conversion uploads (folding #43), and (d) RSA update (folding #42) will follow in order.
https://claude.ai/code/session_01FKcPiYrtXWtg4b7dnW4o5s