feat(api): update API spec from langfuse/langfuse 6191e50#857
feat(api): update API spec from langfuse/langfuse 6191e50#857langfuse-bot wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@claude review |
| case 400: | ||
| throw new LangfuseAPI.Error( | ||
| _response.error.body as unknown, | ||
| _response.rawResponse, | ||
| ); | ||
| case 401: | ||
| throw new LangfuseAPI.UnauthorizedError( | ||
| _response.error.body as unknown, | ||
| _response.rawResponse, | ||
| ); | ||
| case 403: | ||
| throw new LangfuseAPI.AccessDeniedError( | ||
| _response.error.body as unknown, | ||
| _response.rawResponse, | ||
| ); | ||
| case 405: | ||
| throw new LangfuseAPI.MethodNotAllowedError( | ||
| _response.error.body as unknown, | ||
| _response.rawResponse, | ||
| ); |
There was a problem hiding this comment.
Duplicate
case labels make error branches unreachable
The switch block contains duplicate cases for status codes 400, 401, 403, and 405. JavaScript/TypeScript evaluates only the first matching case, so the second set of case 400 / case 401 / case 403 / case 405 (lines 196–215) is dead code: LangfuseAPI.Error, LangfuseAPI.UnauthorizedError, LangfuseAPI.AccessDeniedError, and LangfuseAPI.MethodNotAllowedError (top-level namespace) will never be thrown. TypeScript also raises TS2685 Duplicate case label for each, which will fail a strict-mode build. This appears to be a Fern code-generator artefact and should be reported upstream.
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/core/src/api/api/resources/unstable/resources/dashboardWidgets/client/Client.ts
Line: 196-215
Comment:
**Duplicate `case` labels make error branches unreachable**
The switch block contains duplicate cases for status codes `400`, `401`, `403`, and `405`. JavaScript/TypeScript evaluates only the **first** matching `case`, so the second set of `case 400` / `case 401` / `case 403` / `case 405` (lines 196–215) is dead code: `LangfuseAPI.Error`, `LangfuseAPI.UnauthorizedError`, `LangfuseAPI.AccessDeniedError`, and `LangfuseAPI.MethodNotAllowedError` (top-level namespace) will never be thrown. TypeScript also raises `TS2685 Duplicate case label` for each, which will fail a strict-mode build. This appears to be a Fern code-generator artefact and should be reported upstream.
How can I resolve this? If you propose a fix, please make it concise.There was a problem hiding this comment.
LGTM — auto-generated Fern API client update adding the unstable dashboard-widgets resource and a new BlobStorageIntegrationFileTypeResponse enum.
Extended reasoning...
Overview
This PR is an auto-generated update to the Fern API client in packages/core/src/api/. It adds a new unstable.dashboardWidgets resource (types + client with a single create method targeting POST /api/public/unstable/dashboard-widgets) and introduces a new BlobStorageIntegrationFileTypeResponse enum (adds PARQUET to the response variant while the request variant is unchanged), swapping the response interface's fileType to the new type. All files are marked auto-generated by Fern.
Security risks
No security-relevant surface area. The dashboard widgets client uses the same BasicAuth pattern as every other resource, forwards the standard X-Langfuse-* headers, and JSON-serializes the request body. There is no user input parsing, cryptography, or authorization logic being introduced by this PR.
Level of scrutiny
Low. Fern-generated bindings are mechanical — the SDK follows the API definition, and the shape matches sibling resources (evaluationRules, evaluators) that already live under unstable. The only downstream change is the widening of BlobStorageIntegrationResponse.fileType to include PARQUET, which is additive and matches the doc comment explaining that PARQUET can be enabled via UI but not via the request API.
Other factors
No prior reviews to reconcile with. The bug hunting system reported no findings. Vercel preview built successfully. One minor codegen quirk worth noting: Client.ts contains duplicate case labels (400/401/403/405) in the error switch — the second set is unreachable — but this is a Fern-generated artifact identical to the pattern in other generated clients in this repo, not something this PR introduced.
Greptile Summary
This auto-generated PR (from the Fern SDK generator) updates the JS/TS client to reflect upstream API spec changes. It adds a new
DashboardWidgetssub-client under theunstablenamespace and separates theBlobStorageIntegrationFileTypeenum into a distinct response-only variant that includesPARQUET.DashboardWidgetsclient: Exposes acreatemethod forPOST /api/public/unstable/dashboard-widgets, with full type definitions for views, chart types, metrics, dimensions, filters, and sort options.BlobStorageIntegrationFileTypeResponse: New type that widens the existingBlobStorageIntegrationFileTypewith aPARQUETvalue, used on response objects only (BlobStorageIntegrationResponse.fileType).DashboardWidgetsclient: The error-handling switch statement duplicatescaselabels 400, 401, 403, and 405, making the second branches (top-levelLangfuseAPI.*error classes) unreachable dead code and causing TypeScriptTS2685compile errors in strict mode.Confidence Score: 2/5
Not safe to merge as-is — the generated DashboardWidgets client has duplicate switch case labels that will trigger TypeScript compile errors and leave several error-handling branches permanently unreachable.
The new DashboardWidgets client emits duplicate case labels (400, 401, 403, 405) in its error-handling switch block. TypeScript raises TS2685 for each duplicate, which breaks compilation in strict mode, and the second set of error classes (LangfuseAPI.Error, LangfuseAPI.UnauthorizedError, etc.) will never be thrown regardless. The rest of the PR — the BlobStorage type split and the Unstable client wiring — looks correct and clean.
packages/core/src/api/api/resources/unstable/resources/dashboardWidgets/client/Client.ts — duplicate switch case labels in the error-handling block
Sequence Diagram
%%{init: {'theme': 'neutral'}}%% sequenceDiagram participant Caller participant Unstable as unstable.Client participant DW as DashboardWidgets participant API as POST /api/public/unstable/dashboard-widgets Caller->>Unstable: .dashboardWidgets (lazy init) Unstable-->>DW: new DashboardWidgets(options) Caller->>DW: .create(CreateDashboardWidgetRequest) DW->>API: POST (Basic Auth header) API-->>DW: 201 DashboardWidget DW-->>Caller: DashboardWidget (id, name, view, dimensions, metrics, ...) API-->>DW: 400 / 401 / 403 / 405 Note over DW: Duplicate case labels:<br/>LangfuseAPI.unstable.* thrown (1st case wins)<br/>LangfuseAPI.* branches are dead code DW-->>Caller: throws unstable.BadRequestError etc. API-->>DW: 404 DW-->>Caller: throws LangfuseAPI.NotFoundError API-->>DW: 429 DW-->>Caller: throws unstable.TooManyRequestsError API-->>DW: 500 DW-->>Caller: throws unstable.InternalServerError%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%% sequenceDiagram participant Caller participant Unstable as unstable.Client participant DW as DashboardWidgets participant API as POST /api/public/unstable/dashboard-widgets Caller->>Unstable: .dashboardWidgets (lazy init) Unstable-->>DW: new DashboardWidgets(options) Caller->>DW: .create(CreateDashboardWidgetRequest) DW->>API: POST (Basic Auth header) API-->>DW: 201 DashboardWidget DW-->>Caller: DashboardWidget (id, name, view, dimensions, metrics, ...) API-->>DW: 400 / 401 / 403 / 405 Note over DW: Duplicate case labels:<br/>LangfuseAPI.unstable.* thrown (1st case wins)<br/>LangfuseAPI.* branches are dead code DW-->>Caller: throws unstable.BadRequestError etc. API-->>DW: 404 DW-->>Caller: throws LangfuseAPI.NotFoundError API-->>DW: 429 DW-->>Caller: throws unstable.TooManyRequestsError API-->>DW: 500 DW-->>Caller: throws unstable.InternalServerErrorPrompt To Fix All With AI
Reviews (1): Last reviewed commit: "feat(api): update API spec from langfuse..." | Re-trigger Greptile