Data quality governance
Who can author data-quality tests, how custom_sql is admin-gated, how test runs are audited, and how failures reach on-call.
Data quality governance
The Data Quality panel is a top-level surface under Govern in the app: a running roll-up of every test’s most recent outcome, a recent-runs feed, and the entry point for authoring new tests and profiling columns. This page covers the governance angle - who is allowed to do what, what gets audited, and how failure signals leave the panel. For the authoring syntax and the full list of test kinds, read Tests, freshness, and data quality first.
You’ll learn:
- The difference between semantic tests (declared in
tests.yml, versioned in git) and custom tests (authored in the panel).- Which RBAC flags gate which operation, including why
custom_sqlrequiresallow_admin_policies.- The
pass/fail/error/unknownstatus vocabulary the API returns.- Which
data_quality.*events land in the audit log and what carries in eachdetail.- How Data Quality notifications are dispatched via
GONI_DQ_ALERT_WEBHOOK_URL, and why they are separate from the general alert engine.
Test authoring: semantic vs custom
Goni has two authoring surfaces for tests, and each has its own governance shape.
Semantic tests live in the semantic project’s tests.yml. They are edited like any other semantic-layer artifact - by a change to the YAML, committed to git, applied at compile time. Anyone with commit access to the semantic repo can add or remove them. This is the recommended path for tests that should follow the same review, PR, and rollback lifecycle as your models and metrics.
Custom tests are authored directly in the Data Quality panel via PUT /api/data_quality/tests/{id}. They persist to the Goni store (not to the semantic repo), so they take effect immediately and do not require a semantic recompile. This is the pragmatic path for tests an on-call engineer needs to add mid-incident, or for team-owned assertions that should not sit in the shared semantic repo.
Both surfaces converge on the same runner and the same result feed. A test is a test regardless of where it was authored; the split is about the edit lifecycle, not the runtime.
RBAC
Every operation on the Data Quality surface is gated. The gates are enforced server-side; the SPA also hides or disables the corresponding controls when the current role lacks the capability.
| Operation | HTTP | Required flag | Notes |
|---|---|---|---|
| Tenant roll-up | GET /api/data_quality | (authenticated) | Top-level Data Quality panel data. |
| Per-table roll-up | GET /api/data_quality/{table} | (authenticated) | Drill-down for one table. |
| List tests | GET /api/data_quality/tests | (authenticated) | Any signed-in user in the tenant. |
| Read recent runs | GET /api/data_quality/results | (authenticated) | Any signed-in user in the tenant. |
| Run one table | POST /api/data_quality/{table}/run | allow_save | Editor-level; matches “can change data” gates elsewhere. |
| Run all | POST /api/data_quality/run_all | allow_save | Same as per-table run. |
| Create or update a test | PUT /api/data_quality/tests/{id} | allow_save | Applies to every kind except custom_sql - see below. |
Create or update a custom_sql test | PUT /api/data_quality/tests/{id} with kind: custom_sql | allow_admin_policies | Elevated: the SQL runs verbatim against the warehouse, so authoring is admin-only. |
| Delete a test | DELETE /api/data_quality/tests/{id} | allow_save | Custom-authored tests only; semantic-project tests are removed by editing tests.yml. |
| Column profile | GET /api/data_quality/profile/{table} | allow_save | Runs an ad-hoc profiling query. |
The custom_sql elevation is deliberate. Unlike not_null, unique, accepted_values, row_count_min, row_count_max, and freshness - all of which the runner compiles from safe templates - a custom_sql test executes the caller-supplied SQL verbatim on the warehouse. Any editor who could author one could, in principle, exfiltrate data or run expensive queries under the tenant’s warehouse credentials. Restricting authorship to allow_admin_policies matches how the rest of Goni handles ad-hoc-SQL surfaces (see Access control for how allow_admin_policies composes with the other flags).
Note that the custom_sql gate is on authoring, not on execution. Once an admin has committed a custom_sql test, editor-role users can trigger it through run_table or run_all like any other test. This is intentional: the security review happens once, at authoring time, so the on-call rotation can still sweep the assertions without needing admin credentials.
Status vocabulary
Every run records a status against the test:
pass- the assertion held.fail- the assertion was evaluated and did not hold (rows failed anot_null, auniquehad duplicates, anaccepted_valuessaw an unexpected value, and so on).error- the runner could not evaluate the assertion at all (the query threw, the table did not exist, the warehouse timed out).unknown- roll-up shorthand for “no run has landed yet since the test was authored, so we have no signal to show.” Only appears at the per-test roll-up level; individual runs are always one of the first three.
A test declared with severity: warn still records pass / fail / error. The severity metadata is stored end-to-end so it round-trips through the API and the UI can filter on it; the runner treats a fail result on a warn-severity test the same as any other fail.
The status vocabulary is what GET /api/data_quality/results returns, and it is what any downstream automation (custom dashboards, CI gates, on-call rotations) should filter on. Do not filter on ok / warn / error - those are not the strings the API emits.
Audit coverage
Every mutating operation on the DQ surface writes an audit event through the same pipeline as the rest of the tenant’s mutations. See Audit and lineage for the query surface and secret-redaction posture.
| Action | Emitted by | target_kind / target_id | detail |
|---|---|---|---|
data_quality.put_test | Test authored or edited | test / <test-id> | Test payload (kind, table, column, severity). |
data_quality.delete_test | Custom test deleted | test / <test-id> | (empty) |
data_quality.run_table | Per-table sweep | table / <table> | {"count": N} where N is the number of runs produced. |
data_quality.run_all | Full sweep across the tenant | all / * | {"count": N, "deadline_hit": bool} |
data_quality.profile | Column profiler invoked | table / <table> | Profile parameters (columns sampled, limit). |
Custom-tests audit rows carry the full test payload in detail, so a compliance reviewer can reconstruct exactly what SQL was authorized and by whom. Scheduled runs do not emit audit events - only human-triggered runs do. This is deliberate: the scheduler sweeps hourly by default and would otherwise flood the log with noise. The per-run outcomes for scheduled sweeps still land in the DQ result feed (GET /api/data_quality/results), so no observability signal is lost.
Alerting posture
Data-quality failures are handled by the DQ subsystem, not by the general alert engine. On every scheduled sweep, the DQ scheduler compares each test’s latest run against the previous one; when the status flips from pass to fail on a test whose severity is not warn, Goni posts a Slack-shaped webhook payload to the URL you configure in GONI_DQ_ALERT_WEBHOOK_URL (with an optional HMAC signature when GONI_DQ_ALERT_WEBHOOK_SECRET is set). Tests declared with severity: warn suppress the fan-out: the transition is still logged for triage, but no channel is called. When the webhook URL is empty, the fan-out is disabled and the transition surfaces in the ops log only.
The dispatched destination is tenant-wide: every DQ failure fires the same webhook. Per-test channel routing is not offered today.
The general alert engine is deliberately kept separate because the two surfaces answer different questions. Alerts fire on numeric metric values crossing thresholds (“MRR dropped 10% week-over-week”, “queue depth exceeded 5000”); DQ notifications fire on assertion outcomes (“a not_null test on orders.customer_id started failing this hour”). Trying to shoehorn a test failure into the alert engine is not supported today - alerts require a semantic-layer metric name (not arbitrary SQL), and Goni does not ship a canonical dq_failing_tests metric to point them at.
For channel setup, credential storage, and the general alert model, see Alerts and scheduled reports.
Related
- Tests, freshness, and data quality - authoring syntax and the seven test kinds.
- Access control - the RBAC model that owns
allow_saveandallow_admin_policies. - Audit and lineage - how to query the
data_quality.*events. - Alerts and scheduled reports - the separate metric-threshold engine.
- REST API -
/api/data_quality/*endpoint reference.
Last updated