-
Notifications
You must be signed in to change notification settings - Fork 15
[TST] Add v2 API #80
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
base: main
Are you sure you want to change the base?
[TST] Add v2 API #80
Conversation
- Add ServerClientTest with comprehensive test coverage for v2 API - Add GitHub Actions workflow for v2 API testing with matrix strategy - Add nightly comprehensive testing workflow - Add PR validation workflow for quick checks - Add release validation workflow - Test multiple ChromaDB versions (0.5.15, 0.5.20, latest) - Test multiple Java versions (8, 11, 17, 21) - Include stress tests and performance benchmarks - Add test reporting and artifact collection
Code Review for PR #80Overall, this is a well-structured PR that adds comprehensive testing infrastructure for the v2 API. The test coverage is extensive and the CI/CD workflows are thoughtfully designed. ✅ Strengths
🔧 Suggestions for Improvement
🔒 Security Considerations
📊 Performance
The PR significantly improves test coverage and CI/CD capabilities. With the suggested improvements, this will provide excellent quality assurance for the v2 API implementation. |
V2 API PR Validation Results❌ Some checks failed Changes Detected
|
|
|
||
| echo "" >> nightly-report.md | ||
| echo "## Stress Test Results" >> nightly-report.md | ||
| if [ -f "test-artifacts/stress-test-results-v2/TEST-*V2StressTest.xml" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The shell wildcard pattern inside double quotes won't expand as expected. For reliable file detection, consider using:
if ls test-artifacts/stress-test-results-v2/TEST-*V2StressTest.xml &>/dev/null; thenThis ensures proper glob expansion and redirects both stdout and stderr to avoid unnecessary output.
| if [ -f "test-artifacts/stress-test-results-v2/TEST-*V2StressTest.xml" ]; then | |
| if ls test-artifacts/stress-test-results-v2/TEST-*V2StressTest.xml &>/dev/null; then |
Spotted by Diamond
Is this helpful? React 👍 or 👎 to let us know.
| comment += '- Test files changed: ${{ steps.changes.outputs.test_changed }}\n\n'; | ||
|
|
||
| // Add test results if available | ||
| const testResults = `${{ steps.test-results.outputs.summary }}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The workflow references steps.test-results.outputs.summary in the PR comment generation section, but there's no corresponding step with ID test-results that sets this output variable. This will cause the comment generation to use an empty value. Either:
- Add a step with ID
test-resultsthat sets thesummaryoutput, or - Remove this reference and use another method to include test results in the PR comment
This issue appears in the v2-api-pr-validation.yml workflow file.
| const testResults = `${{ steps.test-results.outputs.summary }}`; | |
| const testResults = `No test results available`; |
Spotted by Diamond
Is this helpful? React 👍 or 👎 to let us know.
| asset_path: ./release/chromadb-java-client-${{ steps.version.outputs.version }}.jar | ||
| asset_name: chromadb-java-client-${{ steps.version.outputs.version }}.jar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There appears to be a job dependency issue in the workflow. The variable steps.version.outputs.version is defined in the validate-release job but is being referenced directly in the publish-release job. Since job outputs aren't automatically shared between jobs, this will cause the asset path and name to be undefined.
To fix this, either:
- Pass the version as a job output from
validate-releaseand reference it asneeds.validate-release.outputs.versionin thepublish-releasejob, or - Re-extract the version in the
publish-releasejob using the same logic
This ensures the artifact paths will be correctly resolved during the release process.
| asset_path: ./release/chromadb-java-client-${{ steps.version.outputs.version }}.jar | |
| asset_name: chromadb-java-client-${{ steps.version.outputs.version }}.jar | |
| asset_path: ./release/chromadb-java-client-${{ needs.validate-release.outputs.version }}.jar | |
| asset_name: chromadb-java-client-${{ needs.validate-release.outputs.version }}.jar |
Spotted by Diamond
Is this helpful? React 👍 or 👎 to let us know.
|
|
||
| # Download previous version for comparison | ||
| PREV_MAJOR=${{ steps.version.outputs.major }} | ||
| PREV_MINOR=$((steps.version.outputs.minor - 1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The bash arithmetic syntax here is incorrect. When referencing GitHub Actions outputs in a bash arithmetic context, proper variable expansion is needed. Either of these approaches would work:
PREV_MINOR=$((${steps.version.outputs.minor} - 1))Or with a fallback to prevent errors if the variable is unset:
PREV_MINOR=$((${steps.version.outputs.minor:-0} - 1))This ensures the arithmetic operation is performed correctly with the value from the GitHub Actions output.
| PREV_MINOR=$((steps.version.outputs.minor - 1)) | |
| PREV_MINOR=$((${steps.version.outputs.minor:-0} - 1)) |
Spotted by Diamond
Is this helpful? React 👍 or 👎 to let us know.
Add complete v2 API implementation including: - Client implementations (ServerClient, CloudClient, Collection) - Authentication providers (Basic, Token, ChromaToken) - Model classes for v2 API operations - HTTP client wrapper - Exception handling - Example usage code This fixes compilation errors in the CI tests by adding the missing source files that were referenced in the test code. Co-Authored-By: Claude <[email protected]>
Additional Code ReviewBuilding on the previous review, here are some additional observations: Test Quality Improvements
Performance & Reliability
CI/CD Enhancements
Positive Notes
The test infrastructure is solid and will significantly improve project quality. The suggested improvements would make it production-grade. |
The v2 API implementation was using /api/v2 endpoints that don't exist yet in ChromaDB. Updated to use /api/v1 endpoints as a temporary measure. Note: The v2 API tests will still fail because: - v2 expects tenant/database concepts that v1 doesn't have - v2 response models expect fields that v1 doesn't return - The endpoint structure is fundamentally different This is a partial fix to address compilation errors. Full v2 API support will require ChromaDB to implement the actual v2 endpoints. Co-Authored-By: Claude <[email protected]>
Add comprehensive documentation explaining the current state of the v2 API implementation, including: - Clear warning that v2 API doesn't exist in ChromaDB yet - Known issues and limitations - CI/CD workflow documentation - Recommendations for users - Future work needed when v2 API is released This helps set proper expectations for anyone looking at the v2 implementation and explains why tests are currently failing. Co-Authored-By: Claude <[email protected]>
Code Review - Additional ObservationsAfter reviewing the test implementation and CI workflows in detail, here are specific actionable improvements: 🐛 Critical Issues
⚡ Performance & Reliability
🔍 Missing Test Coverage
💡 Workflow Improvements
✅ What Works Well
The foundation is strong - these improvements would elevate it to production quality. Great work on the comprehensive test coverage! |
- Update all v2 API endpoints from /api/v1 to /api/v2 - Update ChromaClient to use correct v2 paths for all operations - Fix Collection basePath to use full v2 path format - Update default tenant to default_tenant and database to default_database - Fix collections_count endpoint response parsing - Update tests to use ChromaDB 1.1.0 which supports v2 API - Add database creation in test setup as required by v2 API Co-Authored-By: Claude <[email protected]>
Code Review for PR #80This PR adds excellent test coverage and CI infrastructure for the v2 API. Here is my focused feedback: ✅ Strengths
🔧 Key Improvements Needed1. TestContainer Management 2. Missing Test Assertions
3. Resource Management
4. Error Handling Tests
5. Flaky Test Prevention 📊 Performance
🔒 SecurityConsider adding authentication test scenarios beyond the current no-auth tests. The test infrastructure provides solid coverage. With these improvements, it will be production-grade. |
- Update all workflow files to use actions/upload-artifact@v4 - Update all workflow files to use actions/download-artifact@v4 - Fixes CI pipeline failures due to deprecated v3 artifact actions - Affects: v2-api-tests.yml, v2-api-pr-validation.yml, v2-api-nightly.yml, v2-api-release.yml
- Update all workflow files to use actions/upload-artifact@v5 - Update all workflow files to use actions/download-artifact@v5 - Use latest v5 version of artifact actions
Code Review for V2 API Tests & CI Workflows✅ Strengths
🔧 Issues to Address
🚀 Recommendations
Overall, solid testing infrastructure that needs cleanup and alignment with project conventions. |
- Update v2-api-tests.yml to test against ChromaDB 1.0.0, 1.1.0, and latest - Update v2-api-pr-validation.yml to use ChromaDB 1.1.0 - Update v2-api-nightly.yml to test versions 1.0.0 through 1.1.0 - Update v2-api-release.yml to test against 1.0.0, 1.0.4, 1.1.0, and latest - Remove exclusions for older versions as they are no longer needed
Focused Code Review🚨 Priority Issues Not Previously Mentioned
✅ What Works Well
🎯 Quick Wins
The test infrastructure is valuable - these fixes will make it merge-ready. |
- Revert all workflow files to use actions/upload-artifact@v4 - Revert all workflow files to use actions/download-artifact@v4 - v5 of these actions does not exist yet
Code Review: V2 API Tests and CI WorkflowsStrengths
Issues to Address
Security
Test Coverage Gaps
Recommendations
Overall solid foundation. Main concern is ChromaDB version compatibility with v2 API endpoints. |
- Update artifact actions to v4 (v5 doesn't exist) - Update ChromaDB versions to 1.0.0-1.1.0 in workflows - Fix ChromaClientTest imports and test methods - Clean up temporary files and update .gitignore
- Fix remaining artifact upload actions from v5 to v4 in workflows - Add V2StressTest class for stress testing the V2 API
- Replace curl with wget in healthchecks (curl not available in ChromaDB container) - Fix checkout action version from v5 to v4 (v5 doesn't exist) - Fix download-artifact action version from v5 to v4 - Use /api/v1 endpoint for healthcheck (more reliable)
| fail-fast: false | ||
| matrix: | ||
| chroma-version: ${{ fromJson(needs.determine-versions.outputs.matrix) }} | ||
| java-version: [8, 17] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a mismatch between the Java versions in the test matrix and the compatibility report. The matrix in v2-api-tests.yml specifies Java versions [8, 17], but the compatibility report in the same file (lines 208-209) checks for Java 11 and 17. This will cause the compatibility report to show incorrect results for Java 11, which isn't actually being tested. Consider either adding Java 11 to the test matrix or updating the compatibility report to check for Java 8 instead.
| java-version: [8, 17] | |
| java-version: [8, 11, 17] |
Spotted by Diamond
Is this helpful? React 👍 or 👎 to let us know.
- Fix compatibility report to check Java 8 and 17 (not 11 and 17) - Change /api/v2 to /api/v1 for better compatibility with ChromaDB 1.x - Remove obsolete V2 documentation files - .DS_Store already in .gitignore
- Replace curl with wget in healthcheck commands (curl not available in ChromaDB container) - Fix nightly workflow to use curl from runner instead of docker exec - Update all action versions from v5 to v4 (v5 doesn't exist) - Fixes container initialization failures across all workflows
Implements a hybrid API design that provides both simple convenience methods for common operations (80% use case) and builder patterns for complex scenarios (20% use case). This aligns the Java client with Chroma's official Python/TypeScript SDKs and follows patterns from successful Java libraries like OkHttp and Jedis. Changes: - Add convenience methods to Collection class for add, query, get, update, upsert, and delete operations - Add queryTexts support to QueryRequest for text-based semantic search - Add queryByText convenience methods to Collection class - Update QuickStartExample to demonstrate both simple and advanced APIs - Add comprehensive tests for new convenience methods (17 tests passing) - Update V2_API.md with dual API documentation and usage guidelines Design philosophy: "Simple things should be simple, complex things should be possible"
Summary
This PR adds comprehensive testing infrastructure for the v2 API implementation, including TestContainers-based integration tests and multiple CI/CD workflows.
Changes
Testing
CI/CD Workflows
v2-api-tests.yml: Main testing workflow
v2-api-nightly.yml: Comprehensive nightly testing
v2-api-pr-validation.yml: Quick PR validation
v2-api-release.yml: Release validation
Test Coverage
The test suite covers:
Testing Strategy
How to Test Locally
Checklist
Related Issues
Notes