Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(ci): make test suites v3 ready #1063

Merged
merged 15 commits into from
Jan 14, 2025
Merged

test(ci): make test suites v3 ready #1063

merged 15 commits into from
Jan 14, 2025

Conversation

hassiebp
Copy link
Contributor

@hassiebp hassiebp commented Jan 7, 2025

Important

Update CI and test suite for version 3 compatibility, including workflow changes, environment variables, and test adjustments.

  • CI Configuration:
    • Update .github/workflows/ci.yml to include new environment variables LANGFUSE_INGESTION_QUEUE_DELAY_MS and LANGFUSE_INGESTION_CLICKHOUSE_WRITE_INTERVAL_MS.
    • Modify pytest command to run tests in parallel using -n auto.
  • Code Changes:
    • Reorder imports in langchain.py for better organization.
    • Update _parse_usage_model() in langchain.py to skip OpenAI usage types handled server-side.
  • Test Adjustments:
    • Add sleep(1) in api_wrapper.py and test_core_sdk.py to ensure data consistency.
    • Modify assertions in test_core_sdk.py to reflect updated metadata and usage details.
    • Remove redundant api variable in multiple test files and replace with direct get_api() calls.

This description was created by Ellipsis for 1671e3d. It will automatically update as commits are pushed.

@hassiebp hassiebp marked this pull request as draft January 7, 2025 16:16
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disclaimer: Experimental PR review

PR Summary

This PR updates the test suite for v3 compatibility by implementing retry logic for HTTP requests, transitioning to queue-based ingestion, and modifying test metadata structures.

  • Added new HTTPClientWithRetries class in tests/utils.py with exponential backoff (4 retries within 3s) for non-500 errors
  • Updated CI environment variables in .github/workflows/ci.yml to support queue-based ingestion with configurable delays
  • Changed mock metadata in tests/test_decorators.py from strings to dictionaries for more realistic testing scenarios
  • Removed direct database access environment variables from CI workflow in favor of queue-based processing

3 file(s) reviewed, 2 comment(s)
Edit PR Review Bot Settings | Greptile

tests/utils.py Outdated Show resolved Hide resolved
tests/utils.py Outdated Show resolved Hide resolved
@hassiebp hassiebp marked this pull request as ready for review January 12, 2025 19:45
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disclaimer: Experimental PR review

PR Summary

(updates since last review)

Based on the recent changes not covered in the previous review, here's a focused summary of the additional modifications:

Updates test suites for v3 API compatibility with significant changes to test infrastructure and timing handling.

  • Replaced HTTPClientWithRetries with simple sleep(1) delays in API calls to handle race conditions more consistently
  • Updated test assertions to expect empty dict ({}) instead of None for metadata across test files
  • Migrated imports to use new langchain package structure (e.g. langchain_openai instead of langchain_community)
  • Added parallel test execution support with pytest -n auto flag in CI workflow
  • Added new test cases for multimodal inputs and structured outputs in OpenAI integration tests

The changes focus on test reliability and v3 API compatibility while simplifying the HTTP request handling approach.

10 file(s) reviewed, 4 comment(s)
Edit PR Review Bot Settings | Greptile

tests/api_wrapper.py Show resolved Hide resolved
tests/api_wrapper.py Show resolved Hide resolved
tests/test_core_sdk.py Show resolved Hide resolved
tests/test_core_sdk.py Show resolved Hide resolved
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disclaimer: Experimental PR review

PR Summary

(updates since last review)

Based on the recent changes not covered in previous reviews, here's a focused summary of the modifications:

Increased API call delay timing in test utilities to improve test stability and reliability.

  • Increased sleep duration from 1s to 1.5s in tests/utils.py get_api() function to better handle race conditions
  • No other significant changes found since last review

The change is minimal but important for test reliability, allowing more time for API operations to complete before subsequent test assertions.

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disclaimer: Experimental PR review

PR Summary

(updates since last review)

