Files
magpie/internal/gui/assets/plugins
yetone 59ea5dc8f8 gateway: a failure with this computer off the network rests nobody (usrname1833)
usrname1833 on Discord: with the computer offline, a routing group's
members failed to connect one after another, each rested, and the first
stayed behind the others once the network was back.

A 502 whose error says no connection was made (dial, lookup, refused, no
route, TLS handshake timeout, and Bun's ConnectionRefused / ENOTFOUND
for a plugin's fetch) now asks whether this computer has a network,
unless any upstream answered in the last 15s: no interface up with a
global address means none; otherwise up to three hosts of the user's
other providers (not p's own, not proxied ones, not localhost / LAN) are
dialled at once (2s), and none taking the connection means offline. The
verdict is kept 5s and asked by one request at a time. Offline, the
member is passed over as a down proxy is (failProxy): no rest, no count,
the trace says Fail "offline". One provider that can't connect while
another's host takes a connection, or while replies came lately, still
rests as before.

Covered where every rest passes: restAfterMarked (so decide_group's and
count_tokens' rests too), the serve loop's next-member path, and the last
member's label. Routing page: "network down" tag and a story for the
next-member and last-member cases, in zh, zh-TW, ja and de.

Run (mote, at this tree):
- gofmt -l clean; go vet ./internal/gateway on darwin, GOOS=linux,
  GOOS=windows: ok
- go test -run 'TestOfflineRestsNobody|TestProxyDownDoesNotRest' -v
  ./internal/gateway: ok; go test -timeout 45m ./internal/gateway:
  ok (708s)
- GUI: routing-offline.test.cjs (new) 10/10 and routing-proxy 4/4,
  Chromium + WebKit, en zh zh-TW ja de. Every routing-*.test.cjs at once
  (load 30-44 on mote): 1997 pass, 29 fail. The untouched base 3d063e34f
  gives 1987 pass, 29 fail in the same files, with the subtests shuffled
  (#4585). i18n-keys: only "Unmarked" is red (#4524), as on the base.
Broken by hand: offlineFailure returning false -> TestOfflineRestsNobody
red ("nothing reachable" and "no interface up": Fail other, Rest set);
client.js at HEAD -> routing-offline 0/5 in Chromium.

Not tried: a real machine taken off the network; a plugin (Bun) fetch's
real offline error text (matched from Bun's error names only); providers
behind a proxy (left to failProxy and not dialled); a group whose
members all sit on the local network (near hosts aren't dialled, so
with an interface up their failures still rest); the full ./... suite.
2026-10-31 22:23:18 +08:00
..