Repository navigation
Conversation
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.
Problem
Reusing a non-empty metadata dictionary across JSON trace exports produces stale export statistics.
export_traces_json()insertstotal_tracesandexported_atdirectly into the caller's dictionary. A second export with two traces can consequently still claim one trace and the first export's timestamp.Change
Copy the top-level metadata dictionary before adding export defaults. Each export gets fresh defaults, and the caller's dictionary stays reusable. Explicit caller-provided
total_tracesandexported_atoverrides remain supported. Trace content and HDF5 encoding are unchanged.Add real-file regression coverage for sequential exports with reused metadata, explicit statistics overrides, and empty/missing metadata. The clock is replaced only in the export module so logging uses its real clock.
Validation
Python 3.12.13, macOS arm64, current main
cb49662150aa794149d477379c605a3bff0c08a2:total_traces=1for two traces.OPENAI_API_KEY=test-key-for-unit-tests python -m unittest discover tests: 1,006 tests run, 2 skipped; all remaining tests pass.git diff --check: pass.An initial full-suite run exposed a test-only clock mock affecting logging; isolating the module's clock fixed that interference, and the complete suite was rerun successfully. No live LLM/provider calls were made.
Prepared with AI assistance from an independent source review, and checked against actual files written by the public export function.