Skip to content

feat(api): update API spec from langfuse/langfuse a6c38c6#1574

Merged
hassiebp merged 1 commit intomainfrom
api-spec-bot-a6c38c6
Mar 25, 2026
Merged

feat(api): update API spec from langfuse/langfuse a6c38c6#1574
hassiebp merged 1 commit intomainfrom
api-spec-bot-a6c38c6

Conversation

@langfuse-bot
Copy link
Collaborator

@langfuse-bot langfuse-bot commented Mar 24, 2026

Disclaimer: Experimental PR review

Greptile Summary

This auto-generated PR (via Fern from the Langfuse API spec at commit a6c38c6) adds a compressed field to the blob storage integration API surface, enabling gzip compression for exported files (.csv.gz, .json.gz, .jsonl.gz).

Changes:

  • BlobStorageIntegrationResponse: adds compressed: bool as a required field — the server is now expected to always return this value in responses.
  • CreateBlobStorageIntegrationRequest: adds compressed: Optional[bool] = None so callers may omit it and rely on the server-side default of true.
  • client.py / raw_client.py (sync + async): threads the new compressed: Optional[bool] = OMIT parameter through the public and raw client method signatures and correctly includes it in the serialized request body dict, where it is dropped from the payload when left as OMIT.

Confidence Score: 5/5

  • Safe to merge — straightforward auto-generated API spec update with no logic changes.
  • All four files are auto-generated from a versioned API spec. The new compressed field is added consistently and correctly across the response type, request type, public client, and raw client layers, following the exact same patterns used for every other optional parameter in this module. No imports were added inside functions or methods, so the custom import-ordering rule is satisfied. There are no observable logic or security issues.
  • No files require special attention.

Important Files Changed

Filename Overview
langfuse/api/blob_storage_integrations/types/blob_storage_integration_response.py Adds compressed: bool as a required (non-optional) field to the response model, matching the API spec where the server always returns this value.
langfuse/api/blob_storage_integrations/types/create_blob_storage_integration_request.py Adds compressed: Optional[bool] = None to the request model; optional so callers can omit it and let the server apply its default of true.
langfuse/api/blob_storage_integrations/client.py Adds compressed: Optional[bool] = OMIT parameter to both BlobStorageIntegrationsClient and AsyncBlobStorageIntegrationsClient create/update methods, forwarding it to the raw client.
langfuse/api/blob_storage_integrations/raw_client.py Adds compressed: Optional[bool] = OMIT to both sync and async raw client methods and correctly includes "compressed": compressed in the request body dict, which is filtered by omit=OMIT.

Sequence Diagram

sequenceDiagram
    participant Caller
    participant BlobStorageIntegrationsClient
    participant RawBlobStorageIntegrationsClient
    participant LangfuseAPI

    Caller->>BlobStorageIntegrationsClient: create_or_update(..., compressed=True)
    BlobStorageIntegrationsClient->>RawBlobStorageIntegrationsClient: create_or_update(..., compressed=True)
    RawBlobStorageIntegrationsClient->>LangfuseAPI: POST /api/blob-storage-integrations\n{..., "compressed": true}
    LangfuseAPI-->>RawBlobStorageIntegrationsClient: BlobStorageIntegrationResponse\n{..., "compressed": true}
    RawBlobStorageIntegrationsClient-->>BlobStorageIntegrationsClient: HttpResponse[BlobStorageIntegrationResponse]
    BlobStorageIntegrationsClient-->>Caller: BlobStorageIntegrationResponse
Loading

Reviews (1): Last reviewed commit: "feat(api): update API spec from langfuse..." | Re-trigger Greptile

@langfuse-bot langfuse-bot requested a review from Steffen911 March 24, 2026 15:10
@github-actions
Copy link

@claude review

export_start_date: typing_extensions.Annotated[
typing.Optional[dt.datetime], FieldMetadata(alias="exportStartDate")
] = None
compressed: bool
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 is declared as a required field () with no default value, meaning any older self-hosted Langfuse server that does not yet return this field in API responses will cause Pydantic to raise a , crashing and . Fix by changing to to match the server-side default and maintain backward compatibility.

Extended reasoning...

The Bug

at line 43 declares — a required Pydantic field with no default. Pydantic v2 raises a if a required field is absent from the parsed data. There is no mechanism in or the setting that compensates for missing required fields — only permits unexpected extra keys, not absent required ones.

Code Path That Triggers It

Both and ultimately call in . If the JSON response from the server lacks the key, this call raises .

Why Existing Code Does Not Prevent It

The setting is insufficient. means Pydantic tolerates extra keys beyond what the model declares — it does not provide defaults for absent declared fields. does not override or validators to fill in missing required fields. The only way to make a Pydantic field tolerant of absence is a Python-level default (, , etc.).

Impact

The Langfuse Python SDK is used against both langfuse.com (cloud) and self-hosted instances. Self-hosted users on older server versions — those deployed before the feature was added — will receive API responses without the key. Every call to list or upsert blob storage integrations will crash with an unhandled . This is a hard failure for anyone running an older self-hosted Langfuse server with a newer SDK.

Addressing the Refutation

The refutation argues this is auto-generated from an API spec where the server contract guarantees will always be present. This holds for the current server version, but Langfuse is self-hostable and users frequently run older instances. A new SDK talking to an older server is a completely normal scenario. The SDK own established pattern — used for , , , , and — is to give defaults to fields added over time. The same principle applies here. Furthermore, and were always part of the API; is genuinely new and will be absent from older server responses.

Step-by-Step Proof

  1. User runs self-hosted Langfuse server at version X (predating the field addition).
  2. User upgrades their Python SDK to the version containing this PR.
  3. User calls .
  4. Server returns JSON without : .
  5. SDK calls , constructing objects.
  6. Pydantic raises: .
  7. Exception propagates; the SDK call fails entirely.

Fix: Change to in . This matches the server-side default and is consistent with how other recently-added fields in the same model are handled.

@hassiebp hassiebp merged commit c5dc24d into main Mar 25, 2026
8 of 14 checks passed
@hassiebp hassiebp deleted the api-spec-bot-a6c38c6 branch March 25, 2026 14:48
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.

2 participants