Run sent the startup notification right after the first scan without looking at the context. RunOnce returns as usual when shutdown cuts the scan short, so stopping dnswatcher during its first scan sent "dnswatcher has started and completed its initial scan" to every endpoint as it shut down. Run now sends it only when the context was not cancelled; a scan that ran to the end still sends it, as TestSendTestNotification_ViaRun checks.
The new test, TestStopBeforeFirstScanSendsNoStartupNotification, runs a watcher configured with a hostname, the real resolver and the setting on, with its context already cancelled, and checks that nothing was notified. The resolver drops the lookup without sending a query, so the test sends no DNS traffic.
Judgement call: the test stops the watcher before the first scan, not part way through it. A stop part way through reaches the same check after RunOnce, and a test cancelling mid-scan would depend on timing.
Model: opus-5-5
Fixes https://git.eeqj.de/sneak/dnswatcher/issues/271.
`Run` sent the startup notification right after the first scan without looking at the context. `RunOnce` returns as usual when shutdown cuts the scan short, so stopping dnswatcher during its first scan sent "dnswatcher has started and completed its initial scan" to every endpoint as it shut down. `Run` now sends it only when the context was not cancelled; a scan that ran to the end still sends it, as `TestSendTestNotification_ViaRun` checks.
The new test, `TestStopBeforeFirstScanSendsNoStartupNotification`, runs a watcher configured with a hostname, the real resolver and the setting on, with its context already cancelled, and checks that nothing was notified. The resolver drops the lookup without sending a query, so the test sends no DNS traffic.
Judgement call: the test stops the watcher before the first scan, not part way through it. A stop part way through reaches the same check after `RunOnce`, and a test cancelling mid-scan would depend on timing.
Model: opus-5-5
Run sent the startup notification right after the first scan without
checking the context. RunOnce returns as usual when shutdown cuts the
scan short, so a stop during the first scan sent "has started and
completed its initial scan" to every endpoint as the process shut down.
Run now sends it only when the context was not cancelled.
The new test cancels the context before Run starts, so the scan never
sends its lookup; a stop part way through a scan follows the same path.
Model: opus-5-5
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Fixes #271.
Runsent the startup notification right after the first scan without looking at the context.RunOncereturns as usual when shutdown cuts the scan short, so stopping dnswatcher during its first scan sent "dnswatcher has started and completed its initial scan" to every endpoint as it shut down.Runnow sends it only when the context was not cancelled; a scan that ran to the end still sends it, asTestSendTestNotification_ViaRunchecks.The new test,
TestStopBeforeFirstScanSendsNoStartupNotification, runs a watcher configured with a hostname, the real resolver and the setting on, with its context already cancelled, and checks that nothing was notified. The resolver drops the lookup without sending a query, so the test sends no DNS traffic.Judgement call: the test stops the watcher before the first scan, not part way through it. A stop part way through reaches the same check after
RunOnce, and a test cancelling mid-scan would depend on timing.Model: opus-5-5
Review: PASS
Needs rebase: TODO.md only
Model: opus-5-5
2555714086tobb343bd44d