From 42c93b6ca17599863e6ee9d74bb16fbb9756dba2 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Tue, 3 Mar 2026 12:51:20 +0000 Subject: [PATCH 1/3] fix: restore missing test_config_levels macro and fix uniques typo in e2e project - Add test_config_levels generic test macro that was removed from dbt-data-reliability in PR #947 but still referenced by the e2e project - Fix 'uniques' -> 'unique' (standard dbt generic test) on error_model Co-Authored-By: Itamar Hartstein --- .../generic_tests/test_config_levels.sql | 53 +++++++++++++++++++ tests/e2e_dbt_project/models/schema.yml | 2 +- 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 tests/e2e_dbt_project/macros/generic_tests/test_config_levels.sql diff --git a/tests/e2e_dbt_project/macros/generic_tests/test_config_levels.sql b/tests/e2e_dbt_project/macros/generic_tests/test_config_levels.sql new file mode 100644 index 000000000..ace79fda8 --- /dev/null +++ b/tests/e2e_dbt_project/macros/generic_tests/test_config_levels.sql @@ -0,0 +1,53 @@ +{% test config_levels(model, expected_config, timestamp_column, time_bucket, where_expression, anomaly_sensitivity, anomaly_direction, days_back, backfill_days, seasonality, min_training_set_size) %} + {%- if execute and elementary.is_test_command() %} + {%- set unexpected_config = [] %} + {%- set model_relation = dbt.load_relation(model) %} + + {% set configuration_dict, metric_properties_dict = + elementary.get_anomalies_test_configuration(model_relation, + mandatory_params, + timestamp_column, + where_expression, + anomaly_sensitivity, + anomaly_direction, + min_training_set_size, + time_bucket, + days_back, + backfill_days, + seasonality) %} + + {%- set configs_to_test = [('timestamp_column', metric_properties_dict.timestamp_column), + ('where_expression', metric_properties_dict.where_expression), + ('time_bucket', configuration_dict.time_bucket), + ('anomaly_sensitivity', configuration_dict.anomaly_sensitivity), + ('anomaly_direction', configuration_dict.anomaly_direction), + ('min_training_set_size', configuration_dict.min_training_set_size), + ('days_back', configuration_dict.days_back), + ('backfill_days', configuration_dict.backfill_days), + ('seasonality', configuration_dict.seasonality) + ] %} + + {%- for config in configs_to_test %} + {%- set config_name, config_value = config %} + {%- set config_check = compare_configs(config_name, config_value, expected_config) %} + {%- if config_check %} + {%- do unexpected_config.append(config_check) -%} + {%- endif %} + {%- endfor %} + + {%- if unexpected_config | length > 0 %} + {%- do exceptions.raise_compiler_error('Failure config_levels: ' ~ unexpected_config) -%} + {%- else %} + {#- test must run an sql query -#} + {{ elementary.no_results_query() }} + {%- endif %} + {%- endif %} +{%- endtest %} + +{% macro compare_configs(config_name, config, expected_config) %} + {%- if config != expected_config.get(config_name) %} + {%- set unexpected_message = ('For {0} - got config: {1}, expected config: {2}').format(config_name, config, expected_config.get(config_name) ) %} + {{ return(unexpected_message) }} + {%- endif %} + {{ return(none) }} +{% endmacro %} diff --git a/tests/e2e_dbt_project/models/schema.yml b/tests/e2e_dbt_project/models/schema.yml index 31f376284..6aa472e0d 100644 --- a/tests/e2e_dbt_project/models/schema.yml +++ b/tests/e2e_dbt_project/models/schema.yml @@ -150,7 +150,7 @@ models: columns: - name: "missing_column" tests: - - uniques: + - unique: tags: ["error_test", "regular_tests"] - name: backfill_days_column_anomalies From f2d740b9e1c4f1e339277675d0f8b4a4ed57d69f Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Tue, 3 Mar 2026 12:58:49 +0000 Subject: [PATCH 2/3] fix: revert uniques change - intentional error case for error_model The 'uniques' test (non-existent) on error_model.missing_column was intentionally creating a compilation error case, tagged as error_test. Co-Authored-By: Itamar Hartstein --- tests/e2e_dbt_project/models/schema.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e_dbt_project/models/schema.yml b/tests/e2e_dbt_project/models/schema.yml index 6aa472e0d..31f376284 100644 --- a/tests/e2e_dbt_project/models/schema.yml +++ b/tests/e2e_dbt_project/models/schema.yml @@ -150,7 +150,7 @@ models: columns: - name: "missing_column" tests: - - unique: + - uniques: tags: ["error_test", "regular_tests"] - name: backfill_days_column_anomalies From 9f68a6f2a1bebba6eb37e91fcc4744adbf915989 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Tue, 3 Mar 2026 13:00:41 +0000 Subject: [PATCH 3/3] fix: define mandatory_params as none in test_config_levels macro The macro calls elementary.get_anomalies_test_configuration() with mandatory_params but it was never defined in scope. In the original dbt-data-reliability code, this was a parameter on the calling test macros. Since test_config_levels doesn't need mandatory param validation, define it locally as none. Co-Authored-By: Itamar Hartstein --- .../e2e_dbt_project/macros/generic_tests/test_config_levels.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/e2e_dbt_project/macros/generic_tests/test_config_levels.sql b/tests/e2e_dbt_project/macros/generic_tests/test_config_levels.sql index ace79fda8..37ab827d0 100644 --- a/tests/e2e_dbt_project/macros/generic_tests/test_config_levels.sql +++ b/tests/e2e_dbt_project/macros/generic_tests/test_config_levels.sql @@ -2,6 +2,7 @@ {%- if execute and elementary.is_test_command() %} {%- set unexpected_config = [] %} {%- set model_relation = dbt.load_relation(model) %} + {%- set mandatory_params = none %} {% set configuration_dict, metric_properties_dict = elementary.get_anomalies_test_configuration(model_relation,