#!/usr/bin/env bats # Seam: the frank-medium proxy's routing decisions. # The proxy is the only thing between the fleet's clients and the two # single-GPU replicas, and its routing rules carry the performance work: spread # single-turn requests (batch members, one-shot questions) so both cards prefill # in parallel, and pin continuations so an agent loop keeps hitting the replica # whose prefix cache holds its context. This seam drives the routing policy # directly; the first version of these rules shipped a bug that only appeared on # a continuation request, which is exactly the class of mistake a test this # cheap should catch. load helpers ROUTING="$REPO_ROOT/dankserver/frank-medium/proxy/routing.py" PROXY="$REPO_ROOT/dankserver/frank-medium/proxy/affinity-proxy.py" setup() { DRIVER="$BATS_TEST_TMPDIR/route.py" touch "$DRIVER" } @test "the proxy and its routing policy exist and compile" { [ -f "$ROUTING" ] [ -f "$PROXY" ] python3 -m py_compile "$ROUTING" python3 -m py_compile "$PROXY" # The policy must not drag the HTTP stack in: it is imported by tests and # reasoned about without aiohttp, a network or a GPU. ! grep -q 'import aiohttp' "$ROUTING" } @test "a batch of single-turn requests spreads across both cards" { cat > "$DRIVER" < "$DRIVER" < "$DRIVER" < replica 1; both down -> -1, and the proxy answers # 503 rather than forwarding into the void. [ "$output" = "1 -1" ] done } @test "affinity is deterministic per prefix, roundrobin is not" { cat > "$DRIVER" <