Skip to content

Reach Phase 0: serverless on-ramps — Lambda adapter, deploy examples, cold-start benchmarks#75

Merged
zvndev merged 5 commits into
masterfrom
feat/reach-phase0
Jul 10, 2026
Merged

Reach Phase 0: serverless on-ramps — Lambda adapter, deploy examples, cold-start benchmarks#75
zvndev merged 5 commits into
masterfrom
feat/reach-phase0

Conversation

@zvndev

@zvndev zvndev commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

What

Phase 0 of the new Reach roadmap (design/REACH-ROADMAP.md, included here): make Turbo deployable to serverless platforms today — plus the one compiler addition the adapter needed, pulled forward from Phase 1.

  • design/REACH-ROADMAP.md — the sequenced plan (serverless → HTTP/1.1 completeness → C FFI/bindgen → libturbo embedding → WASM/WASI → async I/O → post-1.0 TLS), plus a durable npm/PyPI compat refusal recorded in design/POLYGLOT.md.
  • http_get_raw(url) builtin — HTTP GET returning the raw response (status line + headers + body) so protocol clients can read response headers. Both runtimes (Rust JIT + turbo_rt.c), Windows AOT stub, same SSRF guard + 30s bound as http_get, no redirect following. Unit-tested against a local one-shot server with an env-lock so the SSRF opt-out tests can't race.
  • packages/turbo-lambda — pure-Turbo AWS Lambda custom-runtime adapter. One safe fn(str) -> str handler; lambda_run(handler) is the whole loop; no @unsafe anywhere (/invocation/next reads the request-id response header via http_get_raw). 17 unit tests. Registered in the package index (7 first-party packages).
  • examples/deploy/lambda — bootstrap + cross-compile/zip/create-function walkthrough + test_local.sh end-to-end test against a faithful mock runtime API (no AWS account needed).
  • examples/deploy/cloud-run / examples/deploy/fly — self-contained multi-stage Dockerfiles (released toolchain → AOT compile → slim runtime image), PORT + 0.0.0.0, health checks, scale-to-zero fly.toml.
  • benchmarks/serverless — reproducible cold-start scripts (Lambda Init Duration over N forced cold starts, Turbo vs Node vs Python, plus a local proxy). No published numbers — run-it-yourself by policy.
  • Docs/marketing sweepdocs/serverless.md (README-linked), stdlib entry for http_get_raw, CHANGELOG Unreleased section, COMPATIBILITY matrix, website homepage card + docs/examples page (site build verified).

Verification

  • cargo test --workspace — all green (incl. new http_get_raw unit tests + SSRF-guard negative test)
  • turbo/tests/run_tests.sh — 349 passed, 0 failed
  • C-runtime tests.sh (ASan) — all pass (turbo_rt.c changed)
  • turbolang test packages/turbo-lambda/tests — 17/17
  • examples/deploy/lambda/test_local.sh — end-to-end vs mock runtime API, on the new native transport
  • Cloud Run Docker image built (linux/amd64), container verified serving; --target linux-x86 cross-compile verified
  • Website npm run build — green

Notes

  • Released linux turbolang binaries require glibc ≥ 2.39 (built on Ubuntu 24.04) — bookworm fails; Dockerfiles use trixie-slim and document why. Possibly worth an older build baseline later.
  • Branch rebased onto master (v0.14.0).

🤖 Generated with Claude Code

@vercel

vercel Bot commented Jul 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
website Ready Ready Preview, Comment Jul 10, 2026 1:51am

Request Review

zvndev and others added 3 commits July 9, 2026 20:27
…LYGLOT

Sequenced plan for serverless on-ramps, HTTP/1.1 completeness, C FFI +
bindgen, libturbo embedding wrappers, WASM/WASI completion, async I/O,
and post-1.0 TLS/HTTP2. Records the npm/PyPI package-compat refusal as
a durable decision.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ld-start benchmarks

Serverless on-ramps per design/REACH-ROADMAP.md Phase 0:

- packages/turbo-lambda: pure-Turbo AWS Lambda custom-runtime adapter.
  Handler is one safe fn(str) -> str; lambda_run(handler) is the loop.
  /invocation/next via exec'd curl -si (request id arrives in a response
  header the built-in http_get can't read); responses via http_post with
  TURBO_ALLOW_PRIVATE_HOSTS=1 exported by the bootstrap. 17 unit tests on
  the pure parsing core; registered in the package index (7 first-party
  packages now).
- examples/deploy/lambda: function + 2-line bootstrap + cross-compile/zip/
  create-function walkthrough + test_local.sh, a full end-to-end run
  against a faithful mock runtime API (passes, no AWS account needed).
- examples/deploy/cloud-run + examples/deploy/fly: self-contained
  multi-stage Dockerfiles (install released toolchain -> AOT compile ->
  slim runtime image), PORT env + 0.0.0.0 bind, health checks; fly.toml
  with scale-to-zero. Image built and container verified serving locally.
  Note: released turbolang binaries need glibc >= 2.39, hence trixie-slim.
- benchmarks/serverless: reproducible cold-start scripts (Lambda Init
  Duration over N forced cold starts for identical Turbo/Node/Python
  functions, plus a local process-start proxy). No numbers published that
  the scripts didn't generate.
- docs/serverless.md ties it together; linked from README and examples
  index.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…rketing sweep

- http_get_raw(url) -> str: raw response (status line + headers + body)
  in both runtimes (Rust JIT + turbo_rt.c, Windows AOT stub), with the
  same SSRF guard and 30s bound as http_get; no redirect following (each
  hop would prepend its own header block). Unit-tested against a local
  one-shot server, with an env-lock so the SSRF opt-out tests can't race.
- turbo-lambda: /invocation/next now reads the request-id header via
  http_get_raw instead of exec'd curl — the package and user main() are
  fully safe (no @unsafe anywhere). e2e mock-API test still passes.
- Docs/marketing sweep: stdlib.md entry, CHANGELOG Unreleased section,
  COMPATIBILITY matrix row, serverless.md + package/example READMEs
  updated for the native transport, REACH-ROADMAP marks the client-header
  item as pulled forward from Phase 1; website homepage Zero-GC card now
  carries the serverless story and docs/examples page lists the three
  deploy examples (build verified).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…rbo_version

- rustfmt: two files from the http_get_raw change
- clippy (newer stable toolchain in CI): match-to-? in resolve_type_expr
  FnType param resolution (pre-existing code, surfaced by toolchain drift)
- turbo-lambda min_turbo_version 0.14.0 -> 0.15.0: the package requires the
  http_get_raw builtin, which first ships in the next release

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
….97 lint)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@zvndev zvndev merged commit 5053986 into master Jul 10, 2026
27 checks passed
@zvndev zvndev deleted the feat/reach-phase0 branch July 10, 2026 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant