watcher: save and notify nothing for a cut-short port or TLS check (closes #185) #188

Merged
clawbot merged 1 commits from issue-185-cancelled-checks into next 2026-10-01 22:49:45 +02:00
Collaborator

Closes #185.

When shutdown cancels a check that is under way, the rest of the check runs on with the cancelled context. The resolver already drops a lookup the context cut short. Port and TLS checks did not: the cancelled connection attempt was saved as a closed port or a failed certificate check, and notified as Port Change or TLS Failure.

  • checkSinglePort and checkTLSCert return without saving or notifying when the context was cancelled by the time the check returns, the way the resolver's queryEachNS drops a cut-short query.
  • README shutdown step says so.

TestCancelledCheckSavesNothing saves a hostname at 127.0.0.1 with both ports open and a good certificate, then runs a check with the context already cancelled, using the real resolver and the real port and TLS checkers. It fails if either of the two new checks is removed.

Not shown by the diff:

  • A result is dropped whenever the context was cancelled by the time the check returned, even a success, as the resolver does. The next start checks again.

Disclosures:

  • Deviation from the plan: the test cancels the context before the check, not during a connection, and starts no local listener. The watcher checks only ports 80 and 443 and looks up DNS first, so a cancel mid-connection needs live DNS or new test hooks; the watcher code under test is the same.
  • Judgement call: one test covers the port and the TLS check, since one check runs both; it fails with either half of the fix removed.

Model: opus-5-5

Closes https://git.eeqj.de/sneak/dnswatcher/issues/185. When shutdown cancels a check that is under way, the rest of the check runs on with the cancelled context. The resolver already drops a lookup the context cut short. Port and TLS checks did not: the cancelled connection attempt was saved as a closed port or a failed certificate check, and notified as `Port Change` or `TLS Failure`. - `checkSinglePort` and `checkTLSCert` return without saving or notifying when the context was cancelled by the time the check returns, the way the resolver's `queryEachNS` drops a cut-short query. - README shutdown step says so. `TestCancelledCheckSavesNothing` saves a hostname at `127.0.0.1` with both ports open and a good certificate, then runs a check with the context already cancelled, using the real resolver and the real port and TLS checkers. It fails if either of the two new checks is removed. Not shown by the diff: - A result is dropped whenever the context was cancelled by the time the check returned, even a success, as the resolver does. The next start checks again. Disclosures: - Deviation from the plan: the test cancels the context before the check, not during a connection, and starts no local listener. The watcher checks only ports 80 and 443 and looks up DNS first, so a cancel mid-connection needs live DNS or new test hooks; the watcher code under test is the same. - Judgement call: one test covers the port and the TLS check, since one check runs both; it fails with either half of the fix removed. Model: opus-5-5
clawbot added the needs-review label 2026-10-01 22:43:25 +02:00
clawbot self-assigned this 2026-10-01 22:43:25 +02:00
clawbot added 1 commit 2026-10-01 22:43:25 +02:00
When shutdown cancels a check that is under way, the rest of the check
still runs with the cancelled context. The resolver already drops a
lookup the context cut short, but a cancelled connection attempt was
saved as a closed port or a failed certificate check and notified as
Port Change or TLS Failure. The watcher now drops a port or TLS check
result when its context was cancelled, the same way. The test runs a
check with the context already cancelled, using the real resolver and
the real port and TLS checkers; no query is sent and no connection is
made.

Model: opus-5-5
Author
Collaborator

Review passed on a860dd6.

Model: opus-5-5

Review passed on a860dd6. Model: opus-5-5
clawbot merged commit fe01cdda1e into next 2026-10-01 22:49:45 +02:00
clawbot deleted branch issue-185-cancelled-checks 2026-10-01 22:49:45 +02:00
clawbot removed the needs-review label 2026-10-01 22:49:46 +02:00
Sign in to join this conversation.