Skip to content

SDK regeneration - #57

Closed
chiragjn wants to merge 9 commits into
mainfrom
chiragjn-nullable-optional
Closed

SDK regeneration#57
chiragjn wants to merge 9 commits into
mainfrom
chiragjn-nullable-optional

Conversation

@chiragjn

@chiragjn chiragjn commented Jul 29, 2026

Copy link
Copy Markdown
Member

Note

Medium Risk
A major Fern generator bump can change generated client signatures and behavior across the SDK; callers overriding per-request timeouts should prefer timeout but timeout_in_seconds remains supported.

Overview
Regenerates the TrueFoundry Python SDK using Fern CLI 5.109 and fern-python-sdk 5.29.2, tied to API definition commit 6aac95c. .fern/metadata.json records the new toolchain and origin commit.

Docs: README usage examples are shortened (fewer applications.list kwargs and enum imports), matching generator defaults. Per-request timeout docs now use request_options={"timeout": ...} instead of timeout_in_seconds; the client still accepts the old key as a deprecated alias.

Dependencies: poetry.lock is refreshed (e.g. aiohttp 3.14.3, pydantic 2.13.5, httpx-aiohttp 0.1.12). pyproject.toml relaxes httpx-aiohttp from a pinned 0.1.8 to ^0.1.8.

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

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: de281175-8365-4dba-a9c9-8b02053b202d


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chiragjn

Copy link
Copy Markdown
Member Author

@coderabbitai Review this PR

Please specifically point out interface breaking changes. These include but not limited to

  • Some argument was removed from some function that belongs in the public api client.v1...
    You can read reference.md at root of repo to figure out the changed methods. Ignore the internal group
  • breaking changes in types - fields getting removed or type changing
  • types being removed completely
  • enum members getting removed
  • Anything that break code relying on this SDK

@coderabbitai

This comment was marked as outdated.

@chiragjn

This comment was marked as outdated.

@cursor cursor 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.

Cursor Bugbot has reviewed your changes using default effort and found 3 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit e2836b5. Configure here.

Comment thread reference.md
Comment thread reference.md
Comment thread reference.md
@chiragjn

Copy link
Copy Markdown
Member Author

PR #57 breaking-change review (chiragjn-nullable-optional vs main)

Compared merge base e73109c → PR head 35e0a64 (~369 files). Public surface = client.* (no client.v1 prefix in this SDK), package exports, and types/client.internal.* excluded.

Verdict: No public methods were removed. Breaking impact is concentrated in renamed/removed exports, model shape changes, enum member removals, class → union alias conversions, and one renamed client argument with a unit change. This should be treated as a major-version release unless compatibility shims are added.


1. Client method breaking changes

1.1 Renamed argument (Hard)

Method Before After Impact
client.virtual_accounts.regenerate_token grace_period_in_days: float (required) grace_period_in_minutes: float (required) Keyword grace_period_in_days=30 fails. Unit changed30 days ≠ 30 minutes.

This is the only actual removed/renamed method parameter in public client.py signatures (sync + async).

1.2 No removed methods; no other removed arguments

Public method count: 142 → 150. Additions (non-breaking):

  • client.gateway_budgets.* (7 methods)
  • client.agents.create_token, get_token, regenerate_token
  • client.personal_access_tokens.create_for_user

client.virtual_accounts.sync_to_secret_store gains optional force: bool (additive).

1.3 Scalar → sequence narrowing (Soft → Hard at call sites)

These drop Union[T, Sequence[T]] and require a sequence. Typed code and bare-scalar callers break:

Method Parameter(s)
client.agents.list attributes
client.artifact_versions.list run_ids, run_steps
client.clusters.list, get_addons attributes
client.events.get pod_names
client.jobs.list_runs triggered_by, version_numbers
client.logs.get pod_names
client.ml_repos.list attributes
client.model_versions.list run_ids, run_steps
client.secret_groups.list attributes
client.teams.list attributes
client.virtual_accounts.list owned_by_teams
client.workspaces.list attributes

Example: client.agents.list(attributes="id")client.agents.list(attributes=["id"]).

1.4 Request/response type renames on methods (Hard for imports/typing)

Method Before After
client.agents.list AgentsListRequestType ListAgentsRequestType
client.applications.list ApplicationsListRequestDeviceTypeFilter, ApplicationsListRequestLifecycleStage ListApplicationsRequestDeviceTypeFilter, ListApplicationsRequestLifecycleStage
client.users.update_roles ResourceType UpdateUserRolesRequestResourceType
client.applications.cancel_deployment ApplicationsCancelDeploymentResponse CancelDeploymentApplicationsResponse

2. Removed / renamed public exports (Hard)

These fail at import time (from truefoundry_sdk import …):

Removed Replacement / notes
BuildStatus DeploymentBuildStatus (same values: STARTED, SUCCEEDED, FAILED)
IChangeOperation IChangeType (same values: REMOVE, ADD, UPDATE)
ResourceType UpdateUserRolesRequestResourceType (superset; see §3)
GatewayLoggingRule Removed — logging config redesigned
GatewayLoggingWhen Removed — replaced by LoggingWhen (different shape)
AgentsListRequestType ListAgentsRequestType
ApplicationsListRequestDeviceTypeFilter ListApplicationsRequestDeviceTypeFilter
ApplicationsListRequestLifecycleStage ListApplicationsRequestLifecycleStage
ApplicationsCancelDeploymentResponse CancelDeploymentApplicationsResponse

