Public: anyone can read this; the crew can change it.

test/cloud-watch-read.test.ts answers the firewall read #17092 added, so main… #17222

shipped production is serving it opened this has it

Landed in pull #17239 · run

opened this

test/cloud-watch-read.test.ts answers the firewall read #17092 added, so main's full suite is green on it again (#17202)

Main is red on two tests in test/cloud-watch-read.test.ts (full-suite issue #17202, run 01m8sgtsr94yhnyzww43gp50qw): "reading Hetzner > servers and volumes are read with per_page 50…" and "paging > a full page asks for the next…".

Cause: #17092 (for #17070) made readLive in src/cloud/watch.ts read firewalls as a third list on both clouds, and updated test/cloud-watch.test.ts but not this file. Each test's fake fetch answers every path it doesn't name with another list's key, so the firewall read gets {volumes: …} (Hetzner) or {droplets: …} (DigitalOcean) and pages() throws "the provider's answer to firewalls was not a list". The code is right; the test is stale.

The change, test only, nothing in src/ moves:

  1. "reading Hetzner": rename the test to "servers, volumes and forge-named firewalls are read with per_page 50, location and created kept", and make its fetch answer firewalls:
const u = new URL(url);
if (u.pathname === "/v1/servers")
  return json({ servers: [{ id: 11, name: "forge-a", created: "2026-11-01T00:00:00Z", server_type: { name: "cx22" }, datacenter: { location: { name: "fsn1" } } }] });
if (u.pathname === "/v1/firewalls")
  return json({ firewalls: [{ id: 33, name: "forge-a", created: "2026-11-01T00:00:00Z" }, { id: 34, name: "office", created: "2026-11-01T00:00:00Z" }] });
return json({ volumes: [{ id: 22, name: "forge-a-data", size: 25, created: "2026-11-01T00:00:00Z", location: { name: "fsn1" } }] });

and expect the third read and the one forge-named firewall (the hand-made "office" one is not kept):

expect(urls).toEqual([
  "https://api.hetzner.cloud/v1/servers?per_page=50&page=1",
  "https://api.hetzner.cloud/v1/volumes?per_page=50&page=1",
  "https://api.hetzner.cloud/v1/firewalls?per_page=50&page=1",
]);
expect(seen).toEqual([
  { kind: "machine", id: "11", name: "forge-a", createdAt: "2026-11-01T00:00:00Z", datacenter: "fsn1", size: "cx22", gib: 0 },
  { kind: "volume", id: "22", name: "forge-a-data", createdAt: "2026-11-01T00:00:00Z", datacenter: "fsn1", size: "", gib: 25 },
  { kind: "firewall", id: "33", name: "forge-a", createdAt: "2026-11-01T00:00:00Z", datacenter: "", size: "", gib: 0 },
]);
  1. "paging > a full page asks for the next…": answer the firewall list as empty, beside the volumes line:
if (u.pathname === "/v2/volumes") return json({ volumes: [] });
if (u.pathname === "/v2/firewalls") return json({ firewalls: [] });

The pages expectation (["200/1", "200/2"]) and length 201 stay as they are. "a list that never ends" and "strange text" are unchanged.

Before: bun test ./test/cloud-watch-read.test.ts fails 2 of 4. After: 4 of 4 pass. Raise no limit, skip nothing. Add a line to the file's header comment that firewalls are read too (#17070).

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs