Skip to content

fix(agentgateway): address sdk-review quality findings from PR #220#230

Open
tiagoek wants to merge 2 commits into
feat/transparent-tls-smahrfrom
fix/agentgateway-quality-smahr
Open

fix(agentgateway): address sdk-review quality findings from PR #220#230
tiagoek wants to merge 2 commits into
feat/transparent-tls-smahrfrom
fix/agentgateway-quality-smahr

Conversation

@tiagoek

@tiagoek tiagoek commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

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

  • Extract _TOKEN_FIELD_CLIENT_ID = "client_id" and _TOKEN_FIELD_ACCESS_TOKEN = "access_token" as module-level constants — eliminates repeated string literals (PY-CON-01)
  • Replace all bare "client_id" and "access_token" occurrences (token request payload, token response parsing, field mappings) with the constants
  • Add from e to raise AgentGatewaySDKError(...) inside except httpx.RequestError blocks to preserve exception cause chain (PY-EL-01)

agw_client.py

  • Extract _LOG_TRANSPARENT_MODE = "Transparent mode credentials detected" constant — eliminates 4× repeated log string (PY-CON-01)

core/_telemetry_compat.py

  • Add TypeVar + type annotations to record_metrics and inner decorator functions (PY-PT-08)
  • Add explicit comment justifying except ImportError suppression — 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

  • All existing tests pass unchanged
  • No import errors on module load with or without telemetry packages installed

tiagoek added 2 commits July 15, 2026 14:09
… 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).
@tiagoek tiagoek requested a review from a team as a code owner July 15, 2026 12:10
@tiagoek tiagoek changed the base branch from main to feat/transparent-tls-smahr July 15, 2026 12:28
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.

1 participant