Skip to content

fix(langfuse): use setTraceIO instead of updateTrace to match SDK API#1183

Closed
github-actions[bot] wants to merge 1 commit into
devfrom
claude-fix-pr-1175-25849381096
Closed

fix(langfuse): use setTraceIO instead of updateTrace to match SDK API#1183
github-actions[bot] wants to merge 1 commit into
devfrom
claude-fix-pr-1175-25849381096

Conversation

@github-actions

@github-actions github-actions Bot commented May 14, 2026

Copy link
Copy Markdown
Contributor

CI Auto-Fix

Original PR: #1175
Failed CI Run: PR Build Check

Fixes Applied

File Fix Type
src/lib/langfuse/trace-proxy-request.ts:411 rootSpan.updateTrace() -> rootSpan.setTraceIO() TypeScript: missing property
tests/unit/langfuse/langfuse-trace.test.ts Updated mock and assertions to use setTraceIO Test alignment

Root Cause

Commit 6e1c978f ("restore updateTrace call to match SDK API") restored a method (updateTrace) that does not exist on LangfuseSpan in the current @langfuse/tracing SDK. The correct method is setTraceIO, which accepts the same { input, output } shape defined by LangfuseTraceAttributes.

Verification

  • bun run typecheck passes
  • bun run lint passes
  • bunx vitest run tests/unit/langfuse/ - 39/39 tests pass
  • No logic changes made - purely mechanical method rename

Auto-generated by Claude AI

Greptile Summary

This PR renames a single call from rootSpan.updateTrace() to rootSpan.setTraceIO() in trace-proxy-request.ts and 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 on LangfuseSpan in @langfuse/tracing v5.

  • src/lib/langfuse/trace-proxy-request.ts: Line 411 now calls rootSpan.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 updateTrace to setTraceIO in 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/tracing v5 SDK.

No files require special attention.

Important Files Changed

Filename Overview
src/lib/langfuse/trace-proxy-request.ts Single-line method rename from updateTrace to setTraceIO on rootSpan; no logic change
tests/unit/langfuse/langfuse-trace.test.ts Mock definition, 4 assertions, and 1 test description updated from updateTrace to setTraceIO to align with the renamed source method

Sequence 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)
Loading

Reviews (1): Last reviewed commit: "fix(langfuse): use setTraceIO instead of..." | Re-trigger Greptile

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant