Azure / Azure/connectors-python-sdk

Align retry safety for mutating connector operations across SDKs

オープン
#85 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
enhancement
主要言語
Python
スター
0
フォーク
3
平均マージ
2日 2時間
マージ済み PR(30日)
11

説明

## Description

Align the Python Connector SDK's retry safety contract with the Node.js SDK behavior introduced in [Azure/Connectors-NodeJS-SDK PR #91](https://github.com/Azure/Connectors-NodeJS-SDK/pull/91).

At `main` commit `d273862108d16615009572d730c12950be040a8c`, `ConnectorHttpClient._send_with_retry` retries every HTTP method for `429`, every `5xx` response, and `aiohttp.ClientError`. `ConnectorClientOptions` exposes retry counts and backoff settings but has no method-safety setting. A POST, PUT, PATCH, or DELETE connector action can therefore be submitted again after the service committed it but returned a transient response, or after an ambiguous transport failure.

The cross-language Connector SDK contract should be:

- Retry safe methods (`GET`, `HEAD`, `OPTIONS`, and `TRACE`) according to the configured retry policy.
- Do not automatically retry unsafe methods (`POST`, `PUT`, `PATCH`, and `DELETE`) by default.
- Provide an explicit, language-idiomatic per-client opt-in for applying the configured retry policy to unsafe methods, equivalent to Node.js `retryUnsafeHttpMethods`.
- Preserve the current retry-count, delay, timeout, and exponential-backoff options.

## Motivation

Connector operations include side-effecting actions such as sending messages and creating meetings, chats, channels, or files. Automatically replaying a completed action can duplicate customer-visible effects. This risk and the desired explicit opt-in are protocol-level concerns, not Node.js-specific behavior.

Consistent defaults across the .NET, Python, and Node.js Connector SDKs make client behavior predictable when customers move the same connector integration between languages.

## Acceptance criteria

- Add a `ConnectorClientOptions` setting with Python-idiomatic naming for opting unsafe HTTP methods into retries.
- Safe methods retain the configured retry behavior by default.
- Unsafe methods make one attempt by default for both transient HTTP responses and `aiohttp.ClientError` failures.
- Unsafe methods use the configured retry behavior when explicitly enabled.
- Add focused tests proving at least:
- a transient GET is retried;
- a transient POST is sent once by default;
- a transient POST is retried when explicitly enabled;
- PUT, PATCH, and DELETE follow the unsafe classification.
- Document the default and opt-in behavior in API documentation and release notes.
- Confirm whether implementation is confined to hand-written runtime/options code. Generated-client regeneration is not expected because generated clients use the shared `ConnectorHttpClient` and `ConnectorClientOptions` runtime surface.

## Related work

- Node.js implementation: [Azure/Connectors-NodeJS-SDK PR #91](https://github.com/Azure/Connectors-NodeJS-SDK/pull/91)
- .NET alignment: [Azure/Connectors-NET-SDK issue #269](https://github.com/Azure/Connectors-NET-SDK/issues/269)

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

ConnectorHttpClient._send_with_retry と ConnectorClientOptions から始め、既存の retry テストと、生成されたクライアントが使用する共有の runtime/options サーフェスを調べます。opt-in パスを含め、安全なメソッドと安全でないメソッドを対象とした集中的なカバレッジを追加し、デフォルトの動作と opt-in の動作が文書化されるように API ドキュメントとリリースノートを更新します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
nodejs, python
領域
api
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
活発
明瞭さ
明確に書かれている
初心者へのやさしさ
68/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。