Skip to content

fix(client): handle per-language min_sdk_version dict in health_check_detailed#163

Merged
saurabhjain1592 merged 4 commits intomainfrom
feature/qf-min-sdk-version-shape
Apr 28, 2026
Merged

fix(client): handle per-language min_sdk_version dict in health_check_detailed#163
saurabhjain1592 merged 4 commits intomainfrom
feature/qf-min-sdk-version-shape

Conversation

@saurabhjain1592
Copy link
Copy Markdown
Member

Summary

`health_check_detailed()` was crashing with `AttributeError: 'dict' object has no attribute 'split'` because the SDK typed `min_sdk_version` as a single string while the platform has shipped it as a per-language map since version_discovery landed in 4.8.0:

```json
{"go": "5.0.0", "java": "5.0.0", "python": "6.0.0", "typescript": "5.0.0"}
```

Every caller of `health_check_detailed()` against any platform 4.8.0+ was hitting the crash. Caught by the Phase 1 quality-freeze sweep against `examples/version-check/python`.

What changed

  • `SDKCompatibility` typed as `dict[str, str]` for both `min_sdk_version` and `recommended_sdk_version`
  • New helpers `min_sdk_version_for(language)` and `recommended_sdk_version_for(language)`, matching the Java SDK's `getMinSdkVersionFor()` and TypeScript SDK's defensive shape handling
  • Legacy bare-string responses from older platforms normalised to `{"python": str}` so callers don't need to branch

Test plan

  • New regression suite `tests/test_health_check_detailed.py` (5 tests) covers dict shape, legacy bare string, empty string, and helper return values for known + unknown languages — all pass locally
  • `examples/version-check/python` E2E against community-mode docker-compose at v7.4.4 — PASS

Cross-SDK note

  • TypeScript and Java SDKs already handled the dict shape correctly
  • Go SDK has the same shape mismatch (`MinSDKVersion string`) but silently no-ops the version warning instead of crashing — separate fix in a follow-up PR

…_detailed

The platform /health endpoint returns sdk_compatibility.min_sdk_version
and recommended_sdk_version as per-language maps:

  {"go": "5.0.0", "java": "5.0.0", "python": "6.0.0", "typescript": "5.0.0"}

The Python SDK declared both fields as `str` and called `_parse_version()`
on the dict, crashing with `AttributeError: 'dict' object has no attribute
'split'`. Every caller of `health_check_detailed()` was hitting the crash
since the platform shipped version_discovery (4.8.0+).

Fix: type SDKCompatibility fields as `dict[str, str]` and add
`min_sdk_version_for(language)` / `recommended_sdk_version_for(language)`
helpers, matching the Java SDK's `getMinSdkVersionFor()` and TypeScript
SDK's defensive shape handling.

Defensive: if an older platform returns a bare-string min_sdk_version,
normalise to `{"python": str}` so callers don't need to branch.

Tests in tests/test_health_check_detailed.py cover:
- dict-shape happy path
- bare-string legacy fallback
- empty-string legacy
- helper return values for known + unknown languages

Caught by Phase 1 quality-freeze sweep on examples/version-check/python.
@saurabhjain1592 saurabhjain1592 merged commit d38f1ab into main Apr 28, 2026
13 checks passed
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