Declare run expectations
declare_run_expectationsSpecify the criteria a run's final ping body must meet, so the run doesn't self-grade and failures are logged as assertion errors.
Instructions
Requires the write scope or higher. Declares, at the start of a run, the criteria its success ping body is judged by when the run closes, so the run does not grade itself: a success whose body fails any declared criterion is recorded as a failed run with cause 'assertion', whatever the exit code. One declaration per rid, immutable (a second call is a conflict). For use right after the run's /start ping; get_ping_instructions' expectations_how_to has a worked example.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rid | Yes | The run id exactly as sent on this run's /start ping, the same rid used on every step and the terminal ping. | |
| check_id | Yes | Monitor UUID (from create_monitor or list_monitors). | |
| assertions | Yes | The run's complete criteria, as a JSON array string, e.g. '[{"kind":"json_path","path":"result.rows_processed","op":"gt","value":"0"}]'. Fields: kind (required), value, path, op; no name. kind: contains, not_contains, matches (RE2, max 1000 bytes) or json_path (the value at a dotted path, e.g. 'a.b.c', compared with op: eq, ne, gt, gte, lt, lte). Only not_contains entries, or a matches pattern that accepts an empty body ('.*', '^$'), pass on empty output; a contains, json_path or empty-rejecting matches entry catches a run that produced nothing. At most 20; one malformed entry rejects the whole declaration. Runs with no declaration keep the monitor's own assertions. |