Repository navigation
fix(stdlib): enable base64 for turnloop-http-client so fetch programs get a stripped runtime #11116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| Fix `perry-stdlib` failing to compile for any feature set that enables `turnloop-http-client` without `crypto`, which silently put every fetch program onto the full prebuilt runtime. | ||
|
|
||
| `turnloop_client::decode_basic` (proxy `Basic` credentials) uses the `base64` crate, but the `turnloop-http-client` feature never enabled `dep:base64` — only `crypto` did. The function is not `cfg`-gated, so it compiles whenever `turnloop-http-client` is on. Full builds enable `crypto` and compiled fine, which is why nothing caught it; the break landed with #10354. | ||
|
|
||
| The consequence was larger than a compile error. Auto-optimize builds a feature-stripped runtime per program, and a program using `fetch` resolves to `async-runtime,web-fetch`. That set failed to compile, and auto-optimize's recovery is to print a warning, fall back to the prebuilt full-feature archive, and exit 0 — so the program still built and ran, just linked against everything. Measured on main (macOS arm64, auto-optimize path, bytes from the linker map): a baseline program is 7.43 MB. The same program plus `fetch` came out at **23.63 MB** before this fix, carrying code it has no use for — sqlite, the SWC parser, Temporal, ICU. With the fix it gets its own stripped runtime and is **11.96 MB**, with sqlite, SWC and Temporal at zero. That is about 11.7 MB, roughly half, off every program that uses `fetch`. | ||
|
|
||
| Note that the fallback did print a warning, but the build succeeded and the binary ran correctly, so nothing downstream treated it as a failure. The measurement that exposed this only did so because it asserted the stripped runtime was actually built, rather than trusting the exit code. | ||
|
|
||
| The fix adds `dep:base64` to `turnloop-http-client`. It belongs there rather than on `web-fetch` because the use site compiles under `turnloop-http-client` alone, which the module documents as a supported combination. | ||
|
|
||
| Verified by reproducing the failure on main (`error[E0432]: unresolved import base64`) for `--features async-runtime,web-fetch`, then confirming it compiles with the fix. `Cargo.lock` is unchanged, since `base64` was already resolved. | ||
|
|
||
| Not addressed here: `--features turnloop-http-client` on its own still fails, with a different error (`cannot find async_bridge in common`). No real configuration reaches it — only `web-fetch` enables `turnloop-http-client`, and `web-fetch` already includes `async-runtime` — and resolving it by adding `async-runtime` would pull tokio into the turnloop client path. | ||
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: PerryTS/perry
Length of output: 45545
🏁 Script executed:
Repository: PerryTS/perry
Length of output: 41547
🏁 Script executed:
Repository: PerryTS/perry
Length of output: 43237
Limit the binary-size claim to the measured program.
The measurements cover one baseline program and the same program with
fetch. Auto-optimize rebuilds runtimes per feature set, and dead stripping depends on the program’s referenced code. The reported 11.7 MB reduction is not established for every program that usesfetch.🤖 Prompt for AI Agents