fix(agentgateway): address sdk-review quality findings from PR #220#230
Open
tiagoek wants to merge 2 commits into
Open
fix(agentgateway): address sdk-review quality findings from PR #220#230tiagoek wants to merge 2 commits into
tiagoek wants to merge 2 commits into
Conversation
… PT-08) - Extract _TOKEN_FIELD_CLIENT_ID and _TOKEN_FIELD_ACCESS_TOKEN constants in _customer.py - Extract _LOG_TRANSPARENT_MODE constant in agw_client.py - Add `from e` to raise in token request error handlers - Add type annotations and justify ImportError suppression in _telemetry_compat.py
Use _TOKEN_FIELD_CLIENT_ID in required_vars and required_fields mappings to eliminate remaining bare 'client_id' string literals (PY-CON-01).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Quality improvements surfaced by sdk-review on the code introduced in PR #220 (Transparent TLS + ServiceBinding Envelope Support by @smahr). This PR is intended to be reviewed alongside #220 and merged after it.
Changes (no functional impact):
_customer.py_TOKEN_FIELD_CLIENT_ID = "client_id"and_TOKEN_FIELD_ACCESS_TOKEN = "access_token"as module-level constants — eliminates repeated string literals (PY-CON-01)"client_id"and"access_token"occurrences (token request payload, token response parsing, field mappings) with the constantsfrom etoraise AgentGatewaySDKError(...)insideexcept httpx.RequestErrorblocks to preserve exception cause chain (PY-EL-01)agw_client.py_LOG_TRANSPARENT_MODE = "Transparent mode credentials detected"constant — eliminates 4× repeated log string (PY-CON-01)core/_telemetry_compat.pyTypeVar+ type annotations torecord_metricsand innerdecoratorfunctions (PY-PT-08)except ImportErrorsuppression — this is an intentional optional-dependency shim; re-raising would break the no-op fallback for Kyma deployments without telemetry (PY-EL-02)Depends on
Test plan