Skip to content

chore(spec): prune unused component schemas from the SDK client bundles - #1803

Merged
bchalios merged 2 commits into
mainfrom
spec/prune-unused-components
Sep 7, 2026
Merged

chore(spec): prune unused component schemas from the SDK client bundles#1803
bchalios merged 2 commits into
mainfrom
spec/prune-unused-components

Conversation

@bchalios

@bchalios bchalios commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Gap: redocly.yaml filters the synced REST spec down to the SDK-facing operations by tag, but never prunes component schemas, so every schema in the spec lands in both generated clients — admin, cluster/rig, node, team-API-key and access-token models no SDK endpoint uses. Surfaced by review on #1800, where the spec bump dragged the new Rig* schemas into schema.gen.ts and the Python models.

Change: remove-unused-components: on for the js-sdk and python-sdk bundles, matching what the envd and volume bundles already do. Regenerated with make codegen.

  • schema.gen.ts: 20 unused schemas removed, no additions
  • Python api/client/models: 22 model files removed, __init__.py exports pruned
  • Once this merges, feat: onResume option on connect/resume #1800 regenerates without the Rig* models

Visible removal, classified minor: the JS components namespace is re-exported from the entry point and the Python models package is importable, so the removed type names disappear for anyone who imported them directly. The changeset lists every name. No SDK method ever accepted or returned these types (they belong to admin/cluster endpoints the SDKs do not expose), and prior generated-model removals shipped as minor (#1146, #821), so this follows that precedent rather than a major bump.

Verification: no SDK or CLI source references a removed type — grep over packages/js-sdk/src, packages/cli/src, packages/python-sdk/e2b (the CLI's components['schemas']['Team'] is unaffected: the js-sdk bundle keeps auth, so Team stays). tsc --noEmit on js-sdk clean; import e2b and the models package import clean (79 models). Generated files were produced by the same Docker codegen CI runs.

The js-sdk and python-sdk Redocly bundles keep operations by tag but never
pruned component schemas, so every schema in the synced spec landed in both
generated clients — admin, cluster/rig, node, team-API-key and access-token
models that no SDK endpoint references. The envd and volume bundles already
run remove-unused-components; turn it on for the two SDK bundles too.

Regenerated with `make codegen`: schema.gen.ts loses 20 unused schemas,
the Python client loses 22 model files. No SDK or CLI source references any
removed type (the CLI's use of `Team` stays — the js-sdk bundle keeps `auth`).
js-sdk `tsc --noEmit` clean; `import e2b` clean.

Signed-off-by: Babis Chalios <babis.chalios@e2b.dev>
@cla-bot cla-bot Bot added the cla-signed label Sep 4, 2026
@cursor

cursor Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

PR Summary

Low Risk
Codegen and generated-type cleanup only; runtime SDK behavior is unchanged unless consumers imported removed schema names directly.

Overview
Enables remove-unused-components: on on the js-sdk and python-sdk Redocly bundles (same as envd/volume), so generated clients only keep schemas referenced by SDK-exposed operations—not admin, cluster/node, team API key, or access-token types that tag filtering already hid from the API surface.

Regenerated clients drop those types: JS components['schemas'] in schema.gen.ts (plus unused parameters and the 410 response entry), and Python deletes the corresponding e2b.api.client.models modules and __init__.py exports. A minor changeset documents the breaking type-name removals for direct importers; normal SDK method usage is unchanged because no public methods used these models.

Reviewed by Cursor Bugbot for commit 09b4dc1. Bugbot is set up for automated code reviews on this repo. Configure here.

@changeset-bot

changeset-bot Bot commented Sep 4, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 09b4dc1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
e2b Minor
@e2b/python-sdk Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Package Artifacts

Built from 79da243. Download artifacts from this workflow run.

JS SDK (e2b@2.46.2-spec-prune-unused-components.0):

npm install ./e2b-2.46.2-spec-prune-unused-components.0.tgz

CLI (@e2b/cli@2.18.1-spec-prune-unused-components.0):

npm install ./e2b-cli-2.18.1-spec-prune-unused-components.0.tgz

Code Interpreter JS SDK (@e2b/code-interpreter@2.7.3-spec-prune-unused-components.0):

npm install ./e2b-code-interpreter-2.7.3-spec-prune-unused-components.0.tgz

Desktop JS SDK (@e2b/desktop@2.3.5-spec-prune-unused-components.0):

npm install ./e2b-desktop-2.3.5-spec-prune-unused-components.0.tgz

Python SDK (e2b==2.46.4+spec.prune.unused.components):

pip install ./e2b-2.46.4+spec.prune.unused.components-py3-none-any.whl

Code Interpreter Python SDK (e2b-code-interpreter==2.9.3+spec.prune.unused.components):

pip install ./e2b_code_interpreter-2.9.3+spec.prune.unused.components-py3-none-any.whl

Desktop Python SDK (e2b-desktop==2.4.6+spec.prune.unused.components):

pip install ./e2b_desktop-2.4.6+spec.prune.unused.components-py3-none-any.whl

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TASTE.md compliance review: no violations found. Checked the changed files (redocly.yaml, schema.gen.ts, Python api/client/models/*, changeset) against the public-surface rules (T-18 generated types never reach users, T-54 flat entry points, T-65/T-66 deprecation). The PR only removes generated schemas that no SDK-facing operation references; no public SDK export changes (Team is still kept in the js-sdk bundle via the auth tag for the CLI's asFormattedTeam), so nothing needs a deprecated alias.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d3336d6591

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread .changeset/prune-unused-schemas.md Outdated

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, straightforward config change with regenerated outputs.

What was reviewed: the redocly.yaml diff enabling remove-unused-components: on for both bundles; confirmed Team schema is retained in schema.gen.ts (still needed by the CLI's format.ts via the auth tag) while Node/NodeDetail/TeamAPIKey/etc. are gone; grepped packages/js-sdk/src, packages/cli/src, and packages/python-sdk/e2b for the 22 removed Python model names and all removed JS schema names — no references outside the generated files; checked the Python models/__init__.py imports/__all__ are internally consistent with no dangling entries. The async Python client (client_async) just re-exports the sync client's models, so there's no parity gap to fix there.

Extended reasoning...

Overview

This PR is a narrow, mechanical change: it flips on remove-unused-components: on in redocly.yaml for the js-sdk and python-sdk bundle configs, then re-runs make codegen to regenerate packages/js-sdk/src/api/schema.gen.ts and packages/python-sdk/e2b/api/client/models/*. The net effect is that component schemas unreferenced by the SDK-exposed operation tags (admin, cluster/rig, node, team-API-key, access-token models) are pruned from both generated clients. A changeset correctly marks this as a patch for e2b and @ e2b/python-sdk.

Security risks

None. This only removes unused generated type definitions/models from client bundles; it does not touch any request/response logic, auth handling, or runtime behavior.

Level of scrutiny

Low-to-moderate scrutiny is warranted given this modifies generated client code and touches the public package surface (hence the changeset), but the change itself is purely subtractive and config-driven, not hand-crafted logic. I verified the two claims most likely to hide a real regression: (1) that Team is still exported from the js-sdk schema despite pruning, since the CLI depends on components['schemas']['Team'] — confirmed it's present at line 2720 of schema.gen.ts; and (2) that none of the 22 removed Python models or the pruned JS schema names are referenced anywhere outside the generated files in js-sdk/src, cli/src, or python-sdk/e2b — confirmed via targeted greps, none found. I also checked the Python models/__init__.py for consistency between its imports and __all__ tuple (matches, no dangling names) and confirmed the async Python client is a thin re-export of the sync client's models rather than a separate generated tree, so no parity gap exists between sync/async Python as required by CLAUDE.md.

Other factors

No spec/ files were hand-edited (only redocly.yaml, which governs post-sync bundling, and generated outputs) — consistent with the repo's Copybara-sync convention. The changeset is present and correctly scoped as a patch. The diff is purely subtractive (2265 deletions vs 14 insertions), self-contained, and matches the PR description precisely, which raises confidence this is a straightforward, correct regeneration rather than a hand-pruned or partially-applied change.

The generated `components` namespace is re-exported from the JS entry point
and the Python models package is importable, so the removal is visible to
anyone who imported those names. State that plainly, list the names, and
classify as minor — the level earlier generated-model removals (#1146, #821)
shipped at.

Signed-off-by: Babis Chalios <babis.chalios@e2b.dev>
@bchalios
bchalios merged commit 043d050 into main Sep 7, 2026
76 of 78 checks passed
@bchalios
bchalios deleted the spec/prune-unused-components branch September 7, 2026 10:08
bchalios added a commit that referenced this pull request Sep 7, 2026
Conflicts were confined to generated files; resolved by re-running
`make codegen` against the merged spec. The Rig/admin/access-token models
that the spec bump had dragged into this branch are gone; the two `memory`
fields remain in both generated clients.

Signed-off-by: Babis Chalios <babis.chalios@e2b.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants