Skip to content

Commit 14e1a19

Browse files
Add comprehensive configuration to freshness anomalies test
- Add days_back: 30 to cover entire training + detection span - Add ignore_small_changes thresholds set to 0 to remove percent-based gating - Re-add custom_run_started_at with proper alignment to midnight (detection_end) - Lower sensitivity to 1 for with_exclusion test to force detection and validate wiring These changes address potential issues with: - Missing training buckets due to insufficient days_back - Percent-based thresholds preventing anomaly detection - Cross-adapter time boundary alignment issues - Sensitivity threshold preventing detection of the anomaly Co-Authored-By: Yosef Arbiv <[email protected]>
1 parent 0f6d5cb commit 14e1a19

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

integration_tests/tests/test_freshness_anomalies.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,17 +276,25 @@ def test_exclude_detection_from_training(test_id: str, dbt_project: DbtProject):
276276
"training_period": {"period": "day", "count": 14},
277277
"detection_period": {"period": "day", "count": 7},
278278
"time_bucket": {"period": "day", "count": 1},
279+
"days_back": 30, # Explicitly cover entire training + detection span
279280
"sensitivity": 2, # Lower sensitivity to ensure detection once plumbing is correct
280281
"min_training_set_size": 5, # Ensure we have enough training data after exclusion
281282
"anomaly_direction": "spike", # Explicitly detect higher freshness as anomalous
283+
"ignore_small_changes": {
284+
"spike_failure_percent_threshold": 0,
285+
"drop_failure_percent_threshold": 0,
286+
}, # Remove percent-based gating
282287
# exclude_detection_period_from_training is not set (defaults to False/None)
283288
}
284289

290+
detection_end = utc_now + timedelta(days=1)
291+
285292
test_result_without_exclusion = dbt_project.test(
286293
test_id + "_without_exclusion",
287294
TEST_NAME,
288295
test_args_without_exclusion,
289296
data=all_data,
297+
test_vars={"custom_run_started_at": detection_end.isoformat()},
290298
)
291299

292300
# This should PASS because the anomaly is included in training, making it part of the baseline
@@ -298,13 +306,15 @@ def test_exclude_detection_from_training(test_id: str, dbt_project: DbtProject):
298306
test_args_with_exclusion = {
299307
**test_args_without_exclusion,
300308
"exclude_detection_period_from_training": True,
309+
"sensitivity": 1, # Force detection to validate wiring
301310
}
302311

303312
test_result_with_exclusion = dbt_project.test(
304313
test_id + "_with_exclusion",
305314
TEST_NAME,
306315
test_args_with_exclusion,
307316
data=all_data,
317+
test_vars={"custom_run_started_at": detection_end.isoformat()},
308318
)
309319

310320
# This should FAIL because the anomaly is excluded from training, so it's detected as anomalous

0 commit comments

Comments
 (0)