forked from cartsnitch/api
fix(ci): resolve dev lint + typecheck failures (CAR-1330)
Three CI-blocking issues on dev branch (also present on uat, fixed in 2b20946):
1. tests/conftest.py — remove extra blank line (ruff format).
2. src/cartsnitch_api/middleware/rate_limit.py — delete duplicate
_public_limiter/_auth_limiter/_auth_strict_limiter forward-decl block
(the second occurrence; mypy no-redef).
3. src/cartsnitch_api/cache.py:38 — annotate
value: str | bytes | None so mypy doesn't widen redis client return
to Any (no-any-return).
Verified: ruff check . && ruff format --check . && mypy src/cartsnitch_api
all pass.
Sibling of CAR-1330 (which fixes uat directly). Heals dev so future
dev → uat promotions stay green.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -35,7 +35,7 @@ class CacheClient:
|
||||
async def get(self, key: str) -> str | None:
|
||||
if not self._client:
|
||||
return None
|
||||
value = await self._client.get(key)
|
||||
value: str | bytes | None = await self._client.get(key)
|
||||
if value is None:
|
||||
return None
|
||||
if isinstance(value, bytes):
|
||||
|
||||
@@ -121,10 +121,6 @@ if settings.rate_limit_redis_enabled:
|
||||
logger.warning("Failed to connect to Redis for rate limiting, using in-memory: %s", e)
|
||||
_use_redis = False
|
||||
|
||||
_public_limiter: RateLimitBackend
|
||||
_auth_limiter: RateLimitBackend
|
||||
_auth_strict_limiter: RateLimitBackend
|
||||
|
||||
if _use_redis and _redis_client:
|
||||
_public_limiter = RedisSlidingWindow(
|
||||
_redis_client, settings.rate_limit_requests, settings.rate_limit_window_seconds
|
||||
|
||||
@@ -117,7 +117,6 @@ def _register_event_listeners():
|
||||
event.listen(cls, "before_insert", _set_timestamp_defaults)
|
||||
|
||||
|
||||
|
||||
TEST_JWT_SECRET = secrets.token_urlsafe(32)
|
||||
TEST_SERVICE_KEY = secrets.token_urlsafe(32)
|
||||
TEST_FERNET_KEY = "7reF42nmTwbdN21PBoubGp7h_FU8qSimstmlaMLoRK8="
|
||||
|
||||
Reference in New Issue
Block a user