feat: add implementation guide versioning and improve HTTP client reliability - #226
fern-api[bot] wants to merge 4 commits into
Conversation
Generated by Fern CLI Version: unknown Generators: - fernapi/fern-python-sdk: 5.30.0
…ove HTTP client reliability Add `create_version` and `get_version` methods to the implementation guides client, enabling callers to publish and retrieve exact canonical FHIR package versions beneath a guide family. Also improve HTTP client internals with TCP keepalive support and correct `Content-Type` handling for optional-body endpoints. Key changes: - Add `create_version(name, *, implementation_guide, profile_refs, profile_context)` and `get_version(name, version)` to both sync and async `ImplementationGuidesClient` - Introduce `get_keepalive_socket_options()` helper to configure TCP keepalive probes on all transports, preventing idle-connection drops by firewalls and load balancers - Add `optional_body` flag to `get_request_body` and all `HttpClient` request methods; strip `Content-Type` header when an optional body resolves to empty - Refactor `_coerce_keys_to_aliases` / `_get_field_aliases` into shared, cached helpers (using `weakref.WeakKeyDictionary`) for both Pydantic v1 and v2 model validators 🌿 Generated with Fern
Patches applied (1): - patch-6516695e: Release 15.0.2: restore bundled openapi.json packaging (#169)
…c2a1ffce7b318c7d [skip ci]
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 017d333. Configure here.
|
|
||
| headers: typing.Dict[str, str] = { | ||
| "User-Agent": "phenoml/17.0.0", | ||
| "User-Agent": "phenoml/0.0.0-fern-placeholder", |
There was a problem hiding this comment.
Placeholder leaked into User-Agent
Medium Severity
Every request now sends User-Agent: phenoml/0.0.0-fern-placeholder while X-Fern-SDK-Version correctly reports 17.1.0. The previous value phenoml/17.0.0 was replaced with an unsubstituted generator token, so production traffic no longer identifies this SDK version.
Reviewed by Cursor Bugbot for commit 017d333. Configure here.
| opts.append((socket.IPPROTO_TCP, socket.TCP_KEEPINTVL, intvl)) | ||
| if hasattr(socket, "TCP_KEEPCNT"): | ||
| opts.append((socket.IPPROTO_TCP, socket.TCP_KEEPCNT, cnt)) | ||
| return opts |
There was a problem hiding this comment.
Keepalive options never applied
Medium Severity
get_keepalive_socket_options() is added and advertised as enabling TCP keepalive on all connections, but nothing calls it. Default httpx.Client and httpx.AsyncClient instances are still constructed without a transport that receives those socket options, so idle connections stay unprotected.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit 017d333. Configure here.


17.0.0 → 17.1.0
Added
client.implementation_guides.create_version(...)andget_version(...)— new sync and async methods to publish and retrieve immutable exact canonical FHIR package versions beneath an implementation guide family; returnImplementationGuideVersionDetail.client.lang2fhir_batch— new sync and async client covering the full batch FHIR extraction job lifecycle (create,upload_item,finalize,cancel,get,get_results,get_result,list).client.profiles.versions— new sync and async client for managing immutable retained StructureDefinition versions (list,create,get,delete).FhirImplementationGuide,ImplementationGuideVersionDetail,ConflictError, and supporting batch/profile-version models — new Pydantic models and error class exported fromphenoml.implementation_guidesandphenoml.implementation_guides.errors;ImplementationGuideSummarygains optionalcanonical_urlandversion_countfields.BaseHttpResponse.responseandquote_path_param— new property exposing the rawhttpx.Responseand new utility for percent-encoding path segment values.Changed
tokenparameter onPhenomlClientandAsyncPhenomlClient— now acceptsUnion[str, Callable[[], str]], allowing a plain bearer token string to be passed directly without wrapping in a lambda.client.implementation_guides.delete(...)— now also removes any exact canonical package versions beneath the guide in addition to name-level metadata.OAuthTokenProvider— token refresh calls now explicitly passgrant_type="client_credentials"to ensure correct OAuth 2.0 client credentials flow behavior.get_keepalive_socket_options(), and optional-body endpoints no longer send aContent-Typeheader when the body is empty;httpx-aiohttpversion constraint relaxed from==0.1.8to^0.1.8.See full changelog
✅ Customizations automatically preserved in this update.
Note
Medium Risk
Touches authentication (token typing, OAuth refresh), HTTP request shaping, and destructive implementation-guide delete semantics—behavior changes that can affect production integrations even without breaking type signatures.
Overview
Release 17.1.0 regenerates the Fern Python SDK against an updated OpenAPI spec and bumps packaging/metadata (
pyproject.toml,poetry.lock, bundledopenapi.json).Implementation guides gain
create_versionandget_version(sync/async) to publish and fetch immutable canonical FHIR packages under a guide family, with new models (FhirImplementationGuide,ImplementationGuideVersionDetail) andConflictErrorfor HTTP 409.deleteis documented and wired to remove name-level metadata and exact package versions;ImplementationGuideSummaryadds optionalcanonical_urlandversion_count.Client ergonomics and transport:
PhenomlClient/AsyncPhenomlClientaccepttokenas a plain string or callable;OAuthTokenProviderrefresh explicitly sendsgrant_type="client_credentials". The HTTP stack addsget_keepalive_socket_options(),optional_bodyhandling so empty optional bodies omitContent-Type,quote_path_param, andBaseHttpResponse.responsefor rawhttpx.Responseaccess. Profile/version delete paths map 409 toConflictError. Agent chat SSE parsing skips empty event data; Pydantic input alias coercion is centralized in shared helpers.Reviewed by Cursor Bugbot for commit 017d333. Bugbot is set up for automated code reviews on this repo. Configure here.