What changed.parseCSV in cmd/asinfo-gen used to skip a record on any read error. A broken download of as.csv makes the response body return the same error on every read, so the generator logged "Error reading CSV record" forever. Now it skips only a record that does not parse, a csv.ParseError. Any other read error is returned, so main exits non-zero and script/asupdate keeps the old list.
Test.TestParseCSVStopsWhenTheDownloadBreaksOff gives parseCSV a header and one record, then a reader that fails with io.ErrUnexpectedEOF on every call. A cut-off HTTP body gives that error. The test runs parseCSV on its own goroutine and gives up after two seconds, so the old code fails the test instead of hanging it.
Disclosures.
Judgement call: the check uses errors.AsType, the generic form of errors.As, because the linter asks for it.
Judgement call: README.md is unchanged. Its text on script/asupdate already says the old list stays whenever the generator fails.
Model: opus-5-5
Fixes https://git.eeqj.de/sneak/routewatch/issues/177.
**What changed.** `parseCSV` in `cmd/asinfo-gen` used to skip a record on any read error. A broken download of `as.csv` makes the response body return the same error on every read, so the generator logged "Error reading CSV record" forever. Now it skips only a record that does not parse, a `csv.ParseError`. Any other read error is returned, so `main` exits non-zero and `script/asupdate` keeps the old list.
**Test.** `TestParseCSVStopsWhenTheDownloadBreaksOff` gives `parseCSV` a header and one record, then a reader that fails with `io.ErrUnexpectedEOF` on every call. A cut-off HTTP body gives that error. The test runs `parseCSV` on its own goroutine and gives up after two seconds, so the old code fails the test instead of hanging it.
**Disclosures.**
- Judgement call: the check uses `errors.AsType`, the generic form of `errors.As`, because the linter asks for it.
- Judgement call: `README.md` is unchanged. Its text on `script/asupdate` already says the old list stays whenever the generator fails.
Model: opus-5-5
cmd/asinfo-gen/main_test.go: no test checks that a record that does not parse is still logged and skipped. #177 requires that skip to stay, and the new csv.ParseError check in parseCSV (cmd/asinfo-gen/main.go, line 113) is what keeps it. If that check stopped matching, parseCSV would end on the first such record and every test would still pass. Acceptable: a test that parses an as.csv with a record that does not parse, such as one with too few fields, between two valid records, and expects both valid ASes back with no error.
Judgement call: the issue's definition of done names only the broken-download test. I ask for this one too because the issue names the skip as required behaviour and this change rewrites the check that keeps it.
Model: opus-5-5
**FAIL** (needs-rework)
- `cmd/asinfo-gen/main_test.go`: no test checks that a record that does not parse is still logged and skipped. https://git.eeqj.de/sneak/routewatch/issues/177 requires that skip to stay, and the new `csv.ParseError` check in `parseCSV` (`cmd/asinfo-gen/main.go`, line 113) is what keeps it. If that check stopped matching, `parseCSV` would end on the first such record and every test would still pass. Acceptable: a test that parses an `as.csv` with a record that does not parse, such as one with too few fields, between two valid records, and expects both valid ASes back with no error.
Judgement call: the issue's definition of done names only the broken-download test. I ask for this one too because the issue names the skip as required behaviour and this change rewrites the check that keeps it.
Model: opus-5-5
parseCSV skipped a record on any read error and asked for the next one.
When the download of as.csv broke off, the response body returned the
same error on every read, so the generator logged it forever and make
asupdate never finished.
parseCSV now skips only a record that does not parse, a csv.ParseError.
Any other read error ends it with that error, so the generator exits
non-zero and script/asupdate keeps the old list.
Model: opus-5-5
Fixed: TestParseCSVSkipsARecordThatDoesNotParse in cmd/asinfo-gen/main_test.go, amended into the one commit.
Model: opus-5-5
Rework for https://git.eeqj.de/sneak/routewatch/pulls/178#issuecomment-157532:
- Fixed: `TestParseCSVSkipsARecordThatDoesNotParse` in `cmd/asinfo-gen/main_test.go`, amended into the one commit.
Model: opus-5-5
PASS: parseCSV now skips only a record that does not parse and ends with an error on any other read failure, and TestParseCSVSkipsARecordThatDoesNotParse fixes the finding of #178 (comment).
Model: opus-5-5
**PASS**: `parseCSV` now skips only a record that does not parse and ends with an error on any other read failure, and `TestParseCSVSkipsARecordThatDoesNotParse` fixes the finding of https://git.eeqj.de/sneak/routewatch/pulls/178#issuecomment-157532.
Model: opus-5-5
clawbot
merged commit cd1b9b94a4 into next2026-10-27 03:10:41 +01:00
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 #177.
What changed.
parseCSVincmd/asinfo-genused to skip a record on any read error. A broken download ofas.csvmakes the response body return the same error on every read, so the generator logged "Error reading CSV record" forever. Now it skips only a record that does not parse, acsv.ParseError. Any other read error is returned, somainexits non-zero andscript/asupdatekeeps the old list.Test.
TestParseCSVStopsWhenTheDownloadBreaksOffgivesparseCSVa header and one record, then a reader that fails withio.ErrUnexpectedEOFon every call. A cut-off HTTP body gives that error. The test runsparseCSVon its own goroutine and gives up after two seconds, so the old code fails the test instead of hanging it.Disclosures.
errors.AsType, the generic form oferrors.As, because the linter asks for it.README.mdis unchanged. Its text onscript/asupdatealready says the old list stays whenever the generator fails.Model: opus-5-5
FAIL (needs-rework)
cmd/asinfo-gen/main_test.go: no test checks that a record that does not parse is still logged and skipped. #177 requires that skip to stay, and the newcsv.ParseErrorcheck inparseCSV(cmd/asinfo-gen/main.go, line 113) is what keeps it. If that check stopped matching,parseCSVwould end on the first such record and every test would still pass. Acceptable: a test that parses anas.csvwith a record that does not parse, such as one with too few fields, between two valid records, and expects both valid ASes back with no error.Judgement call: the issue's definition of done names only the broken-download test. I ask for this one too because the issue names the skip as required behaviour and this change rewrites the check that keeps it.
Model: opus-5-5
7e1c6f9598to772a5c6ba3Rework for #178 (comment):
TestParseCSVSkipsARecordThatDoesNotParseincmd/asinfo-gen/main_test.go, amended into the one commit.Model: opus-5-5
PASS:
parseCSVnow skips only a record that does not parse and ends with an error on any other read failure, andTestParseCSVSkipsARecordThatDoesNotParsefixes the finding of #178 (comment).Model: opus-5-5