Compare commits

..

4 Commits

Author SHA1 Message Date
cs_betty c1147590dd fix(ci): annotate cache.py:38 redis return type (CAR-1330 dev lint fix)
CI / lint (pull_request) Successful in 6s
CI / typecheck (pull_request) Successful in 16s
CI / test (pull_request) Successful in 21s
CI / build-and-push (pull_request) Has been skipped
mypy no-any-return: annotate value: str | bytes | None so mypy doesn't
widen redis client return to Any. Pre-existing dev branch issue blocking
CAR-1356. Mirrors CAR-1340 uat fix (2b20946).
2026-06-09 17:34:21 +00:00
cs_betty 94d6173054 fix(ci): dedupe _public_limiter/_auth_limiter declarations in rate_limit.py (CAR-1330 dev lint fix)
CI / lint (pull_request) Successful in 7s
CI / typecheck (pull_request) Has been cancelled
CI / test (pull_request) Has been cancelled
CI / build-and-push (pull_request) Has been cancelled
mypy no-redef: the second forward-decl block at line 124 was a duplicate
of the block at line 111. Pre-existing dev branch issue blocking CAR-1356.
Mirrors CAR-1340 uat fix (2b20946).
2026-06-09 17:34:11 +00:00
cs_betty f59668bf0a fix(ci): format tests/conftest.py (CAR-1330 dev lint fix)
CI / lint (pull_request) Successful in 6s
CI / build-and-push (pull_request) Has been cancelled
CI / typecheck (pull_request) Has been cancelled
CI / test (pull_request) Has been cancelled
Remove extra blank line at line 120. Pre-existing dev branch issue
blocking CAR-1356 PR #50. Mirrors CAR-1340 uat fix (2b20946).
2026-06-09 17:34:02 +00:00
cs_betty 14b0e73cee fix(ci): use REGISTRY_TOKEN for build-and-push registry login (CAR-1330)
CI / lint (pull_request) Failing after 4s
CI / typecheck (pull_request) Failing after 17s
CI / test (pull_request) Successful in 23s
CI / build-and-push (pull_request) Has been skipped
Parity fix with uat. Prevents reintroduction on next dev->uat promotion.
The automatic github.token has no package/registry write scope; auth's
proven-green ci.yml uses secrets.REGISTRY_TOKEN instead.

cc @cpfarhood
2026-06-09 17:27:08 +00:00
5 changed files with 9 additions and 23 deletions
+6
View File
@@ -140,6 +140,8 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
build-args: |
APT_CACHE_BUST=${{ github.run_id }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Scan api image for vulnerabilities
uses: anchore/scan-action@v5
@@ -160,9 +162,13 @@ jobs:
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
APT_CACHE_BUST=${{ github.run_id }}
cache-from: type=gha
- name: Create git tag
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
+1 -1
View File
@@ -40,7 +40,7 @@ class CacheClient:
return None
if isinstance(value, bytes):
return value.decode("utf-8", errors="replace")
return str(value)
return value
async def set(self, key: str, value: str, ttl_seconds: int = 300) -> None:
if not self._client:
-6
View File
@@ -25,12 +25,6 @@ from cartsnitch_api.routes.user import router as user_router
@asynccontextmanager
async def lifespan(app: FastAPI):
# Lazy import: keep `dispose_engine` out of the top-level imports so a
# stale or partially-built database.py never breaks module load on
# container start. The function is required for graceful pool cleanup
# on shutdown; if the import fails, the cache_client.close() that
# follows the yield would mask it. See CAR-1135 for the original
# ImportError that motivated this pattern.
from cartsnitch_api.database import dispose_engine
await cache_client.initialize()
+2 -2
View File
@@ -147,8 +147,8 @@ def _get_client_ip(request: Request) -> str:
"""Extract client IP, respecting X-Forwarded-For behind a reverse proxy."""
forwarded = request.headers.get("x-forwarded-for")
if forwarded:
return str(forwarded.split(",")[0].strip())
return str(request.client.host) if request.client else "unknown"
return forwarded.split(",")[0].strip()
return request.client.host if request.client else "unknown"
def _get_rate_limit_key(request: Request) -> tuple[str, RateLimitBackend]:
-14
View File
@@ -3,22 +3,8 @@
import pytest
from httpx import ASGITransport, AsyncClient
from cartsnitch_api.database import dispose_engine
from cartsnitch_api.main import app
def test_dispose_engine_importable_from_database():
"""Regression for CAR-1135: api main.py used to import dispose_engine
at module level. A stale database.py (no dispose_engine) crashed the
container at import time with ImportError on line 9. The fix moved
the import inside the lifespan function, but `dispose_engine` must
still be importable from `cartsnitch_api.database` for the lifespan
teardown to actually close pooled connections.
"""
assert callable(dispose_engine)
assert dispose_engine.__name__ == "dispose_engine"
EXPECTED_ROUTES = [
# Auth (3 — register/login/refresh are handled by Better-Auth service)
("get", "/auth/me"),