Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 29, 2025

The data-plane client's patched default (2022-05-13) was stale relative to generated configuration (2024-12-09-preview), and management plane docstrings incorrectly claimed 2020-12-01-preview while actual default is 2024-09-19-preview.

Changes

Data-plane clients (azure-confidentialledger/_patch.py, aio/_patch.py):

  • Set default api_version to 2024-12-09-preview to match generated _configuration.py
  • Updated docstrings to reflect new default

Management-plane clients (azure-mgmt-confidentialledger/_confidential_ledger.py, aio/_confidential_ledger.py):

  • Fixed docstrings to state actual default 2024-09-19-preview (not 2020-12-01-preview)
  • Documented availability of 2025-06-10-preview for opt-in use

Tests (tests/test_api_version.py):

  • Added verification that defaults align with configuration and docstrings are accurate

Example

# Before: client used stale 2022-05-13 default (misaligned with generated config)
# After: client uses 2024-12-09-preview by default
client = ConfidentialLedgerClient(
    endpoint="https://my-ledger.confidential-ledger.azure.com",
    credential=credential,
    ledger_certificate_path="cert.pem"
)
# client._config.api_version == "2024-12-09-preview"

# Explicit override still works for backward compatibility
client = ConfidentialLedgerClient(..., api_version="2022-05-13")

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • pypi.org
    • Triggering command: /home/REDACTED/work/azure-sdk-for-python/azure-sdk-for-python/.venv/bin/python /home/REDACTED/work/azure-sdk-for-python/azure-sdk-for-python/.venv/lib/python3.9/site-packages/pip/__pip-REDACTED__.py install --ignore-installed --no-user --prefix /tmp/pip-build-env-lo7xwq46/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i REDACTED -- setuptools>=77.0.3 wheel (dns block)
    • Triggering command: /home/REDACTED/work/azure-sdk-for-python/azure-sdk-for-python/.venv/bin/python /home/REDACTED/work/azure-sdk-for-python/azure-sdk-for-python/.venv/bin/pip install isodate azure-core typing-extensions cryptography (dns block)
  • scanning-api.github.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Summary

Align data-plane ConfidentialLedgerClient default api_version to latest preview (2024-12-09-preview) and fix management plane client docstring to reflect actual default (2024-09-19-preview) and mention newer spec (2025-06-10-preview). This resolves documented drift between generated configuration and patched client plus misleading docstrings.

Background / Citations

  • Patched data-plane default currently 2022-05-13 (sdk/confidentialledger/azure-confidentialledger/azure/confidentialledger/_patch.py:55-76)
  • Generated configuration uses 2024-12-09-preview (sdk/confidentialledger/azure-confidentialledger/azure/confidentialledger/_configuration.py:16-44)
  • Management client docstring claims 2020-12-01-preview (sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/_confidential_ledger.py:30-44) while default api_version kwarg is 2024-09-19-preview.
  • Newer spec preview version enumerated in azure-rest-api-specs (specification/confidentialledger/Confidentialledger.Management/main.tsp:31-46) includes 2025-06-10-preview.

Risks

  • Inconsistent default API version may lead to unsupported feature usage or missing security patches (CWE-668 Versioning; OWASP A06 Misconfiguration).
  • Misleading docstring could cause clients to pin to outdated preview inadvertently.

Changes (Unified Diffs)

