feat: add --compression flag (default off) to control Accept-Encoding#17
Merged
Conversation
molt 0.1.8 inherited automatic gzip handling from async 0.17.1, which silently shifted response_size_bytes from wire bytes to decompressed bytes for targets that honor Accept-Encoding: gzip. That is surprising for a load testing tool whose users typically want to measure wire bandwidth. Add an opt-in --compression flag (default off). When off, molt injects Accept-Encoding: identity into every request so responses come back uncompressed and response_size_bytes matches wire bytes again. When on, users get async's default gzip handling for realistic compressed- endpoint benchmarking. User-provided Accept-Encoding headers (via -H) are honored and never overwritten. Closes #14 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #17 +/- ##
==========================================
- Coverage 62.48% 62.46% -0.02%
==========================================
Files 16 16
Lines 733 738 +5
==========================================
+ Hits 458 461 +3
- Misses 275 277 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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
--compressionCLI flag (default off).Accept-Encoding: identitysoresponse_size_bytesreflects wire bytes, matching pre-0.1.8 semantics for compressible targets.Accept-Encodingvia-His honored and never overwritten.Rationale
molt 0.1.8 pulled in
moonbitlang/async0.17.1, which started sendingAccept-Encoding: gzipby default and transparently decompressing responses. That shiftedresponse_size_bytesfrom wire bytes to decompressed payload size — a surprising regression for users who care about bandwidth measurement.The behavior matches
curl(which does not sendAccept-Encodingunless you pass--compressed). It's an opt-in rather than opt-out because wire-byte measurement is the conservative default for a load testing tool.Implementation
compression : Boolfield onConfig(default false).--compressionwired throughsrc/cmd/main/cli.mbt.build_headersinsrc/lib/worker/worker.mbtinjectsAccept-Encoding: identitywhencompression=falseand the user hasn't already set their own.src/cmd/main/main.mbtapplies the same logic.Test plan
build_headerscovering: compression off (injects identity), compression on (passthrough), user-provided Accept-Encoding preserved.moon check --target nativecleanmoon fmtcleanmoon test --target native— all tests pass (250 -> 254)moon build --target native --release— binary buildsCloses #14