Skip to content

SCRUM-228 — player gateway: fix the Patch blob route

Plan ref: PAT-G1 (docs/11-admin-plane-plan.md).

What changed

Before After
GET /patch/v1/live/blob/ → patch (public) GET /patch/v1/blob/ → patch (public, Stream: true)
  • Path: Patch serves blobs at /patch/v1/blob/{sha256} (SCRUM-227, docs/03 §4); the old path 404'd every download.
  • Public for every channel: blobs are content-addressed and immutable; a restricted channel's blob hash is unguessable — the M1 trade-off in docs/03 PAT-B6.
  • Stream: a large .pck over a slow link outlives the 30s WriteTimeout; Stream makes the proxy clear the write deadline for this route (the existing mechanism the session events route uses).
  • Still on the general per-IP rate-limit bucket (a resumed download is a few requests).
  • Updated: route_policy_test.go, the authn middleware test comment, ROUTE-POLICY.md, testdata/manual/TESTING.md, docs/05-gateway-techspec.md.

How to verify

cd services/gateway
go vet ./... && go test -race -count=1 ./...
go test -count=1 -v -run 'TestBlobRoute|TestRoutePolicy' .
grep -rn "live/blob" . ../../docs/05-gateway-techspec.md   # nothing
Test Proves
TestRoutePolicy_* the table pin and the public-prefix policy include /patch/v1/blob/
TestBlobRoute_SlowDownloadSurvivesWriteTimeout a body that outlasts a 1s WriteTimeout arrives complete through /patch/v1/blob/<sha>; fails without Stream: true (checked during review)

End-to-end once deployed (player edge, no token):

curl -r 0-1023 -o /dev/null -w '%{http_code}\n' http://<host>:8080/patch/v1/blob/<sha>   # 206

Results at time of writing

  • go vet, go test -race (4 packages): pass; no stale references.

How it was built

DeepSeek run scoped (Landlock) to services/gateway (63 s, ~8k output tokens). Claude: mutation check of the Stream flag, techspec update (outside that scope).