Skip to content

4.17.1

Choose a tag to compare

@HosseinNejatiJavaremi HosseinNejatiJavaremi released this 02 Aug 15:04
· 44 commits to master since this release

Added

Adapters - Keycloak

  • Adapter Mixins - Split the Keycloak adapter and port definitions into focused mixins (auth, auth_flows, authz, client_scopes, clients, components, connection, groups, organizations, realms, roles, uma, users) plus a shared exception-handling mixin.
    • Reduced adapters.py and ports.py from monolithic multi-thousand-line files to thin compositions of mixins.

Adapters - Redis

  • Adapter Mixins - Split the Redis adapter and port definitions into focused mixins (arrays, cluster, connection, hashes, keys, lists, pubsub, sets, sorted_sets) plus a shared exception-handling mixin, mirroring the Keycloak mixin architecture.

Changed

Configs - Ruff Lint Baseline

  • Stricter Rule Enforcement - Removed 22 rules from the Ruff ignore list — ANN002, ANN003, C901, D107, EM101, EM102, F811, G004, PLR0904, PLR0914, PLR1702, PLR2004, Q000, RUF001, S101, S301, S403, SIM108, TC001, TC002, TC003, TRY003 — now enforcing McCabe complexity limits, TYPE_CHECKING-gated imports, %-style logging, no magic values in comparisons, __init__ docstrings, and exception messages defined on the exception class rather than inline.
    • Added PLR0917 (too many positional arguments) to the ignore list for abstract methods that must match external APIs.
  • Narrowed Source Scope - ruff src now targets only archipy (previously archipy and features); this is what caused CI's format --check to start walking docs/*.md (see Fixed).
  • Cleaned Per-File Ignores - Removed ignores that were no longer needed once the underlying code was refactored to comply (BLE001 on Redis/ScyllaDB/Keycloak adapters, PLR0912/PLR0915 on decorators and the gRPC trace server interceptor, features/steps/*, scripts/*) and added matching entries for the new adapter_mixins/* and port_mixins/* packages in Keycloak and Redis so they inherit their parent adapters.py/ports.py exemptions.

Configs - Type Checking

  • Strict ty Rule Set - Enabled 41 additional ty rules at error level, covering dataclass/enum/generic/typed-dict correctness (invalid-dataclass, invalid-generic-enum, invalid-typed-dict-field, dataclass-field-order, ...), final/override checks (final-without-value, override-of-final-variable, abstract-method-in-final-class, ...), and misuse detection (unused-awaitable, pydantic-discarded-extra-argument, shadowed-type-variable, isinstance-against-protocol); removed the deprecated invalid-type-guard-call rule.

Helpers - Error Handling

  • Specific Exceptions Over ValueError - BaseError.abort_grpc_async/abort_grpc_sync/_convert_int_to_grpc_status now raise InternalError when gRPC is unavailable and InvalidArgumentError for an invalid gRPC context, instead of bare ValueError.
  • sqlalchemy_atomic Argument Validation - sqlalchemy_atomic_decorator now raises InvalidArgumentError (with the valid db_type values in additional_data) instead of ValueError for an unrecognized database type.

Adapters - Logging

  • Log Formatting - Standardized logger calls to %-style formatting and removed f-strings from debug/info logs across email, Parsian/Saman IPG, Keycloak, ScyllaDB, and Redis adapters, satisfying the newly enforced G004.

Fixed

Configs - CI

  • Ruff Format Check - Restricted the ruff-action src input so format --check no longer walks Markdown code fences under docs/, which broke after Ruff 0.16 started formatting Markdown.

Models - DTOs

  • Redis Search DTO Rebuild - KnnQueryDTO and RangeQueryDTO imported their field enums only under TYPE_CHECKING, causing Pydantic model rebuilding to fail at runtime; the enums are now imported unconditionally.

Refactored

Helpers - Decorators & Interceptors

  • Complexity Reduction - Split tracing.py's transaction/span decorators, sqlalchemy_atomic.py's exception mapping and wrapper construction, string_utils.py's Persian text normalization/masking pipeline, tracing_utils.py, and the gRPC trace/metric/rate-limit interceptors into smaller private helper functions to satisfy the newly enforced McCabe complexity limit (C901).

Adapters & Helpers - Type Imports

  • TYPE_CHECKING Migration - Moved typing-only imports (Callable, Coroutine, session manager ports, language/error types, and others) behind TYPE_CHECKING across SQLAlchemy, Elasticsearch, Email, Parsian/Saman IPG, Kafka, Keycloak, Redis, ScyllaDB, and Temporal adapters, plus decorators, interceptors, and error modules, to satisfy TC001TC003.

Chore

Configs

  • Type Annotation Fixes - Added targeted ty: ignore[no-matching-overload] for os.fspath and dict.get call sites, noqa: LOG004 for logger.exception usage, and reordered union types in Kafka/Redis return annotations ahead of the stricter rule rollout.

Tooling

  • Graphify Integration - Added the Graphify Cursor plugin, .opencode configuration, and a workspace rule so agents query a codebase knowledge graph instead of ad-hoc grepping.

Adapters - Redis

  • Test Environment Images - Bumped Redis, StarRocks, and ScyllaDB container images in .env.test for compatibility with the mixin-based adapter.

Dependencies

  • Refreshed uv.lock across the ty rule rollout, Graphify plugin addition, and Redis mixin refactor.

Full Changelog: 4.17.0...4.17.1