Repository navigation
Recommendations: read and pause auto-apply subscriptions - #118
Merged
Merged
Conversation
get_recommendation_subscriptions lists every recommendation_subscription with its type, status and create/modify times; insights[] names each ENABLED type and flags one modified in the last 30 days. health_check is unchanged. draft_recommendation_subscriptions can only set types to PAUSED: there is no status parameter, and the applier hard-codes PAUSED whatever a stored plan says. Re-enabling stays in the Google Ads UI. Each type needs an ENABLED subscription, else it is refused by name. Single confirmation. MutateRecommendationSubscriptionRequest has validate_only in v25, so the dry run goes through the validate-only client. Fixes kLOsk#107.
kLOsk
reviewed
Oct 27, 2026
kLOsk
left a comment
Owner
There was a problem hiding this comment.
Thanks, this is exactly the shape from #107: nothing can re-enable, and the dry run uses validate_only. Merging now. Two small things for a follow-up, not blocking: a round-trip test through confirm_and_apply(dry_run=True), and an assertion that the operation is an update on the planned resource name. We'll add the README rows ourselves when the batch lands.
Contributor
Author
|
Thanks for merging. The round-trip test and the |
kLOsk
pushed a commit
that referenced
this pull request
Oct 28, 2026
#119) Follow-up to #118 (review notes): a test drafts a pause and runs confirm_and_apply(dry_run=True) through the real validate-only path, checking one validated call, validate_only on the request, and an update of the planned resource to PAUSED; another asserts every operation is an update on the planned resource name. Tests only.
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.
Closes #107.
Adds a read tool and a pause-only write tool for auto-apply recommendation subscriptions, in the shape agreed on the issue. Re-enabling is left out entirely. Both live in a new module,
ads/recommendation_subscriptions.py, next torecommendations.py.get_recommendation_subscriptions(read-only)recommendation_subscription:resource_name,type,status,create_date_time,modify_date_time.total_subscriptionsandenabled_count. A type that isn't listed is not auto-applied, and the docstring says so.insights[]:ENABLEDtype ("auto-apply without a preview");ENABLEDtype whosemodify_date_timefalls in the last 30 days (RECENT_DAYS), so a weekly audit catches auto-apply being switched on;health_check: untouched, as you asked.draft_recommendation_subscriptions(write, pause only)ENABLED: the tool takesrecommendation_typesandcustomer_id, and has no status parameter. The applier hard-codesPAUSEDwhatever a stored plan says. A test changes a plan toENABLEDand checks the request still pauses.ENABLEDsubscription. A type with no subscription, or one already paused, is refused by name, so the preview lists only what the apply will change. It showscurrent_status→statusandmodify_date_timeper type.MutateRecommendationSubscriptionRequest, with anupdateand anupdate_maskofstatusper type.Dry run
I checked the v25 protos.
MutateRecommendationSubscriptionRequesthasvalidate_only(fields:customer_id,operations,partial_failure,validate_only,response_content_type). So the dry run goes throughValidateOnlyClientlike other Google Ads writes, with no re-read check, and a test pinsvalidate_only=Trueon the request. The operation is in the normal_dispatch_ads_plantable.Checked against a live account
[]with the "nothing auto-applied" insight.RESOURCE_NOT_FOUND. That's expected, and it shows the request is well-formed. I couldn't test a realENABLEDsubscription without turning one on, which I didn't want to do in a live account.Rules and tests
.cursor/rules/adloop.mdcnow has both tools in the tables. The recommendations pattern gets step 8: check subscriptions, offer to pause, never suggest re-enabling. Synced.tests/test_recommendation_subscriptions.py(17 tests) covers:uv run pytestgives 1680 passed, 2 skipped.