Files
magpie/internal
yetone f79817f572 gateway: tests that a mixed, fallback or stood-in route is masked (#3973)
ea53eb126 stopped masking a request whose route ends only at providers
set to go unmasked. Its test covers a lone provider, an observer and an
unknown model. These cover the routes that may reach a vendor:

- TestUnredactedRouteNotScanned: a group of only unmasked members is not
  masked; an unmasked provider with a vendor fallback, or in a group
  with a vendor, is masked once, for chat and count_tokens.
- TestUnredactedFailoverToVendorMasked: the unmasked provider answers
  500 and the request fails over to the vendor (its fallback, or the
  group's next member). Neither try gets the key, and the reply has it
  back.
- TestUnredactedAskedButSentElsewhereMasked: Claude Code asks for an id
  the unmasked provider serves, and its tier stands in a vendor's model.
  The vendor gets it masked and the reply has the value back.

Test-only; no code changes.

Run on mote at this tree (origin/main ea53eb126 plus this file):
- gofmt -l internal/gateway: none. go vet -tags nogui ./internal/gateway
  for darwin, linux and windows: ok.
- go test -tags nogui -count=1 -timeout 45m ./internal/gateway on mote at ea53eb126: ok (558s); linux and windows vet ok
- The new tests with TestUnmaskedRouteIsNotMasked and
  TestLocalUnredacted*, -count=3: ok.
- Broken by hand on ea53eb126: unredactedRoute ignoring a provider's
  fallbacks and every group member past the first makes "falls back to
  a vendor", "a group with a vendor" and both failover cases red (the
  vendor was sent the key). Deciding sentWhole from the model as asked,
  before stand-ins, makes TestUnredactedAskedButSentElsewhereMasked red
  ("the vendor was sent the value").

Rebased on bc3ddc661 (a gateway compaction change); at that head the new
tests with TestUnmasked*, TestLocalUnredacted* and the Compact tests: ok.

Not tried: the full ./... suite, since mote was already running another
session's; this adds one test file to internal/gateway.
2026-10-28 15:16:18 +08:00
..
…
…
…