--- a/sdk/confidentialledger/azure-confidentialledger/azure/confidentialledger/_patch.py
+++ b/sdk/confidentialledger/azure-confidentialledger/azure/confidentialledger/_patch.py
@@ class ConfidentialLedgerClient(GeneratedClient):
-    :keyword api_version: Api Version. Default value is "2022-05-13". Note that overriding this
-     default value may result in unsupported behavior.
+    :keyword api_version: API version for Confidential Ledger operations. Default value is "2024-12-09-preview".
+        This aligns with the latest preview specification. Overriding may lead to unsupported behavior.
@@
-    def __init__(
-        self,
-        endpoint: str,
+    def __init__(
+        self,
+        endpoint: str,
         credential: Union[
             "ConfidentialLedgerCertificateCredential",
             "TokenCredential"
         ],
         **kwargs: Any
     ):
-        api_version = kwargs.pop("api_version", "2022-05-13")
+        # Align default to latest preview used by generated configuration
+        api_version = kwargs.pop("api_version", "2024-12-09-preview")
         ledger_certificate_path = kwargs.pop("ledger_certificate_path", None)
         # (rest of method unchanged)
--- a/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/_confidential_ledger.py
+++ b/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/_confidential_ledger.py
@@
-    """Microsoft Azure Confidential Compute Ledger Control Plane REST API version 2020-12-01-preview.
+    """Microsoft Azure Confidential Compute Ledger Control Plane.
+
+    Default REST API version: 2024-09-19-preview.
+    A newer preview (2025-06-10-preview) is available in published TypeSpec; specify api_version to opt-in.
     :ivar operations: Operations operations

(Consider analogous change for aio version below)

--- a/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/aio/_confidential_ledger.py
+++ b/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/aio/_confidential_ledger.py
@@
-    """Microsoft Azure Confidential Compute Ledger Control Plane REST API version 2020-12-01-preview.
+    """Microsoft Azure Confidential Compute Ledger Control Plane.
+
+    Default REST API version: 2024-09-19-preview.
+    Newer preview (2025-06-10-preview) available; set api_version explicitly to use it.
     :ivar operations: Operations operations

Tests

Add unit test verifying new default:

def test_default_api_version_data_plane():
    from azure.confidentialledger import ConfidentialLedgerClient
    class DummyCred:
        def get_token(self, *_, **__):
            return type("T", (), {"token":"abc","expires_on":0})()
    client = ConfidentialLedgerClient(endpoint="https://example.confidential-ledger.azure.com", credential=DummyCred(), ledger_certificate_path="cert.pem")
    assert client._config.api_version == "2024-12-09-preview"

Docstring reflection test for management client:

def test_mgmt_client_docstring_mentions_version():
    from azure.mgmt.confidentialledger import ConfidentialLedger as MgmtClient
    assert "2024-09-19-preview" in MgmtClient.__doc__

Validation Steps

  1. Install modified package locally (pip install -e). Create client without api_version; check client._config.api_version.
  2. Override api_version to older preview and ensure operations still succeed.
  3. Search for "2020-12-01-preview" removed from mgmt client docstring.

Rollback

Revert diff hunks if downstream integration tests fail; restore previous api_version string...

This pull request was created as a result of the following prompt from Copilot chat.

Summary

Align data-plane ConfidentialLedgerClient default api_version to latest preview (2024-12-09-preview) and fix management plane client docstring to reflect actual default (2024-09-19-preview) and mention newer spec (2025-06-10-preview). This resolves documented drift between generated configuration and patched client plus misleading docstrings.

Background / Citations

  • Patched data-plane default currently 2022-05-13 (sdk/confidentialledger/azure-confidentialledger/azure/confidentialledger/_patch.py:55-76)
  • Generated configuration uses 2024-12-09-preview (sdk/confidentialledger/azure-confidentialledger/azure/confidentialledger/_configuration.py:16-44)
  • Management client docstring claims 2020-12-01-preview (sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/_confidential_ledger.py:30-44) while default api_version kwarg is 2024-09-19-preview.
  • Newer spec preview version enumerated in azure-rest-api-specs (specification/confidentialledger/Confidentialledger.Management/main.tsp:31-46) includes 2025-06-10-preview.

Risks

  • Inconsistent default API version may lead to unsupported feature usage or missing security patches (CWE-668 Versioning; OWASP A06 Misconfiguration).
  • Misleading docstring could cause clients to pin to outdated preview inadvertently.

Changes (Unified Diffs)

--- a/sdk/confidentialledger/azure-confidentialledger/azure/confidentialledger/_patch.py
+++ b/sdk/confidentialledger/azure-confidentialledger/azure/confidentialledger/_patch.py
@@ class ConfidentialLedgerClient(GeneratedClient):
-    :keyword api_version: Api Version. Default value is "2022-05-13". Note that overriding this
-     default value may result in unsupported behavior.
+    :keyword api_version: API version for Confidential Ledger operations. Default value is "2024-12-09-preview".
+        This aligns with the latest preview specification. Overriding may lead to unsupported behavior.
@@
-    def __init__(
-        self,
-        endpoint: str,
+    def __init__(
+        self,
+        endpoint: str,
         credential: Union[
             "ConfidentialLedgerCertificateCredential",
             "TokenCredential"
         ],
         **kwargs: Any
     ):
-        api_version = kwargs.pop("api_version", "2022-05-13")
+        # Align default to latest preview used by generated configuration
+        api_version = kwargs.pop("api_version", "2024-12-09-preview")
         ledger_certificate_path = kwargs.pop("ledger_certificate_path", None)
         # (rest of method unchanged)
--- a/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/_confidential_ledger.py
+++ b/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/_confidential_ledger.py
@@
-    """Microsoft Azure Confidential Compute Ledger Control Plane REST API version 2020-12-01-preview.
+    """Microsoft Azure Confidential Compute Ledger Control Plane.
+
+    Default REST API version: 2024-09-19-preview.
+    A newer preview (2025-06-10-preview) is available in published TypeSpec; specify api_version to opt-in.
     :ivar operations: Operations operations

(Consider analogous change for aio version below)

--- a/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/aio/_confidential_ledger.py
+++ b/sdk/confidentialledger/azure-mgmt-confidentialledger/azure/mgmt/confidentialledger/aio/_confidential_ledger.py
@@
-    """Microsoft Azure Confidential Compute Ledger Control Plane REST API version 2020-12-01-preview.
+    """Microsoft Azure Confidential Compute Ledger Control Plane.
+
+    Default REST API version: 2024-09-19-preview.
+    Newer preview (2025-06-10-preview) available; set api_version explicitly to use it.
     :ivar operations: Operations operations

Tests

Add unit test verifying new default:

def test_default_api_version_data_plane():
    from azure.confidentialledger import ConfidentialLedgerClient
    class DummyCred:
        def get_token(self, *_, **__):
            return type("T", (), {"token":"abc","expires_on":0})()
    client = ConfidentialLedgerClient(endpoint="https://example.confidential-ledger.azure.com", credential=DummyCred(), ledger_certificate_path="cert.pem")
    assert client._config.api_version == "2024-12-09-preview"

Docstring reflection test for management client:

def test_mgmt_client_docstring_mentions_version():
    from azure.mgmt.confidentialledger import ConfidentialLedger as MgmtClient
    assert "2024-09-19-preview" in MgmtClient.__doc__

Validation Steps

  1. Install modified package locally (pip install -e). Create client without api_version; check client._config.api_version.
  2. Override api_version to older preview and ensure operations still succeed.
  3. Search for "2020-12-01-preview" removed from mgmt client docstring.

Rollback

Revert diff hunks if downstream integration tests fail; restore previous api_version string "2022-05-13" and docstring line.

Checklist

  • Citations included.
  • No secrets.
  • Backward compatible (older version still selectable).
  • Tests provided.

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…ients

Co-authored-by: PallabPaul <20746357+PallabPaul@users.noreply.github.com>
Copilot AI changed the title [WIP] Align ConfidentialLedgerClient api_version and fix docstrings Align Confidential Ledger API version defaults with generated configuration and fix management plane docstrings Oct 29, 2025
Copilot finished work on behalf of PallabPaul October 29, 2025 03:34
Copilot AI requested a review from PallabPaul October 29, 2025 03:34
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