gw-03 — Verification

One command

cd gw-03-api-gateway && bash scripts/verify.sh

What the tests prove

TestInvariant
TestPhaseOrderingAndShortCircuitinbound auth (order 10) short-circuits before routing/endpoint; the access log still fires on the 401
TestExemptPathSkipsAuthexempt paths bypass auth and hit the local endpoint
TestProxyForwardsToOriginrequest is proxied; hop-by-hop Connection stripped; X-Forwarded-For added
TestLongestPrefixAndHeaderPredicatelongest-prefix + specificity routing; a header-gated canary route beats the base route of equal prefix
TestPanicBecomes502a panicking filter yields 502 (not a dropped connection) and outbound still runs
TestProxyTimeoutIs504a slow origin yields 504 at the per-request deadline
TestProxyDeadOriginIs502a dead origin (connection refused) yields 502
TestHotReloadNoDropsconcurrent route-table swaps under load drop zero lookups (lock-free atomic swap)

All under -race — the hot-reload test specifically stresses the atomic-pointer swap against concurrent readers.

What "green" does NOT guarantee

  • No real event-loop semantics. Go's netpoller hides the loop; the "never block the loop" discipline (GUIDE §4) matters when you port this to Java/Netty.
  • No pooling/resilience/security yet. Those plug into the Transport and inbound seams (gw-04/06/07).
  • Body is buffered, not streamed. Streaming is an exercise (GUIDE §7).
  • Routing is static in the CLI. Dynamic control-plane push is gw-08.