Generate readiness checks
generate_checksGenerate SQL readiness checks for mapped revenue datasets, run them, and pass the result rows back to get pass/fail per check and metric; then use plan_fixes for ranked fixes.
Instructions
The readiness checks the GASP Standard states, as SQL over the datasets your mapping covers (readiness level 3, the Check step). From cel.md, atl.md and the MRR definition: CEL row identity (prior_mrr + mrr_change = new_mrr on every revenue event), MRR continuity (a subscription's mrr_start equals its mrr on the previous snapshot), the year-or-renewal test (no subscription row and no contract ACV for a contract under 12 months with no renewal), unique event_id per event dataset, the ATL tags (one lifecycle_attribution per event, an expansion_classification on every expansion, contraction and reactivation revenue event and every amendment, a cost_function on every cost event), customer identity both ways (every revenue event's customer is a known customer, every customer active on the latest snapshot has a revenue event), the credit ledger's balance identity (credit_balance_before + credit_amount = credit_balance_after on purchase, expiry, adjustment and committed consumption rows; equal balances on overage and on-demand rows), freshness (the latest date per dataset within a window) and, for every fully mapped metric with a hard range rule in the ontology (NRR at least 0, GRR at most 100%, Gross Margin, ARR and others), its value in every reporting period of your period spine (the table compile_model reads; period_spine names another). One statement, one row per check with its violation count; output: bundle adds a schema snapshot query for a scheduled re-check. GASP has no warehouse access: run it, then pass the rows back as results to get pass or fail per check and per metric; each check names the metrics whose formulas read what it covers. Checks whose fields the mapping lacks are listed with what they need. Takes the mapping generate_query takes; the dialect is the one asked for, else the warehouse's, else postgres. Follow with plan_fixes for the ranked list.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"adapter": "<adapter>"
},
"name": "generate_checks"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| as_of | No | The date freshness is measured from, as YYYY-MM-DD. Default: the warehouse's current date. | |
| output | No | 'report' (default): the checks, what each protects and the SQL to run (or, with results, pass and fail per check and per metric); 'sql': the statement alone; 'json': the report as data; 'bundle': the scheduled re-check, the checks statement and a schema snapshot query over the mapped tables as two files to run in your own orchestrator, with how to pass the rows back to readiness_report. | |
| window | No | Freshness window in days (default 2): the latest date in each dataset must be within this many days of as_of. | |
| adapter | Yes | Your mapping as text: a GASP adapter (JSON; schema: https://gaspwiki.com/schemas/gasp-adapter-v1.json) or an Ossie mapping document (YAML or JSON). Check it with validate_mapping first. | |
| dialect | No | SQL dialect: postgres (also Redshift), snowflake, bigquery or databricks. Omit to use the adapter's warehouse when it names one of them, else postgres. | |
| results | No | The rows the checks statement returned, as JSON (objects with check_id and violations, [check_id, violations] pairs, or an object keyed by check id) or CSV. With results the report gives pass or fail per check and per metric. | |
| period_spine | No | The table of (period_start, period_end) rows the range checks evaluate each metric over, as it is named in your warehouse; the same table compile_model reads. Default gasp.period_spine. | |
| semantic_model | No | With an Ossie mapping: your semantic model document (YAML or JSON), so table names and field expressions resolve. Ignored for a GASP adapter. |