config: watch a target listed twice only once (closes #207) #211

Merged
clawbot merged 1 commits from issue-207-dedupe-targets into next 2026-10-02 02:56:12 +02:00
Collaborator

Closes #207.

ClassifyTargets now skips a name it has already kept, so a target listed more than once in DNSWATCHER_TARGETS, in any letter case or with a trailing dot, is watched once: one lookup, one certificate check, and one expiry warning per TLS check instead of one per listing. (Port checks were already grouped by address and port, so they were never doubled.) The README's configuration section says so.

What the diff does not show:

  • Names are compared after the lower-casing and trailing-dot removal ClassifyTargets already did; surrounding spaces were already trimmed when the list was split. The first appearance sets a name's place in the list.
  • The saved state is keyed by name, so it never held a duplicate; nothing in an existing state file needs cleaning up.

Judgement call: the new test uses example.org where the file's other tests use example.com, because a fourth use of the same string in the file trips the linter's repeated-string check; this avoids adding a constant.

Model: opus-5-5

Closes https://git.eeqj.de/sneak/dnswatcher/issues/207. `ClassifyTargets` now skips a name it has already kept, so a target listed more than once in `DNSWATCHER_TARGETS`, in any letter case or with a trailing dot, is watched once: one lookup, one certificate check, and one expiry warning per TLS check instead of one per listing. (Port checks were already grouped by address and port, so they were never doubled.) The README's configuration section says so. What the diff does not show: - Names are compared after the lower-casing and trailing-dot removal `ClassifyTargets` already did; surrounding spaces were already trimmed when the list was split. The first appearance sets a name's place in the list. - The saved state is keyed by name, so it never held a duplicate; nothing in an existing state file needs cleaning up. Judgement call: the new test uses `example.org` where the file's other tests use `example.com`, because a fourth use of the same string in the file trips the linter's repeated-string check; this avoids adding a constant. Model: opus-5-5
clawbot added the needs-review label 2026-10-02 02:31:11 +02:00
clawbot self-assigned this 2026-10-02 02:31:11 +02:00
clawbot added 1 commit 2026-10-02 02:31:11 +02:00
ClassifyTargets kept a name every time it appeared in DNSWATCHER_TARGETS,
so example.com,Example.com. put example.com in the domain list twice and
every check looked it up, checked its ports and its certificates twice,
sending two expiry warnings per TLS check. It now skips a name it has
already kept, comparing after the lower-casing and trailing-dot removal
it already did; the list keeps the order of first appearance.

Model: opus-5-5
Author
Collaborator
  • The commit message says a name listed twice had "its ports" checked twice, and the PR body says the change brings "one port check ... instead of one per listing". Neither is true of the code: the port check in internal/watcher/watcher.go (checkAllPorts, which groups names by address and port in buildPortAssociations) already checks each address and port once, however many listed names lead to it. Only the lookups and the certificate checks, and so the expiry warnings, were doubled. Acceptable: the commit message's first sentence and the PR body's list name only what was doubled, without the ports.

Model: opus-5-5

- The commit message says a name listed twice had "its ports" checked twice, and the PR body says the change brings "one port check ... instead of one per listing". Neither is true of the code: the port check in `internal/watcher/watcher.go` (`checkAllPorts`, which groups names by address and port in `buildPortAssociations`) already checks each address and port once, however many listed names lead to it. Only the lookups and the certificate checks, and so the expiry warnings, were doubled. Acceptable: the commit message's first sentence and the PR body's list name only what was doubled, without the ports. Model: opus-5-5
clawbot added needs-rework and removed needs-review labels 2026-10-02 02:55:15 +02:00
Author
Collaborator

Finding in #211 (comment): the PR body and the landing commit message now name only what was doubled (lookups, certificate checks, expiry warnings), not the ports. Text only; no code changed.

Model: opus-5-5

Finding in https://git.eeqj.de/sneak/dnswatcher/pulls/211#issuecomment-110566: the PR body and the landing commit message now name only what was doubled (lookups, certificate checks, expiry warnings), not the ports. Text only; no code changed. Model: opus-5-5
clawbot merged commit 56c4395a39 into next 2026-10-02 02:56:12 +02:00
clawbot deleted branch issue-207-dedupe-targets 2026-10-02 02:56:12 +02:00
clawbot removed the needs-rework label 2026-10-02 02:56:15 +02:00
Sign in to join this conversation.