Skip to content

fix: add validation for empty ias client id - #283

Merged
NicoleMGomes merged 1 commit into
mainfrom
fix/client-id-agw
Aug 24, 2026
Merged

fix: add validation for empty ias client id#283
NicoleMGomes merged 1 commit into
mainfrom
fix/client-id-agw

Conversation

@NicoleMGomes

@NicoleMGomes NicoleMGomes commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Disclaimer: Do not include SAP-internal or customer-specific information in this PR (e.g. internal system URLs, customer names, tenant IDs, or confidential configurations). This is a public repository.

Description

AgentGatewayClient.get_ias_client_id() previously returned an empty string silently when the IAS clientId was missing from the destination properties (LoB flow) or when client_id was empty in the customer credentials file. Callers had no way to distinguish a valid empty-string result from a misconfiguration, and would typically fail later with an opaque error.

This fix adds explicit validation at both resolution paths:

  • LoB flow (get_ias_client_id_lob in _lob.py): raises AgentGatewaySDKError if the clientId property is absent or empty on the IAS destination.
  • Customer flow (AgentGatewayClient.get_ias_client_id in agw_client.py): raises AgentGatewaySDKError if credentials.client_id is empty after loading the credentials file.

Tests are updated to assert the new error behaviour, and a new test case covers the empty customer client_id scenario.

Related Issue

Closes #

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Code refactoring
  • Dependency update

How to Test

  1. Run the unit tests for the affected classes:
    uv run pytest tests/agentgateway/unit/test_lob.py::TestGetIasClientIdLob tests/agentgateway/unit/test_agw_client.py::TestGetIasClientId -v
    
  2. Confirm all 11 tests pass, including:
    • test_raises_when_client_id_property_absent (LoB flow — missing clientId destination property)
    • test_customer_raises_when_client_id_empty (Customer flow — empty client_id in credentials)
  3. Confirm that when a valid clientId / client_id is present, the value is returned unchanged.

Checklist

  • I have read the Contributing Guidelines
  • I have verified that my changes solve the issue
  • I have added/updated automated tests to cover my changes
  • All tests pass locally
  • I have verified that my code follows the Code Guidelines
  • I have updated documentation (if applicable)
  • I have added type hints for all public APIs
  • My code does not contain sensitive information (credentials, tokens, etc.)
  • I have followed Conventional Commits for commit messages

Additional Notes

This is a purely additive validation change. The happy path (non-empty client_id) is unaffected. Any caller that was previously handling an empty string return now needs to handle AgentGatewaySDKError instead — but in practice no legitimate call site would treat an empty client ID as a success.

@NicoleMGomes
NicoleMGomes requested a review from a team as a code owner August 24, 2026 15:26
@NicoleMGomes
NicoleMGomes merged commit d1bf978 into main Aug 24, 2026
10 of 11 checks passed
@NicoleMGomes
NicoleMGomes deleted the fix/client-id-agw branch August 24, 2026 16:16
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