Repository navigation
feat(api): update API spec from langfuse/langfuse 58667f4 - #2107
langfuse-bot wants to merge 1 commit into
Conversation
|
@claude review |
There was a problem hiding this comment.
Claude Code Review
No review was started: this request came from a bot account. Manual reviews can only be requested by someone with write access to this repository. Ask a maintainer to comment @claude review, or have your automation post the comment from a user account with write access.
Tip: disable this comment in your organization's Code Review settings.
| rule_ids: typing_extensions.Annotated[ | ||
| typing.List[str], FieldMetadata(alias="ruleIds") | ||
| ] = pydantic.Field() |
There was a problem hiding this comment.
🔴 SDK users pointed at a Langfuse server that predates this spec get a pydantic ValidationError from list_facets/get_facet, where the base SDK parsed the response fine. TopicFacet.rule_ids is declared as a required List[str] with no default. An older server's facet payload has no ruleIds key. Fix: make the field tolerate its absence, for example typing.Optional[typing.List[str]] = None or a default of [], so older self-hosted servers still parse. The fix belongs in the upstream spec, marked optional or defaulted, so the generator emits it that way.
Why this was flagged
The trigger is a self-hosted or older Langfuse server whose /api/public/unstable/topic-facets responses were built before the rules change and have no ruleIds. Those responses go through parse_obj_as(type_=TopicFacetList, ...) in langfuse/api/unstable/topics/raw_client.py. On pydantic v2 that calls TypeAdapter.validate_python (langfuse/api/core/pydantic_utilities.py:58-59), which raises a ValidationError for the missing required field. After upgrading, the caller gets an exception for list_facets and get_facet in both the sync and async clients. On the base branch the same response parsed into TopicFacet. extra="allow" does not help, because it only covers unknown keys, not missing required ones. The other new rule-related fields in this diff, Topic.rule_id and TopicFacetCounts.rule_id, are Optional with default None, so only rule_ids has this problem.
Verification: langfuse/api/unstable/topics/types/topic_facet.py:22-24 adds rule_ids with a bare pydantic.Field(), so the field is required. The base TopicFacet had no rule_ids field. list_facets and get_facet parse with parse_obj_as (raw_client.py:112, 291), which raises a ValidationError when ruleIds is missing. extra="allow" only tolerates extra keys, not missing ones.
Generated from langfuse/langfuse
mainat 58667f4.

Confidence Score: 5/5
The PR appears safe to merge; no actionable defects were found.Summary
Updates the generated API client from Langfuse commit
58667f4.No actionable issues were found. Runtime tests were not run.
Reviews (1) · Last reviewed commit: "feat(api): update API spec from langfuse..." · Reviewed by Greptile