Based on the recent changes not covered in previous reviews, here's a focused summary of the modifications:

Refactored langchain callback handler to improve model name parsing and error handling.

  • Added new _parse_model_and_log_errors method in langfuse/callback/langchain.py to centralize model name parsing logic and error reporting
  • Added warning message rate limiting for model parse errors to avoid log spam
  • Enhanced model parameter extraction for IBM watsonx.ai integration
  • Improved documentation for get_langchain_run_name method with clearer prioritization rules
  • Reordered imports for better code organization and readability

The changes focus on improving error handling and maintainability of the langchain integration while adding support for additional model providers.

10 file(s) reviewed, 3 comment(s)
Edit PR Review Bot Settings | Greptile

.github/workflows/ci.yml Show resolved Hide resolved
tests/test_core_sdk.py Show resolved Hide resolved
tests/test_decorators.py Show resolved Hide resolved
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disclaimer: Experimental PR review

PR Summary

(updates since last review)

Based on the recent changes not covered in previous reviews, here's a focused summary of the modifications:

Further increased API call delay timing in test utilities to improve test stability and reliability.

  • Increased sleep duration from 1.5s to 2s in tests/utils.py get_api() function to ensure API operations complete before test assertions
  • This is the only significant change since the last review, continuing the focus on test stability improvements

The change is minimal but builds on previous timing adjustments to further enhance test reliability by allowing more time for API operations to settle.

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disclaimer: Experimental PR review

PR Summary

(updates since last review)

Based on the recent changes not covered in previous reviews, here's a focused summary of the modifications:

Updated test assertions and metadata handling in core SDK tests to align with v3 API expectations.

  • Modified metadata assertions in tests/test_core_sdk.py to expect integer values instead of strings for count fields
  • Updated categorical score tests to expect default value of 0 instead of None for numeric scores
  • Added timezone awareness tests to ensure proper UTC handling in observation timestamps
  • Removed debug=False flags from several test cases as they are no longer needed in v3

The changes focus on data type consistency and proper timestamp handling to ensure compatibility with the v3 API specification.

3 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disclaimer: Experimental PR review

PR Summary

(updates since last review)

Based on the recent changes not covered in previous reviews, here's a focused summary of the modifications:

Updated test suites to handle langchain v3 compatibility and improved test reliability.

  • Added multimodal test case in tests/test_langchain.py to verify ChatOpenAI model's handling of image inputs
  • Updated test_callback_generated_from_trace_chain to handle potential None values in outputs
  • Added test_langfuse_overhead to measure and verify acceptable performance impact
  • Refactored test_link_langfuse_prompts_invoke to include null checks for outputs
  • Added new environment variables LANGFUSE_INGESTION_QUEUE_DELAY_MS and LANGFUSE_INGESTION_CLICKHOUSE_WRITE_INTERVAL_MS in CI workflow

The changes focus on expanding test coverage while ensuring compatibility with langchain v3's updated API structure.

2 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disclaimer: Experimental PR review

PR Summary

(updates since last review)

Based on the recent changes not covered in previous reviews, here's a focused summary of the modifications to test_langchain.py:

Updated test assertions and error handling for improved compatibility with LangChain v3 and better test reliability.

  • Added explicit parentheses in conditional expressions to fix operator precedence issues in output assertions
  • Updated test cases to handle new usage details format with proper null checks and type validation
  • Added test coverage for multimodal inputs in ChatOpenAI model interactions
  • Improved test cleanup and resource handling with proper teardown procedures
  • Added performance validation with new test_langfuse_overhead to ensure acceptable tracing impact

The changes focus on making tests more robust while maintaining compatibility with LangChain's updated API structure.

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

@hassiebp hassiebp merged commit e409727 into main Jan 14, 2025
9 of 10 checks passed
@hassiebp hassiebp deleted the tests-v3-ready branch January 14, 2025 14:28
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.

bug: Usage input/output 0 after upgrading from v2.56.2 to v2.57.1
1 participant