feat(api): update API spec from langfuse/langfuse f73fd25#856
feat(api): update API spec from langfuse/langfuse f73fd25#856langfuse-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.
Dead code: duplicate
case labels shadow second error block
The switch on _response.error.statusCode declares case 400, 401, 403, and 405 twice. In JavaScript/TypeScript a switch executes the first matching arm and exits (each arm here ends with throw), so the second set of cases — throwing LangfuseAPI.Error, LangfuseAPI.UnauthorizedError, LangfuseAPI.AccessDeniedError, and LangfuseAPI.MethodNotAllowedError — can never be reached. Code that catches those specific error classes will never fire on these status codes.
Note: case 404 (line 216) is unique and is reachable since 404 appears only in the second block. The same duplicate-case pattern appears in the pre-existing evaluationRules/client/Client.ts and likely originates from the Fern generator — worth a fix upstream in the API spec or generator config.
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:
**Dead code: duplicate `case` labels shadow second error block**
The `switch` on `_response.error.statusCode` declares `case 400`, `401`, `403`, and `405` twice. In JavaScript/TypeScript a `switch` executes the first matching arm and exits (each arm here ends with `throw`), so the second set of cases — throwing `LangfuseAPI.Error`, `LangfuseAPI.UnauthorizedError`, `LangfuseAPI.AccessDeniedError`, and `LangfuseAPI.MethodNotAllowedError` — can never be reached. Code that `catch`es those specific error classes will never fire on these status codes.
Note: `case 404` (line 216) is unique and *is* reachable since 404 appears only in the second block. The same duplicate-case pattern appears in the pre-existing `evaluationRules/client/Client.ts` and likely originates from the Fern generator — worth a fix upstream in the API spec or generator config.
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 spec update adding the unstable dashboardWidgets resource.
Extended reasoning...
Overview
This PR is a fully auto-generated Fern SDK update from the langfuse/langfuse API spec. It adds a new dashboardWidgets resource under the unstable namespace with a single create endpoint (POST /api/public/unstable/dashboard-widgets) plus associated request/response types and enums (chart type, view, aggregation, sort order, etc.). The changes hook the new client into the existing Unstable class via the same lazy-getter pattern used for evaluationRules and evaluators, and re-export the new types from the resources barrel.
Security risks
None. This is generated client code that constructs an authenticated POST against the customer's configured Langfuse endpoint using the existing basic-auth supplier and header-merging helpers shared with the other unstable resources. No secrets, crypto, permission logic, or user-input parsing is introduced.
Level of scrutiny
Very low — every file is marked auto-generated by Fern and mirrors the existing sibling resources (evaluationRules/evaluators) byte-for-byte in structure. The one oddity is duplicate case 400/401/403/405 labels in the error switch, but the same pattern already exists in evaluationRules/client/Client.ts (lines 246/291, 433/463, etc.), so this is a Fern codegen quirk in the upstream generator rather than a regression introduced here.
Other factors
No bugs were flagged by the bug hunting system. The endpoint sits under /unstable/ and the SDK explicitly documents that the surface may evolve. Nothing here touches ingestion, tracing, auth, or any production-critical path in the SDK.
Greptile Summary
This is an auto-generated PR (via Fern from langfuse/langfuse
f73fd25) that adds aDashboardWidgetsresource to theunstableAPI namespace, exposing a singlePOST /api/public/unstable/dashboard-widgetsendpoint for creating reusable dashboard widgets.DashboardWidgetsclient registered with lazy initialisation on theUnstableclient, following the same pattern asevaluationRulesandevaluators.switchin the new client contains duplicatecaselabels (400, 401, 403, 405), making the second block ofLangfuseAPI.*error classes unreachable; this same issue exists in pre-existing generated clients and likely originates from the Fern generator.Confidence Score: 4/5
Safe to merge with awareness: the new client works for the happy path and for 404/429/500 errors, but callers catching LangfuseAPI.Error, LangfuseAPI.UnauthorizedError, LangfuseAPI.AccessDeniedError, or LangfuseAPI.MethodNotAllowedError from this endpoint will never catch them — they'll receive the LangfuseAPI.unstable.* variants instead.
The duplicate case labels make four documented error types permanently unreachable. Because this is auto-generated code that mirrors a bug already present in the existing evaluationRules client, it is unlikely to be caught by callers relying on specific error-class checks. All other aspects — type definitions, barrel exports, lazy accessor registration, HTTP method/path, auth header construction — are correct and consistent with the rest of the codebase.
packages/core/src/api/api/resources/unstable/resources/dashboardWidgets/client/Client.ts — the error-handling switch block deserves a second look.
Sequence Diagram
%%{init: {'theme': 'neutral'}}%% sequenceDiagram participant Caller participant Unstable as client.unstable participant DW as dashboardWidgets (lazy) participant HTTP as core.fetcher participant API as POST /api/public/unstable/dashboard-widgets Caller->>Unstable: .dashboardWidgets.create(request) Note over Unstable,DW: lazy-init DashboardWidgets on first access Unstable->>DW: create(request, opts) DW->>DW: __create() — build headers, auth DW->>HTTP: "fetch(POST, body=request)" HTTP->>API: POST /api/public/unstable/dashboard-widgets API-->>HTTP: 200 DashboardWidget HTTP-->>DW: _response.ok DW-->>Caller: DashboardWidget alt HTTP error API-->>HTTP: 4xx / 5xx HTTP-->>DW: _response.error (status-code) Note over DW: switch(statusCode)<br/>400/401/403/405 → unstable.* error<br/>(second block with same codes is dead)<br/>404 → LangfuseAPI.NotFoundError<br/>429/500 → unstable.* error DW-->>Caller: throw error end%%{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 client.unstable participant DW as dashboardWidgets (lazy) participant HTTP as core.fetcher participant API as POST /api/public/unstable/dashboard-widgets Caller->>Unstable: .dashboardWidgets.create(request) Note over Unstable,DW: lazy-init DashboardWidgets on first access Unstable->>DW: create(request, opts) DW->>DW: __create() — build headers, auth DW->>HTTP: "fetch(POST, body=request)" HTTP->>API: POST /api/public/unstable/dashboard-widgets API-->>HTTP: 200 DashboardWidget HTTP-->>DW: _response.ok DW-->>Caller: DashboardWidget alt HTTP error API-->>HTTP: 4xx / 5xx HTTP-->>DW: _response.error (status-code) Note over DW: switch(statusCode)<br/>400/401/403/405 → unstable.* error<br/>(second block with same codes is dead)<br/>404 → LangfuseAPI.NotFoundError<br/>429/500 → unstable.* error DW-->>Caller: throw error endPrompt To Fix All With AI
Reviews (1): Last reviewed commit: "feat(api): update API spec from langfuse..." | Re-trigger Greptile