fix(langfuse): use setTraceIO instead of updateTrace to match SDK API#1183
Closed
github-actions[bot] wants to merge 1 commit into
Closed
fix(langfuse): use setTraceIO instead of updateTrace to match SDK API#1183github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
The LangfuseSpan type exposes setTraceIO(), not updateTrace(). The previous commit (6e1c978) restored updateTrace which does not exist in the current SDK, causing TS2339 in both typecheck and Docker build. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CI Auto-Fix
Original PR: #1175
Failed CI Run: PR Build Check
Fixes Applied
src/lib/langfuse/trace-proxy-request.ts:411rootSpan.updateTrace()->rootSpan.setTraceIO()tests/unit/langfuse/langfuse-trace.test.tssetTraceIORoot Cause
Commit
6e1c978f("restore updateTrace call to match SDK API") restored a method (updateTrace) that does not exist onLangfuseSpanin the current@langfuse/tracingSDK. The correct method issetTraceIO, which accepts the same{ input, output }shape defined byLangfuseTraceAttributes.Verification
bun run typecheckpassesbun run lintpassesbunx vitest run tests/unit/langfuse/- 39/39 tests passAuto-generated by Claude AI
Greptile Summary
This PR renames a single call from
rootSpan.updateTrace()torootSpan.setTraceIO()intrace-proxy-request.tsand updates the corresponding test mock and assertions. The fix corrects a TypeScript compile error introduced by a prior commit that restored a method name (updateTrace) that doesn't exist onLangfuseSpanin@langfuse/tracingv5.src/lib/langfuse/trace-proxy-request.ts: Line 411 now callsrootSpan.setTraceIO({ input, output }), which matches the actual SDK method signature.tests/unit/langfuse/langfuse-trace.test.ts: Mock object, four call assertions, and one test description updated to match the renamed method; no test logic changed.Confidence Score: 5/5
Safe to merge — the change is a purely mechanical method rename with no logic modifications and full test coverage.
The only modification is renaming
updateTracetosetTraceIOin one call site and its four corresponding test assertions. The method signature ({ input, output }) is identical, so there is no behavioural change; this just restores type-correctness against the@langfuse/tracingv5 SDK.No files require special attention.
Important Files Changed
updateTracetosetTraceIOonrootSpan; no logic changeupdateTracetosetTraceIOto align with the renamed source methodSequence Diagram
sequenceDiagram participant T as traceProxyRequest participant R as rootSpan (LangfuseSpan) participant L as Langfuse SDK (@langfuse/tracing v5) T->>R: "setTraceIO({ input: actualRequestBody, output: actualResponseBody })" Note over R,L: Previously called updateTrace() which does not exist in SDK v5 R->>L: persists trace-level I/O T->>R: end(requestEndTime)Reviews (1): Last reviewed commit: "fix(langfuse): use setTraceIO instead of..." | Re-trigger Greptile