Skip to content

Commit 756099c

Browse files
Merge branch 'main' into impl-user-token-caching
2 parents f543795 + 45a9003 commit 756099c

7 files changed

Lines changed: 31 additions & 31 deletions

File tree

.env_integration_tests.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ CLOUD_SDK_CFG_DESTINATION_DEFAULT_IDENTITYZONE=your-identity-zone-here
1717
CLOUD_SDK_CFG_SDM_DEFAULT_URI=https://your-sdm-api-uri-here
1818
CLOUD_SDK_CFG_SDM_DEFAULT_UAA='{"url":"https://your-auth-url","clientid":"your-client-id","clientsecret":"your-client-secret","identityzone":"your-identity-zone"}'
1919

20-
CLOUD_SDK_CFG_HANA_AGENT_MEMORY_DEFAULT_URL=https://your-agent-memory-api-url-here
20+
CLOUD_SDK_CFG_HANA_AGENT_MEMORY_DEFAULT_APPLICATION_URL=https://your-agent-memory-api-url-here
2121
CLOUD_SDK_CFG_HANA_AGENT_MEMORY_DEFAULT_UAA='{"url":"https://your-auth-url","clientid":"your-client-id","clientsecret":"your-client-secret"}'

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ For new features or capabilities:
120120
├── client.py
121121
├── config.py
122122
├── exceptions.py
123-
├── models.py
123+
├── _models.py
124124
├── py.typed
125125
└── user-guide.md
126126
```

docs/INTEGRATION_TESTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ For Agent Memory integration tests, configure the following variables in `.env_i
7070

7171
```bash
7272
# Agent Memory Configuration
73-
CLOUD_SDK_CFG_HANA_AGENT_MEMORY_DEFAULT_URL=https://your-agent-memory-api-url
73+
CLOUD_SDK_CFG_HANA_AGENT_MEMORY_DEFAULT_APPLICATION_URL=https://your-agent-memory-api-url
7474
CLOUD_SDK_CFG_HANA_AGENT_MEMORY_DEFAULT_UAA='{"url":"https://your-auth-url","clientid":"your-client-id","clientsecret":"your-client-secret"}'
7575
```
7676

src/sap_cloud_sdk/agent_memory/config.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
66
Mount path convention::
77
8-
/etc/secrets/appfnd/hana-agent-memory/default/url
8+
/etc/secrets/appfnd/hana-agent-memory/default/application_url
99
/etc/secrets/appfnd/hana-agent-memory/default/uaa
1010
11-
``url`` is the Agent Memory service base URL (plain string).
11+
``application_url`` is the Agent Memory service base URL (plain string).
1212
``uaa`` is a JSON string with OAuth2 credentials containing at minimum:
1313
``clientid``, ``clientsecret``, and ``url`` (UAA base URL).
1414
1515
Env fallback convention::
1616
17-
CLOUD_SDK_CFG_HANA_AGENT_MEMORY_DEFAULT_URL
17+
CLOUD_SDK_CFG_HANA_AGENT_MEMORY_DEFAULT_APPLICATION_URL
1818
CLOUD_SDK_CFG_HANA_AGENT_MEMORY_DEFAULT_UAA
1919
"""
2020

@@ -81,14 +81,14 @@ class BindingData:
8181
All fields must be plain ``str`` to satisfy the resolver contract.
8282
"""
8383

84-
url: str = ""
84+
application_url: str = ""
8585
uaa: str = ""
8686