Deleted modules include build_status.py, gateway_logging_rule.py, gateway_logging_when.py, i_change_operation.py, resource_type.py.


3. Enum member removals (Hard)

Enum Removed member(s) Notes
SubjectType EXTERNAL_IDENTITY .visit(external_identity=...) callback removed
RoleBindingSubjectType EXTERNAL_IDENTITY Replaced by new AGENT = "agent" member
RoleWithResourceResourceType EXTERNAL_IDENTITY, SSO_BASED_IDENTITY .visit(...) callbacks removed
ResourceType / UpdateUserRolesRequestResourceType EXTERNAL_IDENTITY, SSO_BASED_IDENTITY Removed with type rename

Exhaustive .visit(...) dispatch over old members will fail at import/call time.


4. Class → union alias conversions (Hard)

Previously instantiable models are now typing.Union aliases. Old constructor calls break:

TrueFoundryAgentMcpServer

Before: single Pydantic model (name, preload, tool lists).

After:

TrueFoundryAgentMcpServer = Union[
    TrueFoundryAgentMcpServerRegistry,  # type="truefoundry-mcp-registry"
    TrueFoundryAgentMcpServerInline,    # type="inline", url=...
]

TrueFoundryAgentMcpServer(name="...") no longer works.

TrueFoundryAgentSkill

Before: model with fqn, preload.

After:

TrueFoundryAgentSkill = Union[
    TrueFoundryAgentTrueFoundrySkill,  # type="truefoundry-skills-registry"
    TrueFoundryAgentGitSourceSkill,    # type="git", url=...
]

SecretStoreConfig

Before: Pydantic model.

After: SecretStoreConfig = Union[SecretStoreIntegrationConfig, TfySecretsConfig]


5. Model / field shape breaking changes (Hard)

5.1 GatewayLoggingConfig — full redesign

Before After
Required rules: List[GatewayLoggingRule] name: str, log: bool
Conditions Per-rule GatewayLoggingWhen Top-level when: Optional[LoggingWhen] (subjects/models as InNotIn, plus metadata)
Added redact_with: Optional[Redaction]

Any code reading/writing .rules breaks.

5.2 TrueFoundryAgentUserMessage

Before After
role: Literal["user"] removed
type: Literal["user.message"]

5.3 BudgetV2Alert

  • notify_breaching_user: Optional[bool] removed

5.4 IdentityProviderBackedIdentity.type discriminator

Before After
"idp-backed" "identity-provider-backed"

Breaks hard-coded discriminator checks and serialized payloads using the old literal.

5.5 TrueFoundryApplyResponse.data

Before After
Optional[Dict[str, Any]] Optional[TrueFoundryApplyResponseData] (typed union of entity models)

Dict subscript access (response.data["id"]) may break depending on runtime type.

5.6 Deployment.deployment_builds

Before After
Optional[List[BuildInfo]] Optional[List[DeploymentBuild]]

DeploymentBuild is a much richer type (nested BuildInfo, DeploymentBuildStatus, URLs, timestamps, etc.). Code expecting flat {name, status: float} objects breaks.

5.7 SparkJob

Field Before After
driver_config SparkDriverConfig SparkJobDriverConfig
executor_config SparkExecutorConfig SparkJobExecutorConfig
new optional trigger: SparkJobTrigger

5.8 Field type renames (import / annotation breaks)

Type.field Before After
DeploymentBuild.status BuildStatus DeploymentBuildStatus
IChange.type IChangeOperation IChangeType
GcpGkeIntegration.location GcpRegion GcpGkeIntegrationLocation (superset)
Subject.subject_type SubjectType SubjectSubjectType (lacks EXTERNAL_IDENTITY)
GatewayDataCreatedByFilter.operator Literal["IN"] GatewayDataCreatedByFilterOperator
GatewayDataMetadataFilter.operator Literal["IN"] GatewayDataMetadataFilterOperator

6. Non-breaking / additive (for context)

  • RequestOptions: timeout added; timeout_in_seconds kept as deprecated alias (backward compatible).
  • Many collaborators fields widened from required List[...]Optional[List[...]].
  • VirtualAccountManifest.permissions widened to optional.
  • PySparkTaskConfig.image: TaskPySparkBuildUnion[TaskPySparkBuild, TaskSparkImage] (widening).
  • Many new types/APIs (gateway budgets, agent channels, guardrails, etc.).

7. Migration priority

  1. Replace imports for removed symbols (§2).
  2. Update virtual_accounts.regenerate_token(grace_period_in_days=…)grace_period_in_minutes=… and recompute the value (days → minutes).
  3. Stop using EXTERNAL_IDENTITY / SSO_BASED_IDENTITY enum members and update .visit(...) handlers.
  4. Rewrite GatewayLoggingConfig away from rules / GatewayLoggingRule.
  5. Update agent manifests: MCP servers and skills need discriminated variants with type; user messages use type="user.message" not role="user".
  6. Wrap bare scalars in lists for list-filter params (§1.3).
  7. Update IdentityProviderBackedIdentity discriminator to "identity-provider-backed".
  8. Revisit client.apply response handling if data was treated as a dict.
  9. Update Deployment.deployment_builds consumption for the new DeploymentBuild shape.

Bottom line: Methods are intact, but this PR has substantial interface-breaking surface across types, enums, exports, and one client argument rename with a semantic unit change. Recommend a major semver bump or restoring compatibility aliases/adapters for the removed public names and model shapes.

@chiragjn chiragjn closed this Aug 31, 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.

2 participants