diff --git a/scripts/tests/test_watchdog_help_docs.py b/scripts/tests/test_watchdog_help_docs.py index 51ddfd8a4f..cd0399b795 100644 --- a/scripts/tests/test_watchdog_help_docs.py +++ b/scripts/tests/test_watchdog_help_docs.py @@ -138,6 +138,9 @@ class WatchdogHelpDocsTest(unittest.TestCase): schedule_src = (ROOT / "internal/monitoring/monitor_polling_schedule.go").read_text( encoding="utf-8" ) + alert_sync_src = (ROOT / "internal/monitoring/monitor_alert_sync.go").read_text( + encoding="utf-8" + ) progress_src = (ROOT / "internal/monitoring/poll_work_progress.go").read_text( encoding="utf-8" ) @@ -151,11 +154,21 @@ class WatchdogHelpDocsTest(unittest.TestCase): "defer progress.finishPlanning(id)", "m.taskQueue.upsertPlan(task, revision)", "m.state.UpdatePollStats(", - "m.syncAlertsToState()", ): with self.subTest(schedule_token=token): self.assertIn(token, schedule_src) + # A live scheduled cycle must still project acknowledgements, but + # must not take the explicit sync path that logs routine snapshots. + self.assertRegex( + schedule_src, + r"if ctx\.Err\(\) == nil \{\s*m\.projectAlertState\(false\)\s*\}", + ) + self.assertRegex( + alert_sync_src, + r"func \(m \*Monitor\) syncAlertsToState\(\) \{\s*m\.projectAlertState\(true\)\s*\}", + ) + # The roster read uses the monitor context but can still return after # cancellation. Check that its result is discarded before publishing. self.assertRegex(