Skip to content

Commit bca973c

Browse files
committed
Added section to enforce rigorous GAQL validation.
1 parent 1cc743a commit bca973c

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

GEMINI.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,20 @@ This document outlines mandatory operational guidelines, constraints, and best p
8282
- **Date Ranges:** Compute dates dynamically (no constants like `LAST_90_DAYS`).
8383
- **Conversion Summaries:** Use `daily_summaries` for date-segmented data from `offline_conversion_upload_conversion_action_summary` and `offline_conversion_upload_client_summary`.
8484

85+
#### 3.3.1. Rigorous GAQL Validation
86+
87+
When validating a GAQL query, you MUST follow this process:
88+
89+
1. Initial Field Validation: For each field in the query, use GoogleAdsFieldService to verify that it is selectable and filterable.
90+
91+
2. Contextual Compatibility Check: Do not assume that a filterable field is filterable in all contexts. You MUST verify its compatibility with the resource in the FROM clause. To do this, you MUST:
92+
* Query the GoogleAdsFieldService for the main resource in the FROM clause.
93+
* Examine the selectable_with attribute of the main resource to find the correct fields for filtering.
94+
95+
3. Segment Rule: You MUST verify that any segment field used in the WHERE clause is also present in the SELECT clause, unless it is a core date segment (segments.date, segments.week, segments.month, segments.quarter, segments.year).
96+
97+
4. Prioritize Validator Errors: If the user provides an error message from a GAQL query validator, you MUST treat that error message as the definitive source of truth. You MUST immediately re-evaluate your validation and correct the query based on the error message.
98+
8599
#### 3.4. Code Generation
86100
- **Language:** Infer the target language from user request, existing files, or project context. Default to Python if ambiguous.
87101
- **Reference Source:** Refer to official Google Ads API client library examples for the target language.

0 commit comments

Comments
 (0)