Commit b57abf1
fix(ometa): address PR review on SSE client
Three follow-ups from Copilot's review on PR open-metadata#28293:
1. Forward `ClientConfig.cert` to the SSE request so mTLS / client-cert
setups work for SSE the same way they do for the REST client. Without
this, deployments that authenticate the REST path via mutual TLS would
silently fail on `/agents/dynamic/run` and similar SSE endpoints.
2. Document `data` and the new `timeout` parameter in the `stream()`
docstring, including the SSE-specific note that the default of `None`
disables timeouts because SSE streams can have long idle periods.
3. Migrate unit tests off `httpx` mocks:
- `tests/unit/metadata/ingestion/ometa/test_sse_client.py` and
`tests/unit/test_user_agent.py` now mock `requests.Session.request`
instead of `httpx.Client.stream`.
- `MockHTTPXClient` is replaced by `MockRequestsSession` that
accepts the SDK's full kwargs set (method/url/headers/json/params/
stream/timeout/verify/allow_redirects/cookies/cert).
- `MockSSEResponse.iter_lines` now accepts `decode_unicode` to
match the call shape of the new code.
- HTTP error / connection error fixtures use `requests.exceptions`.
Not adopting Copilot's suggestion to fall back to `self.config.timeout`
when the stream() arg is `None`: the REST client's default is `(10, 300)`,
which would silently abort SSE streams that have legitimate idle gaps
longer than 5 minutes (LLM "thinking" pauses, sparse update events).
Keeping the SSE default at `None` (no timeout) preserves prior behavior
and matches the working-everywhere baseline; callers can opt in.
All 56 tests in the two updated files pass.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent 284e649 commit b57abf1
3 files changed
Lines changed: 109 additions & 104 deletions
File tree
- ingestion
- src/metadata/ingestion/ometa
- tests/unit
- metadata/ingestion/ometa
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
51 | 58 | | |
52 | 59 | | |
53 | 60 | | |
| |||
106 | 113 | | |
107 | 114 | | |
108 | 115 | | |
| 116 | + | |
109 | 117 | | |
110 | 118 | | |
111 | 119 | | |
| |||
0 commit comments