Skip to content

fix(client): close review gaps on list_providers — full shape, pagination, defensive health#165

Merged
saurabhjain1592 merged 1 commit intomainfrom
feature/qf-review-fixes
Apr 28, 2026
Merged

fix(client): close review gaps on list_providers — full shape, pagination, defensive health#165
saurabhjain1592 merged 1 commit intomainfrom
feature/qf-review-fixes

Conversation

@saurabhjain1592
Copy link
Copy Markdown
Member

Summary

Three review-driven fixes on the just-shipped `list_providers()` (PR #164). All three were flagged by the post-merge deep code review:

  1. Wire-shape fields — `LLMProvider` was silently dropping `endpoint`, `model`, `region`, `rate_limit`, `timeout_seconds`, and `settings`. SDK callers couldn't introspect provider configuration despite the platform returning all six fields. Surfaced all six. The SDK now matches the platform's `LLMProviderResource` schema.

  2. Pagination — `GET /api/v1/llm-providers` is paginated (server-side cap 100, default 20). `list_providers()` ignored that and would silently truncate results in any deployment with more than 20 providers. Added three flavours:

    • `list_providers(page=, page_size=)` — single page, list-shaped return (default no pagination args, server picks defaults)
    • `list_providers_paged(...)` — single page, returns `LLMProviderListResponse` with `pagination` metadata
    • `list_all_providers(...)` — walks every page, default `page_size=100` to minimise round trips
  3. Defensive health parsing — a single malformed `health` snapshot on one provider would raise `ValidationError` out of pydantic and crash the entire list call. Wrapped the per-provider health construction in try/except and set `health=None` for the bad row, with a warning logged.

What changed

  • `axonflow.types.LLMProvider` — added six optional fields (`endpoint`, `model`, `region`, `rate_limit`, `timeout_seconds`, `settings`)
  • New types `PaginationMeta` and `LLMProviderListResponse` (also re-exported from `axonflow`)
  • `AxonFlow.list_providers()` accepts `page` / `page_size` kwargs
  • New methods `list_providers_paged()` and `list_all_providers()` on both async `AxonFlow` and sync `SyncAxonFlow`
  • Per-provider health construction is now defensive (try/except around `LLMProviderHealth(**dict)`)

Test plan

6 new regression tests in `tests/test_list_providers_review_fixes.py`:

  • All six optional LLMProvider fields surface when present
  • All six fields default to None when absent
  • `list_providers_paged` returns `LLMProviderListResponse` with pagination metadata
  • `list_all_providers` walks every page and combines results
  • Malformed health on one provider does NOT crash the whole listing
  • Empty-string `min_sdk_version_for("python")` does NOT trigger the upgrade warning
  • Existing 10 tests on `list_providers` + `health_check_detailed` still pass
  • `ruff check`, `ruff format --check`, `mypy axonflow` all clean
  • Falsey-clobber baseline refreshed

Cross-SDK note

The same review surfaced equivalent gaps in Go / TS / Java SDKs — each will get a sibling PR closing the same shape, pagination, and defensive-parsing concerns.

…tion, defensive health

Three review-driven fixes on the just-shipped list_providers() (PR #164):

1. Wire-shape: LLMProvider was silently dropping endpoint, model, region,
   rate_limit, timeout_seconds, and settings — every provider config the
   SDK couldn't introspect. Surfaced all six fields so the SDK matches the
   platform's LLMProviderResource schema.

2. Pagination: GET /api/v1/llm-providers is paginated (server-side cap 100,
   default 20). list_providers() ignored that and would silently truncate
   results in any deployment with more than 20 providers. Added:
   - list_providers(page=, page_size=) — single page, list-shaped return
   - list_providers_paged(...) — single page, returns
     LLMProviderListResponse with pagination metadata
   - list_all_providers(...) — walks every page (page_size=100 default)

3. Defensive health parsing: a single malformed `health` snapshot on one
   provider would raise ValidationError out of pydantic and crash the
   entire list call. Wrapped the per-provider health construction in
   try/except and set health=None for the bad row, with a debug warning.

6 regression tests pin the new behavior, including the empty-string
edge case in min_sdk_version_for("python") (no upgrade warning fires).

Both async and sync entry points; types re-exported from `axonflow`
(LLMProviderListResponse, PaginationMeta).
@saurabhjain1592 saurabhjain1592 merged commit f247d85 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