Skip to content

Conversation

@cofin
Copy link
Member

@cofin cofin commented Jan 23, 2026

Summary

  • non-breaking code cleanup/organization in the repository layer.
  • Improved serialization and removed duplication between cache handler and normal serializers
  • Bug Fixes

Detailed Changes

Repository & Caching Refactor

  • Reduced Bloat: Moved internal caching helpers (_normalize_cache_key_value, _build_list_cache_key, etc.) out of advanced_alchemy/repository/_async.py and into advanced_alchemy/repository/_util.py.
  • Unified Serialization:
    • Refactored advanced_alchemy/_serialization.py to expose encode_complex_type and decode_complex_type.
    • Updated advanced_alchemy/cache/serializers.py and repository/_util.py to share this logic, removing duplicate handling for types like UUID, datetime, and Decimal.
  • Cleanup: Removed unused imports (dataclasses, hashlib, etc.) from the repository files.

Bug Fixes

- Introduced `encode_complex_type` and `decode_complex_type` functions to handle serialization and deserialization of complex types (datetime, date, time, timedelta, Decimal, bytes, UUID, set).
- Removed legacy JSON encoder/decoder functions from `serializers.py` and replaced their usage with the new functions.
- Updated tests to validate the new serialization logic for various complex types.
- Added error handling for unsupported types during encoding.
- Enhanced import handling for optional dependencies in Alembic scripts.
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
78.7% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 71.72414% with 41 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.63%. Comparing base (ebc1c2a) to head (fe27f39).

Files with missing lines Patch % Lines
advanced_alchemy/repository/_util.py 50.72% 25 Missing and 9 partials ⚠️
advanced_alchemy/extensions/litestar/dto.py 66.66% 4 Missing and 1 partial ⚠️
advanced_alchemy/_serialization.py 96.22% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #661      +/-   ##
==========================================
+ Coverage   79.06%   79.63%   +0.57%     
==========================================
  Files          99       99              
  Lines        7915     7828      -87     
  Branches     1073     1051      -22     
==========================================
- Hits         6258     6234      -24     
+ Misses       1315     1255      -60     
+ Partials      342      339       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment