Skip to content

feat(gcp): publish each bound operation's IAM in meta modules - #1072

Draft
sam-goodwin wants to merge 10 commits into
mainfrom
feat/gcp-operation-iam
Draft

sam-goodwin wants to merge 10 commits into
mainfrom
feat/gcp-operation-iam

Conversation

@sam-goodwin

@sam-goodwin sam-goodwin commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

Every GCP operation Alchemy binds now says what IAM it needs, published as data in a meta module beside the SDK, so a binding generator reads it without loading any SDK code.

import { operations } from "@distilled.cloud/gcp/meta/pubsub_v1";

operations.publishProjectsTopics.iam;
// { actions: ["pubsub.topics.publish"], roles: ["roles/pubsub.publisher"] }
  • @distilled.cloud/<pkg>/meta/<service> (GCP's unstable services: /unstable/meta/<service>) maps each operation's export name to a core OperationMeta. The operations themselves carry nothing new, so the runtime SDK doesn't grow.
  • OperationMeta.iam (core OperationIam) holds the actions a call is authorized as, the ARN formats a grant may name, the actions only some requests need, and roles: the predefined roles that grant the actions, for clouds that grant roles.
  • Shared codegen writes the meta module (src/meta/<service>.ts) from a com.distilled.iam#operation trait on an operation shape, set by a patch.
  • Discovery documents carry no IAM, so patches/<module>/iam.json is the record: the 4,408 methods across 175 modules that Alchemy binds, each with the permission it checks and the smallest predefined role holding it, as Alchemy's GCP bindings grant them and their live probe suites verify (feat(gcp)!: cover every GCP service with generated bindings, grants from distilled alchemy#2753).
// patches/pubsub_v1/iam.json
{
  "op": "add",
  "path": "/shapes/com.gcp.pubsub_v1#PublishProjectsTopics/traits/com.distilled.iam#operation",
  "value": { "actions": ["pubsub.topics.publish"], "roles": ["roles/pubsub.publisher"] }
}

chore(gcp): regenerate ces_v1 comes first and holds only that: its committed SDK had drifted from the generator. Relative to it, the SDK's service modules are unchanged; only the meta modules are new.

#1070 (AWS, from AWS's Service Authorization Reference) is stacked on this.

Its committed SDK had drifted from the generator: regenerating it from the
pinned mirror, unchanged, renumbers its schema tables.
@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Benchmarks: PR 9d108e0ca vs main b1b4a0d39

  • ⚪ Bundle size 54.7 KB: ±0.0% (±0 B), same as main
  • ⚪ Runtime speed 2.9 µs: −15.8% (−0.5 µs), same as main
  • ⚪ Runtime memory 794.6 KB: +2.2% (+17.2 KB), same as main
  • ⚪ Objects at import 1,084: ±0.0% (±0), same as main
  • ⚪ Whole-SDK memory aws 39.7 MB (−0.0%), cloudflare 8.27 MB (+0.2%), gcp 24.8 MB (+0.1%)
  • 🔴 Repo size 543.6 MB tracked in 10,099 files: +1.9 MB (+0.4%) vs main. .generated-specs/ 0 B, src/services/ 510.0 MB, everything else 33.6 MB.

sdk-memory

bundle-programs

memory-programs

bundle memory
speed objects

Numbers
Metric Change vs main Programs
Bundle (gzip) no change 17
Import heap no change 6
Objects at import no change 6
Added latency (p50) ¹ no change 6
Import time ¹ no change 6
First call ¹ no change 6
Program Call Bundle (gzip) Import heap Objects at import Added latency (p50) Import time First call
aws s3.listBuckets 79.4 KB — — — — —
aws~awsJson1_0 dynamodb.listTables 71.7 KB — — — — —
aws~awsJson1_1 kms.listKeys 70.9 KB — — — — —
aws~awsQuery sts.getCallerIdentity 72.3 KB — — — — —
aws~ec2Query ec2.describeRegions 72.4 KB — — — — —
aws~restJson1 lambda.listFunctions 73.1 KB — — — — —
azure resources.ListTenants 57.0 KB — — — — —
cloudflare workers.listScripts 69.3 KB — — — — —
cloudflare~CloudflareProtocol ips.listIps 49.9 KB — — — — —
fly-io machines.getRegions 50.9 KB 776.0 KB 1,088 3.9 µs 9.0 ms 3.5 ms
fly-io~FlyApiProtocol mpg.listUsers 50.6 KB 668.0 KB 982 2.4 µs 7.8 ms 3.2 ms
fly-io~SpritesProtocol sprites.createOrganizationToken 51.3 KB 706.2 KB 1,024 6.6 µs 8.3 ms 3.5 ms
gcp storage_v1.listBuckets 51.8 KB — — — — —
github gists.list 53.4 KB 656.6 KB 954 2.9 µs 8.5 ms 3.7 ms
neon neon.listProjects 52.1 KB 837.8 KB 1,084 1.6 µs 8.8 ms 3.8 ms
resend resend.listLogs 51.9 KB 868.4 KB 1,144 2.1 µs 9.5 ms 3.2 ms
stripe stripe.GetFiles 50.1 KB — — — — —

PR 9d108e0ca against main b1b4a0d39 (main's cached run from 2026-11-16 14:47 UTC). 17 programs, measured in 72 s on 8 vCPU.

Package Tarball Unpacked Files
core 332.2 KB (+0.3%) 1.3 MB (+0.3%) 229
dev 426.6 KB (+0.4%) 1.9 MB (+0.3%) 213
fly-io 249.9 KB 1.6 MB 71
github 2.1 MB 19.6 MB 338
neon 221.4 KB 1.2 MB 47
resend 173.2 KB 1.2 MB 57
Tracked files Size Change vs main Files
services 510.0 MB ±0 B 2,973
in-tree-specs 98.3 KB ±0 B 4
patches 11.3 MB +1.2 MB 4,331
handwritten 10.1 MB +703.3 KB 2,081
benches 9.6 MB ±0 B 207
other 2.6 MB +385 B 503
Total 543.6 MB +1.9 MB 10,099

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 83.2 ms and 12.8 MB heap; bare mocked HTTP roundtrip 11.2 µs p50.

Bundled (from src/): resend, neon, github, fly-io, aws, cloudflare, gcp, azure, stripe, dev. Built and probed (from lib/): resend, neon, github, fly-io, dev. Changed in this PR: aws, dev, gcp. No target in targets.json: dev.

Job time: bundle 7.3 s, build: tsrs 2.4 s, build: bundle-lib 42.1 s, build: strip-lib-docs 0.2 s, build 44.7 s, size 1.2 s, runtime 12.8 s, providers 6.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

github-actions Bot added a commit that referenced this pull request Nov 6, 2026
@alchemy-version-bot

alchemy-version-bot Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Install the packages built from this commit:

@distilled.cloud (118)
pnpm install https://pkg.distilled.cloud/@distilled.cloud/acme/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/adyen/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/anthropic/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/apache-superset/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/archil/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/argocd/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/auth0/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/aws/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/aws4signer/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/axiom/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/azure/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/boat-dev/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/boxd/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/celld/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/chronosphere/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/clerk/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/clickhouse-cloud/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/cloudflare/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/coinbase/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/coinflow/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/convex/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/coolify/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/core/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/customerio/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/datadog/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/daytona/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/digitalocean/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/discord/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/docker/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/dokploy/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/doppler/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/e2b/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/elasticsearch/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/entire/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/exa/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/expo-eas/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/fly-io/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/forgejo/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/gcp/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/github/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/google-workspace/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/grafana/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/growthbook/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/gusto/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/hetzner/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/hostinger/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/huggingface/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/hydradb/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/iceberg/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/infisical/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/inngest/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/intercom/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/kubernetes/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/launchdarkly/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/linear/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/mailchimp/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/meilisearch/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/mercury/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/metabase/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/modal/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/modrinth/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/mongodb-atlas/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/namespacelabs/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/neon/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/netbird/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/notion/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/npm/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/okta/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/onepassword/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/opencode/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/opensearch/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/ovh/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/paypal/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/plaid/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/planetscale/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/polar/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/polymarket/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/porkbun/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/posthog/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/prisma/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/proxmox/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/questrade/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/railway/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/redis-cloud/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/remote/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/render/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/resend/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/revenuecat/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/rivet/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/s2/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/s3/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/scaleway/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/sentry/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/slack/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/spacetimedb/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/squarespace/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/stackit/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/starburst-galaxy/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/steel/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/stripe/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/supabase/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/surrealdb/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/tailscale/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/technitium/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/temporal/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/tencentcloud/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/trigger-dev/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/turbopuffer/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/turso/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/typesense/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/unkey/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/vanta/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/vercel/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/whop/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/workos/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/xata/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/zendesk/pr:1072:9d108e0
pnpm install https://pkg.distilled.cloud/@distilled.cloud/zerossl/pr:1072:9d108e0

Published Nov 17, 2026, 6:02 AM UTC. Expires Nov 24, 2026, 6:02 AM UTC, extended while this pull request is open.

`op.iam` (core `OperationIam`) says what a call needs: the actions it is
authorized as, the ARN formats a grant may name, the actions only some
requests need, and the predefined roles that grant the actions. It is read
lazily from the operation's config, like `op.input`.

A `com.distilled.iam#operation` trait on an operation shape, set by a
patch, becomes the operation's `iam` in any SDK (shared codegen).
patches/<module>/iam.json annotates the 4,408 GCP methods Alchemy binds with
the permission each checks and the smallest predefined role holding it, as
Alchemy's GCP bindings grant them and their live probe suites verify.
Discovery documents carry no IAM, so these patches are the record.
sam-goodwin added a commit to alchemy-run/alchemy that referenced this pull request Nov 6, 2026
Each bound GCP operation now carries the permission it checks and the
predefined roles that grant it (alchemy-run/distilled#1072, as patches:
discovery documents carry no IAM). The generator reads them from the
operation instead of deriving them, so a grant is corrected in distilled.

- The configs lose their per-method `permissions` and `roles` overrides;
  the naming-convention keys only steer the proposal for a method distilled
  has no iam for yet, which --write-iam-patches writes into distilled.
- Pub/Sub seek is granted roles/pubsub.subscriber (pubsub.subscriptions.consume)
  wherever it is bound, and WorkspaceEvents binds DeleteSchemaRevision.
- Integrations reads the unstable integrations_v1 module: the stable copy is
  a leftover distilled no longer generates.
@sam-goodwin
sam-goodwin force-pushed the feat/gcp-operation-iam branch from c885782 to 1eba1ac Compare November 6, 2026 00:29
@sam-goodwin
sam-goodwin added this pull request to stack #1073 November 6, 2026 00:29
github-actions Bot added a commit that referenced this pull request Nov 6, 2026
github-actions Bot added a commit that referenced this pull request Nov 7, 2026
github-actions Bot added a commit that referenced this pull request Nov 7, 2026
@sam-goodwin
sam-goodwin marked this pull request as ready for review November 7, 2026 18:41
The SDK operations no longer carry `iam`: it cost every consumer runtime code
it never reads. Each service's operation metadata is now a data-only module,
`@distilled.cloud/<pkg>/meta/<service>` (`/unstable/meta/<service>` for GCP's
unstable services), that maps an operation's export name to its core
`OperationMeta`:

    import { operations } from "@distilled.cloud/gcp/meta/pubsub_v1";
    operations.publishProjectsTopics.iam;
    // { actions: ["pubsub.topics.publish"], roles: ["roles/pubsub.publisher"] }

The generator writes it beside the services directory (`src/meta`) from the
same `com.distilled.iam#operation` trait.
github-actions Bot added a commit that referenced this pull request Nov 7, 2026
@sam-goodwin sam-goodwin changed the title feat(gcp): every bound operation carries the IAM it is authorized as feat(gcp): publish each bound operation's IAM in meta modules Nov 7, 2026
@sam-goodwin
sam-goodwin force-pushed the feat/gcp-operation-iam branch from d684282 to 77d3f58 Compare November 7, 2026 19:08
github-actions Bot added a commit that referenced this pull request Nov 7, 2026
bundle-lib appended the SDK group import to every module in a wildcard-
exported directory, so a built meta/<service>.js imported _bundle/sdk.js.
A module with no runtime imports now gets none.
github-actions Bot added a commit that referenced this pull request Nov 7, 2026
@Mkassabov
Mkassabov marked this pull request as draft November 16, 2026 06:53
Main's 2026-11-12 GCP specs drop 37 methods that iam.json annotated (Data
Catalog's entry groups, entries and tag-template fields, BeyondCorp
appConnectors.reportStatus, five Assured Workloads compliance-report
methods); their entries are removed. The service modules match main's.
github-actions Bot added a commit that referenced this pull request Nov 17, 2026
github-actions Bot added a commit that referenced this pull request Nov 17, 2026
github-actions Bot added a commit that referenced this pull request Nov 17, 2026
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