chore: test to validate multiple calls to update_trace don't drop att… #1369
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.
Important
Add test to ensure multiple
update_current_tracecalls retain attributes and refactor existing tests for clarity intest_core_sdk.py.test_create_update_current_traceto verify multipleupdate_current_tracecalls retain all attributes.test_core_sdk.pyfor clarity and consistency, particularly intest_create_update_traceandtest_that_generation_like_properties_are_actually_created.test_start_as_current_observation_typesandtest_that_generation_like_properties_are_actually_created.This description was created by
for fcf644e. You can customize this summary. It will automatically update as commits are pushed.
Disclaimer: Experimental PR review
Greptile Summary
Updated On: 2025-09-18 12:12:40 UTC
This PR adds a new test function
test_create_update_current_traceto validate that multiple calls toupdate_current_traceproperly preserve previously set attributes instead of overwriting them. The test creates a trace usinglangfuse.start_as_current_span()context manager, then callsupdate_current_tracetwice with different sets of attributes to ensure proper merging behavior.The test flow:
update_current_traceto set initial properties (name, user_id, metadata, public flag, input)update_current_tracewith additional metadata, version, and updated public flagThis addresses a potential bug (referenced as LFE-6798 in the branch name) where subsequent updates were dropping previously set trace attributes. The test integrates with the existing test suite's pattern of using the Langfuse SDK and API validation through
get_api().trace.get()calls.The PR also includes minor code formatting improvements, breaking long assertion statements across multiple lines to improve readability and comply with line length standards.
Confidence score: 5/5