You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(spec): widen AnalyticsResultResponseSchema and TriggerFlowResponseSchema data to producer-contract parity (#13184)
* fix(spec): widen AnalyticsResultResponseSchema and TriggerFlowResponseSchema data to producer-contract parity
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LpRNHxWZgSUgVnFT9mQQo4
* chore(spec): regenerate reference docs, strictness ledger and import-surface baseline
Tooling output of the schema widening, not hand-written:
- `gen:docs` re-renders the analytics/automation-api reference pages with the
newly declared members and the now-importable `AnalyticsResultResponse`.
- `gen:strictness-ledger` moves the `api/` unknown-key site count 444 -> 448.
- `--update-import-baseline` discharges the shrink-only ratchet entry
`api/AnalyticsResultResponse — no type export`: the gap the card names is
closed, and a stale line would stay available to excuse the next one.
---------
Co-authored-by: Claude <noreply@anthropic.com>
Widen two route response schemas to parity with the producer contracts their routes relay. `AnalyticsResultResponseSchema.data` now declares everything `AnalyticsResult` declares — `fields[].label` / `format` / `currency` / `percentScale` (the renderer chains) and `totals` (the marginal-aggregate channel) — and `TriggerFlowResponseSchema.data` now declares everything `AutomationResult` declares, including the paused screen-flow state (`status` / `runId` / `screen`), the closed `code` classification, the friendly terminal messages and the run `summary`. Both parities are pinned schema ≡ contract at compile time, so the two sources can no longer drift apart silently. `AnalyticsResultResponse` / `AnalyticsResultResponseParsed` are now exported: the schema previously had no nameable response type at all. This is an accept-set widening with zero wire change — every payload that parsed before still parses, and the served keys the schemas used to silently strip (a paused run's `runId` and `screen`, a measure's `label`) now survive a parse. The client SDK's `analytics.query` / `automation.trigger` docblocks are refreshed to record the new state; their bindings still target the producer contracts and are unchanged.
|**totals**|`{ dimensions: string[]; rows: Record<string, any>[] }[]`| optional | Marginal aggregates - one entry per requested totals grouping, in request order, each computed with the measure's true aggregate over the underlying data (never re-derived from bucketed values). The grand-total grouping yields a single dimensionless row. |
@@ -606,6 +606,13 @@ const result = AutomationApiErrorCode.parse(data);
606
606
|**output**|`any`| optional | Output data from the automation |
607
607
|**error**|`string`| optional | Error message if execution failed |
608
608
|**durationMs**|`number`| optional | Execution duration in milliseconds |
609
+
|**code**|`Enum<'PERMISSION_DENIED' \| 'INVALID_SIGNAL' \| 'RUN_NOT_FOUND' \| 'STORE_UNAVAILABLE' \| …>`| optional | Machine-readable failure classification, set alongside `error` when the caller must distinguish WHY it failed. A closed union - the members and their transport mappings are documented on the contract (`AutomationResult.code`, contracts/automation-service.ts). |
610
+
|**status**|`Enum<'completed' \| 'paused' \| 'failed'>`| optional | Lifecycle status. `paused` means the run suspended at a node and can be continued with the resume route. Absent or `completed`/`failed` means the run reached a terminal state. |
611
+
|**runId**|`string`| optional | Run id - set when `status` is `paused`, so callers can resume it |
612
+
|**screen**|`{ nodeId: string; title?: string; description?: string; fields: object[]; … }`| optional | The screen to render - set when the run paused at a `screen` node awaiting user input. The client collects values for `screen.fields` and resumes the run with them. |
613
+
|**successMessage**|`string`| optional | Friendly terminal message copied from the flow definition on terminal success, so a screen-flow runner can show a meaningful toast |
614
+
|**errorMessage**|`string`| optional | Friendly terminal message copied from the flow definition on failure |
615
+
|**summary**|`{ selected: integer; acted: integer; skipped: integer; unmeasured?: integer; … }`| optional | What the run did - records selected / acted on, gate skips, per-node status. Set on a TERMINAL result (a paused run has not finished doing it yet). |
0 commit comments