8787
def validate(self) -> None:
8888
"""Raise ``AgentMemoryConfigError`` if any required field is empty."""
89-
if not self.url:
89+
if not self.application_url:
9090
raise AgentMemoryConfigError(
91-
"Agent Memory binding is missing required field: url"
91+
"Agent Memory binding is missing required field: application_url"
9292
)
9393
if not self.uaa:
9494
raise AgentMemoryConfigError(
@@ -104,7 +104,7 @@ def extract_config(self) -> AgentMemoryConfig:
104104

105105
try:
106106
return AgentMemoryConfig(
107-
base_url=self.url,
107+
base_url=self.application_url,
108108
token_url=uaa_data["url"].rstrip("/") + "/oauth/token",
109109
client_id=uaa_data["clientid"],
110110
client_secret=uaa_data["clientsecret"],

src/sap_cloud_sdk/agent_memory/user-guide.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ environment variables or service binding.
775775
### Service Binding
776776
777777
- **Mount path**: `$SERVICE_BINDING_ROOT/hana-agent-memory/default/` (defaults to `/etc/secrets/appfnd/hana-agent-memory/default/`)
778-
- **Required keys**: `url` (Agent Memory service URL), `uaa` (JSON string with XSUAA credentials)
778+
- **Required keys**: `application_url` (Agent Memory service URL), `uaa` (JSON string with XSUAA credentials)
779779
- **Env var fallback**: `CLOUD_SDK_CFG_HANA_AGENT_MEMORY_DEFAULT_{FIELD}` (uppercased)
780780
781781
> **Note:** `SERVICE_BINDING_ROOT` defaults to `/etc/secrets/appfnd` when not set. See the [Secret Resolver guide](../core/secret_resolver/user-guide.md) for details.
@@ -784,14 +784,14 @@ environment variables or service binding.
784784
785785
```
786786
$SERVICE_BINDING_ROOT/hana-agent-memory/default/
787-
├── url
787+
├── application_url
788788
└── uaa
789789
```
790790
791791
#### Environment Variables
792792
793793
```bash
794-
export CLOUD_SDK_CFG_HANA_AGENT_MEMORY_DEFAULT_URL="https://agent-memory.example.com"
794+
export CLOUD_SDK_CFG_HANA_AGENT_MEMORY_DEFAULT_APPLICATION_URL="https://agent-memory.example.com"
795795
export CLOUD_SDK_CFG_HANA_AGENT_MEMORY_DEFAULT_UAA='{"clientid":"...","clientsecret":"...","url":"https://..."}'
796796
```
797797

tests/agent_memory/unit/test_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def test_uses_provided_config(self):
4646
def test_reads_env_when_no_config_provided(self, monkeypatch):
4747
"""Factory falls back to environment variables when no config given."""
4848
import json
49-
monkeypatch.setenv("CLOUD_SDK_CFG_HANA_AGENT_MEMORY_DEFAULT_URL", "http://memory.example.com")
49+
monkeypatch.setenv("CLOUD_SDK_CFG_HANA_AGENT_MEMORY_DEFAULT_APPLICATION_URL", "http://memory.example.com")
5050
monkeypatch.setenv("CLOUD_SDK_CFG_HANA_AGENT_MEMORY_DEFAULT_UAA", json.dumps({
5151
"url": "http://auth.example.com",
5252
"clientid": "client-id",

tests/agent_memory/unit/test_config.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -64,43 +64,43 @@ def test_valid_config_with_all_fields_does_not_raise(self):
6464

6565

6666
class TestBindingData:
67-
def test_validate_raises_when_url_missing(self):
68-
with pytest.raises(AgentMemoryConfigError, match="url"):
69-
BindingData(url="", uaa=_VALID_UAA).validate()
67+
def test_validate_raises_when_application_url_missing(self):
68+
with pytest.raises(AgentMemoryConfigError, match="application_url"):
69+
BindingData(application_url="", uaa=_VALID_UAA).validate()
7070

7171
def test_validate_raises_when_uaa_missing(self):
7272
with pytest.raises(AgentMemoryConfigError, match="uaa"):
73-
BindingData(url="https://memory.example.com", uaa="").validate()
73+
BindingData(application_url="https://memory.example.com", uaa="").validate()
7474

7575
def test_validate_passes_when_all_fields_set(self):
76-
BindingData(url="https://memory.example.com", uaa=_VALID_UAA).validate()
76+
BindingData(application_url="https://memory.example.com", uaa=_VALID_UAA).validate()
7777

7878
def test_extract_config_maps_url(self):
79-
config = BindingData(url="https://memory.example.com", uaa=_VALID_UAA).extract_config()
79+
config = BindingData(application_url="https://memory.example.com", uaa=_VALID_UAA).extract_config()
8080
assert config.base_url == "https://memory.example.com"
8181

8282
def test_extract_config_derives_token_url(self):
83-
config = BindingData(url="https://memory.example.com", uaa=_VALID_UAA).extract_config()
83+
config = BindingData(application_url="https://memory.example.com", uaa=_VALID_UAA).extract_config()
8484
assert config.token_url == "https://auth.example.com/oauth/token"
8585

8686
def test_extract_config_strips_trailing_slash_from_uaa_url(self):
8787
uaa = json.dumps({"url": "https://auth.example.com/", "clientid": "c", "clientsecret": "s"})
88-
config = BindingData(url="https://memory.example.com", uaa=uaa).extract_config()
88+
config = BindingData(application_url="https://memory.example.com", uaa=uaa).extract_config()
8989
assert config.token_url == "https://auth.example.com/oauth/token"
9090

9191
def test_extract_config_maps_client_credentials(self):
92-
config = BindingData(url="https://memory.example.com", uaa=_VALID_UAA).extract_config()
92+
config = BindingData(application_url="https://memory.example.com", uaa=_VALID_UAA).extract_config()
9393
assert config.client_id == "my-client"
9494
assert config.client_secret == "my-secret"
9595

9696
def test_extract_config_raises_on_invalid_json(self):
9797
with pytest.raises(AgentMemoryConfigError, match="Failed to parse uaa JSON"):
98-
BindingData(url="https://memory.example.com", uaa="not-json").extract_config()
98+
BindingData(application_url="https://memory.example.com", uaa="not-json").extract_config()
9999

100100
def test_extract_config_raises_on_missing_json_key(self):
101101
uaa = json.dumps({"url": "https://auth.example.com"}) # missing clientid/clientsecret
102102
with pytest.raises(AgentMemoryConfigError, match="Missing required field in uaa JSON"):
103-
BindingData(url="https://memory.example.com", uaa=uaa).extract_config()
103+
BindingData(application_url="https://memory.example.com", uaa=uaa).extract_config()
104104

105105
def test_extract_config_ignores_extra_uaa_fields(self):
106106
uaa = json.dumps({
@@ -114,23 +114,23 @@ def test_extract_config_ignores_extra_uaa_fields(self):
114114
"xsappname": "my-app",
115115
"zoneid": "1acb547d-6df6-40a6-abb6-e41dd7d079d1",
116116
})
117-
config = BindingData(url="https://memory.example.com", uaa=uaa).extract_config()
117+
config = BindingData(application_url="https://memory.example.com", uaa=uaa).extract_config()
118118
assert config.base_url == "https://memory.example.com"
119119
assert config.token_url == "https://auth.example.com/oauth/token"
120120
assert config.client_id == "my-client"
121121
assert config.client_secret == "my-secret"
122122

123123
def test_extract_config_raises_on_empty_uaa_object(self):
124124
with pytest.raises(AgentMemoryConfigError, match="Missing required field in uaa JSON"):
125-
BindingData(url="https://memory.example.com", uaa="{}").extract_config()
125+
BindingData(application_url="https://memory.example.com", uaa="{}").extract_config()
126126

127127

128128
# ── _load_config_from_env ─────────────────────────────────────────────────────
129129

130130

131131
def _fill_binding(**kwargs) -> None:
132132
target = kwargs["target"]
133-
target.url = "https://memory.example.com"
133+
target.application_url = "https://memory.example.com"
134134
target.uaa = _VALID_UAA
135135

136136

@@ -156,7 +156,7 @@ def test_calls_resolver_with_correct_arguments(self):
156156
assert kwargs["instance"] == "default"
157157

158158
def test_falls_back_to_env_vars(self, monkeypatch):
159-
monkeypatch.setenv("CLOUD_SDK_CFG_HANA_AGENT_MEMORY_DEFAULT_URL", "https://memory.example.com")
159+
monkeypatch.setenv("CLOUD_SDK_CFG_HANA_AGENT_MEMORY_DEFAULT_APPLICATION_URL", "https://memory.example.com")
160160
monkeypatch.setenv("CLOUD_SDK_CFG_HANA_AGENT_MEMORY_DEFAULT_UAA", _VALID_UAA)
161161

162162
# Let the real resolver run — mount will fail, env vars will succeed
@@ -173,15 +173,15 @@ def test_raises_config_error_when_resolver_fails(self):
173173

174174
def test_raises_config_error_when_binding_incomplete(self):
175175
def partial_fill(**kwargs):
176-
kwargs["target"].url = "https://memory.example.com"
176+
kwargs["target"].application_url = "https://memory.example.com"
177177
# uaa remains empty → validate() raises
178178

179179
with patch(_RESOLVER, side_effect=partial_fill):
180180
with pytest.raises(AgentMemoryConfigError, match="uaa"):
181181
_load_config_from_env()
182182

183183
def test_raises_config_error_when_uaa_json_invalid(self, monkeypatch):
184-
monkeypatch.setenv("CLOUD_SDK_CFG_HANA_AGENT_MEMORY_DEFAULT_URL", "https://memory.example.com")
184+
monkeypatch.setenv("CLOUD_SDK_CFG_HANA_AGENT_MEMORY_DEFAULT_APPLICATION_URL", "https://memory.example.com")
185185
monkeypatch.setenv("CLOUD_SDK_CFG_HANA_AGENT_MEMORY_DEFAULT_UAA", "not-valid-json")
186186

187187
with patch("os.stat", side_effect=FileNotFoundError("no mount")):

0 commit comments

Comments
 (0)