Skip to content

Prevent trace export filename collisions - #235

Open
Gautam Sharma (GautamSharma99) wants to merge 1 commit into
langchain-ai:mainfrom
GautamSharma99:fix/trace-export-227
Open

Prevent trace export filename collisions#235
Gautam Sharma (GautamSharma99) wants to merge 1 commit into
langchain-ai:mainfrom
GautamSharma99:fix/trace-export-227

Conversation

@GautamSharma99

Copy link
Copy Markdown
Contributor

Summary

Closes #227

Trace export now detects duplicate destination paths before writing any trace files, preventing silent truncation and misleading export counts.

What changed

  • Resolve every root trace's filename up front using the configured {trace_id} and {name} substitutions.
  • Reject duplicate paths before child traces are queried or any output file is created.
  • Include the conflicting path and trace IDs in the actionable error; recommend {trace_id} or another unique placeholder.
  • Reuse the same path resolver during the write phase so collision checking and file creation cannot diverge.

This preserves the existing default {trace_id}.jsonl behavior while making constant and non-unique {name} patterns fail safely instead of overwriting earlier exports.

Tests

  • Constant and same-name patterns are verified to collide.
  • {trace_id} patterns are verified to remain unique.
  • go test ./...
  • go test -race ./internal/cmd
  • go vet ./...
  • make build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

trace export reports N exports when filename collisions overwrite files

1 participant