Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,27 @@


class BlobStorageIntegrationFileType(enum.StrEnum):
"""
File format for exported data. `PARQUET` is a columnar binary format encoded and compressed by the storage engine; gzip compression does not apply to it. Note that the model-price columns (`input_price`, `output_price`, `total_price`) are not included in Parquet observation exports.
"""

JSON = "JSON"
CSV = "CSV"
JSONL = "JSONL"
PARQUET = "PARQUET"

def visit(
self,
json: typing.Callable[[], T_Result],
csv: typing.Callable[[], T_Result],
jsonl: typing.Callable[[], T_Result],
parquet: typing.Callable[[], T_Result],
) -> T_Result:
if self is BlobStorageIntegrationFileType.JSON:
return json()
if self is BlobStorageIntegrationFileType.CSV:
return csv()
if self is BlobStorageIntegrationFileType.JSONL:
return jsonl()
if self is BlobStorageIntegrationFileType.PARQUET:
return parquet()
Comment on lines 20 to +34

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Breaking change: parquet is now a required parameter in visit()

Adding parquet as a required positional argument means any existing caller of BlobStorageIntegrationFileType.visit() that passes only json, csv, and jsonl will now raise a TypeError at runtime. Since PARQUET did not previously exist in this enum (only in BlobStorageIntegrationFileTypeResponse), all current callers of this method will be broken by this change without a corresponding update on their side.

Prompt To Fix With AI
This is a comment left during a code review.
Path: langfuse/api/blob_storage_integrations/types/blob_storage_integration_file_type.py
Line: 20-34

Comment:
**Breaking change: `parquet` is now a required parameter in `visit()`**

Adding `parquet` as a required positional argument means any existing caller of `BlobStorageIntegrationFileType.visit()` that passes only `json`, `csv`, and `jsonl` will now raise a `TypeError` at runtime. Since `PARQUET` did not previously exist in this enum (only in `BlobStorageIntegrationFileTypeResponse`), all current callers of this method will be broken by this change without a corresponding update on their side.

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines 26 to +34

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 visit() returns None implicitly when no branch matches

The method has no final else/raise clause. If self ever holds a value not covered by the if checks — e.g. a future enum member added to the spec before the visit signature is updated — the function falls through and implicitly returns None, silently violating the T_Result return type. Adding raise ValueError(f"Unknown BlobStorageIntegrationFileType: {self}") as a trailing guard would surface this immediately instead of propagating a None into caller logic.

Prompt To Fix With AI
This is a comment left during a code review.
Path: langfuse/api/blob_storage_integrations/types/blob_storage_integration_file_type.py
Line: 26-34

Comment:
**`visit()` returns `None` implicitly when no branch matches**

The method has no final `else`/`raise` clause. If `self` ever holds a value not covered by the `if` checks — e.g. a future enum member added to the spec before the `visit` signature is updated — the function falls through and implicitly returns `None`, silently violating the `T_Result` return type. Adding `raise ValueError(f"Unknown BlobStorageIntegrationFileType: {self}")` as a trailing guard would surface this immediately instead of propagating a `None` into caller logic.

How can I resolve this? If you propose a fix, please make it concise.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class BlobStorageIntegrationFileTypeResponse(enum.StrEnum):
"""
File type reported for an existing integration. Includes `PARQUET`, which a project may enable through the Langfuse UI but cannot yet be set via this API (the request `fileType` omits it).
File type reported for an existing integration.
"""

JSON = "JSON"
Expand Down
Loading