Gzip-compress API responses ≥1 KB#88
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
GZipMiddleware(minimum_size=1000)after CORS inapp/main.py. JSON responses ≥1 KB are now compressed when the client sendsAccept-Encoding: gzip. Uncompressed clients (curl without flag) receive identity unchanged via standard Accept-Encoding negotiation.Motivation
Browser perf audit of the dashboard cold-load showed every forge-api response shipping uncompressed despite the dashboard always sending
Accept-Encoding: gzip, br. Sample landing-page API hits (5 calls):/specs?active=true38,671 b,/submissions/<id>/step~45 KB,/rounds/active~5.7 KB,/sota~5 KB,/leaderboard/overall~1.2 KB — ~95 KB uncompressed JSON over the wire on every cold visit.Same audit class as forge-dashboard PR #260 (static compression): uniquely prod-only perf-leak, invisible to test suites because pytest's TestClient doesn't negotiate encoding.
Changes
app/main.py: importGZipMiddleware, register after CORS withminimum_size=1000app/main.py: version 0.15.11 → 0.15.13CHANGELOG.md: 0.15.13 entryVerification
Local uvicorn smoke test:
GET /openapi.json33,212 b → 5,321 b gzip (-84%)GET /1,223 b → 659 b gzip (-46%)Vary: Accept-Encodingheader present