Skip to content

Autorest to Typespec migration of 3 Preview API versions for azure-ai-ml#47392

Open
saanikaguptamicrosoft wants to merge 10 commits into
Azure:mainfrom
saanikaguptamicrosoft:saanika/tsp_migration_2
Open

Autorest to Typespec migration of 3 Preview API versions for azure-ai-ml#47392
saanikaguptamicrosoft wants to merge 10 commits into
Azure:mainfrom
saanikaguptamicrosoft:saanika/tsp_migration_2

Conversation

@saanikaguptamicrosoft

@saanikaguptamicrosoft saanikaguptamicrosoft commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Testing:

Description

Please add an informative description that covers that changes made by the pull request and link all relevant issues.

If an SDK is being regenerated based on a new API spec, a link to the pull request containing these API spec changes should be included above.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

- Generate v2020_09_01_dataplanepreview_tsp from TypeSpec
- Flip 6 source imports + 1 test + 1 conftest mock to _tsp module
- Update test_batch_job.py to use TSP Model(dict) instead of msrest deserialize()
- Delete legacy autorest folder
…eview

- v2024_10_01_preview is superseded by v2024_10_01_preview_tsp (already in place)
- v2024_07_01_preview functionality was consolidated into v2024_10_01_preview;
  no consumers remain
- Drop unused mock_aml_services_2024_07_01_preview fixture from conftest.py

Copilot AI 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.

Copilot wasn't able to review this pull request because it exceeds the maximum number of lines (20,000). Try reducing the number of changed lines and requesting a review from Copilot again.

- Regenerate new TSP client v2023_02_01_preview_tsp from spec
  MachineLearningServices.Management.v2023_02_01_preview
- Flip 5 production imports (_ml_client, sweep_sampling_algorithm,
  notification, inferencing_server, conftest fixture) and 2 docstrings
  (_job_operations, _compute_operations)
- TSP client class renamed: AzureMachineLearningWorkspaces -> MachineLearningServicesClient
  (local alias ServiceClient022023Preview preserved)
- Delete legacy autorest folder v2023_02_01_preview
- Regenerate new TSP client v2022_02_01_preview_tsp from spec
  MachineLearningServices.Management.v2022_02_01_preview
- Flip 16 production imports (_ml_client, entities/_util, sweep_termination,
  sweep_fields_provider, _online_endpoint_operations, _online_deployment_operations,
  _local_job_invoker, _job_ops_helper, _asset_utils, import_node, parallel_job,
  import_job, online_endpoint, online_deployment schema, deployment, endpoint schema)
- Flip 4 test imports (conftest fixture, test_endpoint_entity, test_online_endpoints,
  test_deployment_entity inline import) and convert 3 .deserialize() call sites in
  test_endpoint_entity + test_deployment_entity to TSP-compatible _deserialize(Model, dict)
  (free helper)
- Drop dead endpoint= kwarg from RestOnlineEndpoint construction in
  online_endpoint._to_rest_online_endpoint_traffic_update; field doesn't exist
  on OnlineEndpointDetails (TSP rejects unknown kwargs; autorest silently swallowed)
- TSP client class renamed: AzureMachineLearningWorkspaces -> MachineLearningServicesClient
  (local alias ServiceClient022022Preview preserved)
- Delete legacy autorest folder v2022_02_01_preview
RestAzureMLOnlineInferencingServer was bound twice in the module: first
from v2023_02_01_preview_tsp and then re-imported from v2023_08_01_preview.
Python's last-binding-wins rule meant the first import was already dead
code; the v2023_08 binding was the one being used at runtime. Removing
the dead first import. No functional change (verified: the rest class
still resolves to v2023_08_01_preview.models._models_py3 after the change).
ImportJob._to_rest_object() always submits via service_client_01_2025_preview (see JobOperations._create_or_update_with_different_version_api, COMMAND branch). It was historically constructing v2022 autorest CommandJob/JobBaseData and relying on msrest cross-version serialization to produce a v2025-compatible body.

When v2022_02_01_preview was migrated to TSP (commit 06e7793), import_job.py's rest-model imports flipped to v2022 TSP. The v2025 autorest client received a TSP-shaped object (no msrest _attribute_map; rest_field descriptors) and emitted a body shape that no longer matched recordings, producing test-proxy 404s with body diff '.properties.isArchived: Missing in record JSON' on the 3 import_job e2e tests (test_import_job_submit_cancel, test_import_node_submit_cancel, test_import_job_download).

Fix: import CommandJob and JobBase from v2025_01_01_preview directly. Same-version end-to-end (entity model matches the api-version actually invoked), no msrest cross-version coupling, and v2025 autorest is what main was effectively producing on the wire pre-PR. v2022 TSP migration intent preserved (v2022 autorest folder remains deleted).
…ber on TSP .serialize/.deserialize callsites
…eserialize(d) -> ._deserialize(d, []); drop pylint suppressions
@saanikaguptamicrosoft saanikaguptamicrosoft changed the title Autorest to Typespec migration of Preview API versions for azure-ai-ml Autorest to Typespec migration of 3 Preview API versions for azure-ai-ml Jun 9, 2026
…1_preview_tsp op

The dispatch in _batch_deployment_operations.py routes pipeline batch deployments
to service_client_02_2023_preview.batch_deployments (TSP-migrated in 425393c).
That op serializes body= via SdkJSONEncoder, which TypeErrors on the legacy
msrest v2024_01_01_preview.BatchDeployment that _to_rest_object() returned.

- pipeline_component_batch_deployment.py: import BatchDeployment / BatchDeploymentProperties /
  BatchPipelineComponentDeploymentConfiguration / IdAssetReference from
  v2023_02_01_preview_tsp.models. _to_rest_object body is now TSP-native (encoder
  serializes cleanly). _from_rest_object uses proper field access
  (deployment_configuration.component_id.asset_id) instead of msrest
  additional_properties dict-digging.
- test_pipeline_component_bach_deployment.py: imports flipped to TSP, fixture loaded
  via Model._deserialize, and a new test_to_rest_object_is_json_serializable_by_tsp_encoder
  regression test pins the wire-serialization contract that 5 sample-pipelines exposed.
@saanikaguptamicrosoft

Copy link
Copy Markdown
Contributor Author

TODO: tsp-location needs to be updated as tsp is currently in remote branch

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