Load now gives an empty map to each of domains, hostnames, ports and certificates that the state file leaves out or holds as null. Before this, such a section loaded as a nil map. The first check then panicked writing into it, so a state file holding {} stopped the process at every start.
A state test loads {}, then a file missing each section in turn, and checks that every section is an empty map. A watcher test loads {}, and a file without the certificates section, runs the first check against live DNS through runChecks, and checks that the check saved domain, hostname, port and certificate entries. One added sentence in the README's State File Format section says what such a file loads as.
Judgement call: the watcher test loads two of the five files, not all five, since each runs a domain check against live DNS; the state test covers all five.
Judgement call: a file holding {} still loads with version 0. Nothing reads the version, so Load leaves it as it was loaded.
Model: opus-5-5
Fixes https://git.eeqj.de/sneak/dnswatcher/issues/267.
`Load` now gives an empty map to each of `domains`, `hostnames`, `ports` and `certificates` that the state file leaves out or holds as `null`. Before this, such a section loaded as a nil map. The first check then panicked writing into it, so a state file holding `{}` stopped the process at every start.
A state test loads `{}`, then a file missing each section in turn, and checks that every section is an empty map. A watcher test loads `{}`, and a file without the `certificates` section, runs the first check against live DNS through `runChecks`, and checks that the check saved domain, hostname, port and certificate entries. One added sentence in the README's State File Format section says what such a file loads as.
- Judgement call: the watcher test loads two of the five files, not all five, since each runs a domain check against live DNS; the state test covers all five.
- Judgement call: a file holding `{}` still loads with `version` 0. Nothing reads the version, so `Load` leaves it as it was loaded.
Model: opus-5-5
internal/state/state_test.go, TestLoadFileWithoutSections: the "Done when" of #267 asks for a test showing that the first check runs after loading {} or a file missing a section. This test calls the four setters and never runs a check. Live DNS is no reason to leave it out, because the watcher tests already run first checks against live DNS through runChecks, and its prepare function can write the state file and call Load. Acceptable: a watcher test that writes {}, and a file missing a section, to the state file, loads it in prepare, runs the first check with runChecks, and checks that the check saved domain, hostname, port and certificate entries.
The branch conflicts with current next in TODO.md Completed Steps only. Rebase, keeping every entry with this PR's on top.
Model: opus-5-5
Review: FAIL
- `internal/state/state_test.go`, `TestLoadFileWithoutSections`: the "Done when" of https://git.eeqj.de/sneak/dnswatcher/issues/267 asks for a test showing that the first check runs after loading `{}` or a file missing a section. This test calls the four setters and never runs a check. Live DNS is no reason to leave it out, because the watcher tests already run first checks against live DNS through `runChecks`, and its `prepare` function can write the state file and call `Load`. Acceptable: a watcher test that writes `{}`, and a file missing a section, to the state file, loads it in `prepare`, runs the first check with `runChecks`, and checks that the check saved domain, hostname, port and certificate entries.
- The branch conflicts with current `next` in `TODO.md` Completed Steps only. Rebase, keeping every entry with this PR's on top.
Model: opus-5-5
Load fills in each of domains, hostnames, ports and certificates that
the file leaves out or holds as null with an empty map. Before, such a
section loaded as a nil map, and the first check's write into it
panicked, so a state file holding {} stopped the watcher at every
start.
A state test loads {} and a file missing each section in turn, and
checks that every section is an empty map. A watcher test loads {}, and
a file without the certificates section, runs the first check against
live DNS, and checks that it saved domain, hostname, port and
certificate entries.
Model: opus-5-5
First check: new watcher test TestFirstCheckAfterLoadingFileWithoutSections writes {}, and a file without the certificates section, loads it in prepare, runs the first check with runChecks, and checks that domain, hostname, port and certificate entries were saved. TestLoadFileWithoutSections now only checks the empty maps.
TODO.md: rebased onto current next; every Completed Steps entry kept, this PR's on top.
Model: opus-5-5
Rework:
- First check: new watcher test `TestFirstCheckAfterLoadingFileWithoutSections` writes `{}`, and a file without the `certificates` section, loads it in `prepare`, runs the first check with `runChecks`, and checks that domain, hostname, port and certificate entries were saved. `TestLoadFileWithoutSections` now only checks the empty maps.
- `TODO.md`: rebased onto current `next`; every Completed Steps entry kept, this PR's on top.
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 #267.
Loadnow gives an empty map to each ofdomains,hostnames,portsandcertificatesthat the state file leaves out or holds asnull. Before this, such a section loaded as a nil map. The first check then panicked writing into it, so a state file holding{}stopped the process at every start.A state test loads
{}, then a file missing each section in turn, and checks that every section is an empty map. A watcher test loads{}, and a file without thecertificatessection, runs the first check against live DNS throughrunChecks, and checks that the check saved domain, hostname, port and certificate entries. One added sentence in the README's State File Format section says what such a file loads as.{}still loads withversion0. Nothing reads the version, soLoadleaves it as it was loaded.Model: opus-5-5
Review: FAIL
internal/state/state_test.go,TestLoadFileWithoutSections: the "Done when" of #267 asks for a test showing that the first check runs after loading{}or a file missing a section. This test calls the four setters and never runs a check. Live DNS is no reason to leave it out, because the watcher tests already run first checks against live DNS throughrunChecks, and itspreparefunction can write the state file and callLoad. Acceptable: a watcher test that writes{}, and a file missing a section, to the state file, loads it inprepare, runs the first check withrunChecks, and checks that the check saved domain, hostname, port and certificate entries.nextinTODO.mdCompleted Steps only. Rebase, keeping every entry with this PR's on top.Model: opus-5-5
Load fills in each of domains, hostnames, ports and certificates that the file leaves out or holds as null with an empty map. Before, such a section loaded as a nil map, and the first check's write into it panicked, so a state file holding {} stopped the watcher at every start. A state test loads {} and a file missing each section in turn, and checks that every section is an empty map. A watcher test loads {}, and a file without the certificates section, runs the first check against live DNS, and checks that it saved domain, hostname, port and certificate entries. Model: opus-5-5d6f6132951to83b68923d9Rework:
TestFirstCheckAfterLoadingFileWithoutSectionswrites{}, and a file without thecertificatessection, loads it inprepare, runs the first check withrunChecks, and checks that domain, hostname, port and certificate entries were saved.TestLoadFileWithoutSectionsnow only checks the empty maps.TODO.md: rebased onto currentnext; every Completed Steps entry kept, this PR's on top.Model: opus-5-5
Review: PASS
Model: opus-5-5