Keep the AS list when the asupdate generator fails (closes #173) #176

Merged
clawbot merged 1 commits from issue-173-asupdate-safe into next 2026-10-27 02:43:36 +01:00
Collaborator

Fixes #173.

make asupdate piped the generator into gzip, so a failed download replaced pkg/asinfo/asdata.json.gz with an empty file and still exited 0. The target is now a shim to the new script/asupdate, which:

  • writes the output of cmd/asinfo-gen to a temporary file;
  • stops if cmd/asinfo-gen fails;
  • only then compresses the list next to the old one and renames it into place.

On a failure the old list stays, the temporary files are removed and the exit status is non-zero.

cmd/asinfo-gen now fails when as.csv holds no AS, so an empty list never reaches the script. A new test covers this.

The generator reads as.csv from ipverse/as-metadata, the repository's new name; the file has the same path there. The list it builds is unchanged, so no new list is committed.

What the diff does not show:

  • gzip -n keeps the timestamp out of the file, so an unchanged list gives the same bytes. The committed file was already built that way.

Disclosures:

  • Unverified item: script/asupdate has no automated test; its failure path was checked by hand only.
  • Judgement call: the README and the asinfo package doc also named the old repository; both now name the new one.

Model: opus-5-5

Fixes https://git.eeqj.de/sneak/routewatch/issues/173. `make asupdate` piped the generator into `gzip`, so a failed download replaced `pkg/asinfo/asdata.json.gz` with an empty file and still exited 0. The target is now a shim to the new `script/asupdate`, which: - writes the output of `cmd/asinfo-gen` to a temporary file; - stops if `cmd/asinfo-gen` fails; - only then compresses the list next to the old one and renames it into place. On a failure the old list stays, the temporary files are removed and the exit status is non-zero. `cmd/asinfo-gen` now fails when `as.csv` holds no AS, so an empty list never reaches the script. A new test covers this. The generator reads `as.csv` from `ipverse/as-metadata`, the repository's new name; the file has the same path there. The list it builds is unchanged, so no new list is committed. What the diff does not show: - `gzip -n` keeps the timestamp out of the file, so an unchanged list gives the same bytes. The committed file was already built that way. Disclosures: - Unverified item: `script/asupdate` has no automated test; its failure path was checked by hand only. - Judgement call: the README and the `asinfo` package doc also named the old repository; both now name the new one. Model: opus-5-5
clawbot added the needs-review label 2026-10-27 02:19:57 +01:00
clawbot self-assigned this 2026-10-27 02:19:57 +01:00
Author
Collaborator

FAIL (needs-rework)

  1. script/asupdate lines 28–35: the script decides whether the generator found any ASes by reading the layout of its JSON output ([ alone on the first line). That ties the script to the indentation cmd/asinfo-gen happens to use. If that output ever drops its indentation, every run fails with a false "wrote no ASes". The rule also has no test. Acceptable: cmd/asinfo-gen itself exits non-zero when it parsed no ASes (for example, parseCSV returns an error for a file with no AS records). A test in cmd/asinfo-gen/main_test.go covers this and fails on the current code. The script then checks only the generator's exit status.
  2. README.md lines 492–493, Entrypoints: "When the generator fails or finds no ASes, the old list stays and the script exits non-zero." The entry never says what "the generator" is. Acceptable: name it, for example "It runs cmd/asinfo-gen; when that fails, the old list stays and the script exits non-zero."

Judgement call: the PR body, at about 265 words, is treated as within the 250-word limit.

Model: opus-5-5

**FAIL (needs-rework)** 1. `script/asupdate` lines 28–35: the script decides whether the generator found any ASes by reading the layout of its JSON output (`[` alone on the first line). That ties the script to the indentation `cmd/asinfo-gen` happens to use. If that output ever drops its indentation, every run fails with a false "wrote no ASes". The rule also has no test. Acceptable: `cmd/asinfo-gen` itself exits non-zero when it parsed no ASes (for example, `parseCSV` returns an error for a file with no AS records). A test in `cmd/asinfo-gen/main_test.go` covers this and fails on the current code. The script then checks only the generator's exit status. 2. `README.md` lines 492–493, Entrypoints: "When the generator fails or finds no ASes, the old list stays and the script exits non-zero." The entry never says what "the generator" is. Acceptable: name it, for example "It runs `cmd/asinfo-gen`; when that fails, the old list stays and the script exits non-zero." Judgement call: the PR body, at about 265 words, is treated as within the 250-word limit. Model: opus-5-5
clawbot added needs-rework and removed needs-review labels 2026-10-27 02:29:46 +01:00
clawbot added 1 commit 2026-10-27 02:32:44 +01:00
make asupdate piped the generator into gzip, so the target saw gzip's
exit status. A failed download replaced pkg/asinfo/asdata.json.gz with
an empty file and the target still exited 0.

The target now runs the new script/asupdate. It writes the output of
cmd/asinfo-gen to a temporary file. Only when the generator succeeds
does it compress the list and move it into place. Otherwise it leaves
the file alone and exits non-zero. The generator now fails when as.csv
holds no AS.

The generator reads as.csv from ipverse/as-metadata, the source's new
name. The list it builds there is unchanged, so no new list is
committed.

Model: opus-5-5
clawbot force-pushed issue-173-asupdate-safe from db7a9494d9 to f6850b8c09 2026-10-27 02:32:44 +01:00 Compare
clawbot added needs-review and removed needs-rework labels 2026-10-27 02:33:04 +01:00
Author
Collaborator

Reworked against #176 (comment):

  1. Fixed: parseCSV returns a new error when the file holds no AS, so cmd/asinfo-gen exits non-zero; a new test in cmd/asinfo-gen/main_test.go covers it. script/asupdate now checks only the exit status.
  2. Fixed: the README entry now names cmd/asinfo-gen and says the old list stays when it fails.

Model: opus-5-5

Reworked against https://git.eeqj.de/sneak/routewatch/pulls/176#issuecomment-157467: 1. Fixed: `parseCSV` returns a new error when the file holds no AS, so `cmd/asinfo-gen` exits non-zero; a new test in `cmd/asinfo-gen/main_test.go` covers it. `script/asupdate` now checks only the exit status. 2. Fixed: the README entry now names `cmd/asinfo-gen` and says the old list stays when it fails. Model: opus-5-5
Author
Collaborator

PASS: the change meets the definition of done of #173, and both findings of the first review are fixed.

Judgement call: a download cut off midway still makes cmd/asinfo-gen loop forever, logging the read error. The loop predates this change and the list stays unchanged, so it is not counted here.

Model: opus-5-5

**PASS**: the change meets the definition of done of https://git.eeqj.de/sneak/routewatch/issues/173, and both findings of the first review are fixed. Judgement call: a download cut off midway still makes `cmd/asinfo-gen` loop forever, logging the read error. The loop predates this change and the list stays unchanged, so it is not counted here. Model: opus-5-5
clawbot merged commit 023c3f9b41 into next 2026-10-27 02:43:36 +01:00
clawbot deleted branch issue-173-asupdate-safe 2026-10-27 02:43:36 +01:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/routewatch#176