Repository navigation
feat(lean): experimental Lean 4 SDK core and generator - #1493
sam-goodwin wants to merge 1 commit into
Conversation
Benchmarks: PR
|
| Metric | Change vs main | Programs |
|---|---|---|
| Bundle (gzip) | no change | 18 |
| Import heap | no change | 15 |
| Objects at import | no change | 15 |
| Added latency (p50) ¹ | 1 worse | 15 |
| Import time ¹ | 2 worse | 15 |
| First call ¹ | 2 worse | 15 |
| Program | Call | Bundle (gzip) | Import heap | Objects at import | Added latency (p50) | Import time | First call |
|---|---|---|---|---|---|---|---|
| aws | s3.listBuckets |
80.6 KB | 1.5 MB | 2,078 | 28.8 µs | 18.9 ms | 9.8 ms |
| aws~awsJson1_0 | dynamodb.listTables |
72.7 KB | 1.4 MB | 2,011 | 16.0 µs | 18.9 ms | 8.0 ms |
| aws~awsJson1_1 | kms.listKeys |
72.0 KB | 1.3 MB | 1,958 | 15.4 µs | 23.0 ms | 8.6 ms |
| aws~awsQuery | sts.getCallerIdentity |
73.4 KB | 1.2 MB | 1,912 | 21.7 µs | 17.4 ms | 9.2 ms |
| aws~ec2Query | ec2.describeRegions |
73.5 KB | 2.8 MB | 3,048 | 15.6 µs | 27.9 ms | 9.8 ms |
| aws~restJson1 | lambda.listFunctions |
74.2 KB | 1.4 MB | 2,034 | 16.4 µs | 18.9 ms | 10.2 ms |
| azure | resources.ListTenants |
62.3 KB | — | — | — | — | — |
| azure~AzureDataPlaneProtocol | maps-render.GetRenderMapStaticImage |
68.1 KB | — | — | — | — | — |
| cloudflare | workers.listScripts |
71.1 KB | 1.0 MB | 1,504 | 2.4 µs | 13.4 ms | 5.0 ms |
| cloudflare~CloudflareProtocol | ips.listIps |
51.5 KB | 773.6 KB | 1,332 | 1.7 µs | 12.3 ms | 4.1 ms |
| fly-io | machines.getRegions |
51.7 KB | 758.6 KB | 1,079 | 14.5 µs (+66.8%) 🟡 | 10.9 ms | 4.4 ms |
| fly-io~FlyApiProtocol | mpg.listUsers |
51.6 KB | 648.1 KB | 973 | 8.8 µs | 19.7 ms (+69.8%) 🟡 | 6.6 ms (+40.4%) 🟡 |
| fly-io~SpritesProtocol | sprites.createOrganizationToken |
52.6 KB | 682.0 KB | 1,015 | 14.7 µs | 16.6 ms | 6.2 ms (+51.4%) 🟡 |
| gcp | storage_v1.listBuckets |
53.3 KB | 860.0 KB | 1,325 | 6.7 µs | 11.9 ms | 4.5 ms |
| github | gists.list |
54.4 KB | 626.0 KB | 956 | 6.9 µs | 10.3 ms | 4.9 ms |
| neon | neon.listProjects |
53.1 KB | 815.0 KB | 1,093 | 2.1 µs | 16.7 ms (+43.3%) 🟡 | 6.0 ms |
| resend | resend.listLogs |
52.9 KB | 856.0 KB | 1,154 | 3.3 µs | 13.4 ms | 4.6 ms |
| stripe | stripe.GetFiles |
51.1 KB | — | — | — | — | — |
PR e41601f3e against main 3875ecc2f (main's cached run from 2026-11-23 18:11 UTC). 18 programs, measured in 35 s on 8 vCPU.
| Package | Tarball | Unpacked | Files |
|---|---|---|---|
| aws | 18.2 MB | 146.2 MB | 2955 |
| cloudflare | 5.9 MB | 59.4 MB | 829 |
| core | 354.1 KB | 1.4 MB | 244 |
| fly-io | 251.9 KB | 1.6 MB | 71 |
| gcp | 37.8 MB | 283.9 MB | 3262 |
| github | 2.1 MB | 19.7 MB | 338 |
| neon | 222.1 KB | 1.2 MB | 47 |
| resend | 172.1 KB | 1.1 MB | 57 |
| Tracked files | Size | Change vs main | Files |
|---|---|---|---|
services |
590.4 MB | ±0 B | 3,176 |
in-tree-specs |
299.6 KB | ±0 B | 10 |
patches |
11.2 MB | ±0 B | 4,461 |
handwritten |
11.3 MB | ±0 B | 2,059 |
benches |
9.6 MB | ±0 B | 209 |
other |
10.5 MB | +7.8 MB | 562 |
| Total | 633.2 MB | +7.8 MB | 10,477 |
What a checkout or worktree writes to disk, from git ls-tree (benches/repo-size/tree.ts). The dashboard's Repo size page has the full picture.
Effect alone: effect-minimal bundle 8.9 KB gzip, hand-written effect-http call 48.6 KB gzip; effect import 117.7 ms and 12.8 MB heap; bare mocked HTTP roundtrip 23.5 µs p50.
Bundled (from src/): resend, neon, github, fly-io, aws, cloudflare, gcp, azure, stripe. Built and probed (from lib/): resend, neon, github, fly-io, aws, cloudflare, gcp.
Job time: bundle 9.7 s, build: tsrs 0.4 s, build: bundle-lib 3.7 s, build: strip-lib-docs 0.1 s, build 4.2 s, size 1.5 s, runtime 19.4 s, providers 0.0 s.
¹ Timings run on a different runner than main's, so 🟡 marks a large move that may still be noise. Sizes, heap and object counts are stable. Offline: every call hits a canned in-memory response. Full suite: node benches/sdks/run.ts. Job log







Experiment — not for merge. Distilled's SDKs as Lean 4 modules, generated from the same Smithy models. Each operation returns an effect whose errors are a closed type, so a proof can cover every response the model lists.
The same program runs two ways:
Eff.runagainst a model of the service, for proofs, andEff.ioover the network.lean/Distilled/: the core (Api,Eff,Model), schemas, the five AWS protocols (awsJson, restJson, restXml, awsQuery, ec2Query), HTTP/1.1 and TLS over the OpenSSL the Lean toolchain ships, and SigV4.lean/Generate.lean: the generator, a Smithy model in and a Lean module out.lean/Distilled/AWS/Services/: generated SQS, SNS, Lambda, S3, DynamoDB and EC2 (about 137k lines).It lives in a top-level
lean/directory, outside the pnpm workspace, so no existing script or CI job reads it.Not done: no signed AWS call has been tested,
packages/aws/patchesare not applied, shapes that refer to themselves are left out (16 DynamoDB operations), and there is no rpcv2Cbor, streaming, pagination or retries.