- 
                Notifications
    You must be signed in to change notification settings 
- Fork 0
test(sqlx): add equality operator and eq() function tests #140
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
          
     Merged
      
      
    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
    
  
  
    
    Add Rust/SQLx tests covering JSONB functionality in encrypted payloads: **JSONB Array Tests:** - jsonb_array_elements_text - array element extraction - jsonb_array_length - array size validation **JSONB Path Query Tests:** - jsonb_path_query - complex path expressions - jsonb_path_query_first - single result queries - jsonb_path_exists - path existence checks - Array-specific path operations **JSONB Structure Tests:** - Encrypted selector validation (ct, k, i, p, ob fields) - JSONB field type verification - Payload structure correctness **Test Helpers:** - Function call tracking verification - Test framework meta-tests These tests migrate all JSONB-related assertions from the original SQL test suite to the new Rust/SQLx framework, ensuring consistent behavior across PostgreSQL versions 14-17.
fe685f5    to
    28a0eb9      
    Compare
  
    Add comprehensive Rust/SQLx tests for encrypted data equality: **HMAC Index Equality:** - Operator tests with matching encrypted values - Operator tests with non-matching encrypted values - Plain JSONB comparison validation **Blake3 Index Equality:** - Operator tests with matching encrypted values - Operator tests with non-matching encrypted values - eq() function tests for exact equality - JSONB payload structure preservation (including 'ob' field) **Key Differences Tested:** - HMAC removes 'ob' field during equality comparison - Blake3 preserves 'ob' field for complete payload equality - Both support operator and function-based equality checks These tests ensure encrypted data can be reliably compared for equality using both index-based operators and explicit eq() function calls, maintaining SQL parity across all supported PostgreSQL versions.
23fd39d    to
    b213d55      
    Compare
  
    - Fix assertion count: 513 total (was incorrectly 558) - Fix migrated count: 56 assertions (equality + JSONB, not 40) - Recalculate all coverage percentages with correct totals - Split Task 15 into 8 incremental sub-tasks (15.1-15.9) - Add index type constants module (tests/sqlx/src/index_types.rs) - Add fixture schema documentation (tests/sqlx/fixtures/FIXTURE_SCHEMA.md) - Update success criteria and performance expectations - Remaining: 457/513 assertions (89.1%) to migrate
              
                    freshtonic
  
              
              approved these changes
              
                  
                    Oct 27, 2025 
                  
              
              
            
            
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.
Powering through - LGTM
Fixes 4 HIGH severity issues identified in plan review:
1. Remove duplicate ore table creation
   - Deleted ore_data.sql fixture creation (Task 2, Step 2-3)
   - ore table already exists from migrations/002_install_ore_data.sql
   - Tests now use #[sqlx::test] without fixtures
2. Fix ORE helper function calls
   - Replace create_encrypted_json_with_index(&pool, 42, "ore64")
   - With get_ore_encrypted(&pool, 42) to select from pre-seeded table
   - Applied across Tasks 2-6, 8-9, 12 (all ORE tests)
   - ore table has 'ob' key (ORE_BLOCK), not ore64 index
3. Fix invalid test IDs
   - Replace id=91347 with id=4 for "different record" tests
   - 91347 * 10 = 913470 outside ore range (1-99) → NULL → panic
   - 4 * 10 = 40 is within ore range → valid data
   - Applied in Task 1 (inequality tests)
4. Remove ore_data fixture references
   - Removed all scripts("ore_data") fixture attributes
   - Updated tests to use migrations instead
   - Added comments explaining ore table source
Updated documentation:
- FIXTURE_SCHEMA.md: Document ore from migrations (NOT fixture)
- Added helper function documentation (get_ore_encrypted)
- Added valid id range explanation (1-9 → lookups 10-90)
Coverage: All ORE-related tests now use correct patterns
    
  This was referenced Oct 28, 2025 
      
  
    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.
  
    
  
    
Add comprehensive Rust/SQLx tests for encrypted data equality operations.
HMAC Index Equality
Blake3 Index Equality
eq()function tests for exact equalityKey Differences Tested
Migration Status
✅ Like-for-Like Migration: Complete (40/40 SQL assertions ported)
Test Count: 35 tests (34 functional + 1 helper)
These tests ensure encrypted data can be reliably compared for equality using both index-based operators and explicit
eq()function calls, maintaining SQL parity across all supported PostgreSQL versions.Depends on: #139 (JSONB tests)
Completes: SQLx test migration