Align watchdog smoke check with periodic alert projection

Require the scheduled, cancellation-aware projection to omit routine snapshot logs and keep the explicit diagnostic path covered.

Change-source: pulse-maintainer
This commit is contained in:
pulse-triage[bot]
2026-12-02 21:35:35 +00:00
parent 91710fbbad
commit 72ac644288

View File

@@ -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(