Compare commits

..

3 Commits

Author SHA1 Message Date
Barcode Betty 4eef2aff92 fix: resolve lint failures blocking CI
- src/cartsnitch_api/auth/dependencies.py: remove unused Cookie import
- src/cartsnitch_api/auth/routes.py: remove unused BaseModel, select, and User imports
- src/cartsnitch_api/main.py: fix import ordering

These were pre-existing issues unrelated to CAR-932 fix, blocking CI.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-05-23 22:19:38 +00:00
Savannah Savings 5c33b6ee38 Merge pull request 'Fix CI pipeline failures in cartsnitch/api' (#22) from cs_betty/api:barcode-betty/fix-ci-pipeline into dev
Merge PR #22: Fix CI pipeline failures in cartsnitch/api

Fixes:
- Remove cache: pip from setup-python to fix intermittent tar corruption
- Add CARTSNITCH_SERVICE_KEY and CARTSNITCH_FERNET_KEY test env vars

Reviewed-by: Savannah Savings (CTO)
Approved-by: Checkout Charlie (QA)
2026-05-23 22:13:56 +00:00
Flea Flicker cf4b29b8d3 Fix CI pipeline failures: remove pip cache from setup-python, add missing env vars
- Remove 'cache: pip' from setup-python in lint, typecheck, test jobs to fix
  intermittent 'archive/tar: write too long' errors on act_runner pods
- Add CARTSNITCH_SERVICE_KEY and CARTSNITCH_FERNET_KEY to test job env
  to satisfy Settings pydantic model requirements

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-05-23 21:57:04 +00:00
9 changed files with 13 additions and 18 deletions
+2 -3
View File
@@ -26,7 +26,6 @@ jobs:
- uses: actions/setup-python@v5 - uses: actions/setup-python@v5
with: with:
python-version: "3.12" python-version: "3.12"
cache: pip
- run: pip install ruff - run: pip install ruff
- name: Ruff lint - name: Ruff lint
run: ruff check . run: ruff check .
@@ -41,7 +40,6 @@ jobs:
- uses: actions/setup-python@v5 - uses: actions/setup-python@v5
with: with:
python-version: "3.12" python-version: "3.12"
cache: pip
- name: Install system dependencies - name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y libpq-dev build-essential run: sudo apt-get update && sudo apt-get install -y libpq-dev build-essential
- run: pip install -e ".[dev]" mypy - run: pip install -e ".[dev]" mypy
@@ -83,12 +81,13 @@ jobs:
CARTSNITCH_DATABASE_URL: postgresql+asyncpg://cartsnitch:cartsnitch_test@localhost:5432/cartsnitch_test CARTSNITCH_DATABASE_URL: postgresql+asyncpg://cartsnitch:cartsnitch_test@localhost:5432/cartsnitch_test
CARTSNITCH_REDIS_URL: redis://localhost:6379/0 CARTSNITCH_REDIS_URL: redis://localhost:6379/0
CARTSNITCH_JWT_SECRET_KEY: test-secret-do-not-use-in-prod CARTSNITCH_JWT_SECRET_KEY: test-secret-do-not-use-in-prod
CARTSNITCH_SERVICE_KEY: test-service-key-do-not-use-in-prod
CARTSNITCH_FERNET_KEY: wXWQsC0FZlhSz2t_tfVQjNUSP8vgAGG3o3pkjrX8Bw0=
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/setup-python@v5 - uses: actions/setup-python@v5
with: with:
python-version: "3.12" python-version: "3.12"
cache: pip
- name: Install system dependencies - name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y libpq-dev build-essential run: sudo apt-get update && sudo apt-get install -y libpq-dev build-essential
- run: pip install -e ".[dev]" - run: pip install -e ".[dev]"
+2 -1
View File
@@ -5,7 +5,8 @@ Sessions are verified by querying the shared sessions table directly.
""" """
from datetime import UTC, datetime from datetime import UTC, datetime
from fastapi import Cookie, Depends, Header, HTTPException, Request, status
from fastapi import Depends, Header, HTTPException, Request, status
from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer
from sqlalchemy import text from sqlalchemy import text
from sqlalchemy.ext.asyncio import AsyncSession from sqlalchemy.ext.asyncio import AsyncSession
-3
View File
@@ -6,13 +6,10 @@ endpoints that query our own user data from the shared database.
""" """
from fastapi import APIRouter, Depends, HTTPException, status from fastapi import APIRouter, Depends, HTTPException, status
from pydantic import BaseModel
from sqlalchemy import select
from sqlalchemy.ext.asyncio import AsyncSession from sqlalchemy.ext.asyncio import AsyncSession
from cartsnitch_api.auth.dependencies import get_current_user from cartsnitch_api.auth.dependencies import get_current_user
from cartsnitch_api.database import get_db from cartsnitch_api.database import get_db
from cartsnitch_api.models import User
from cartsnitch_api.schemas import ( from cartsnitch_api.schemas import (
UpdateUserRequest, UpdateUserRequest,
UserResponse, UserResponse,
+2 -2
View File
@@ -6,10 +6,11 @@ from fastapi import APIRouter, FastAPI
from cartsnitch_api.auth.routes import router as auth_router from cartsnitch_api.auth.routes import router as auth_router
from cartsnitch_api.cache import cache_client from cartsnitch_api.cache import cache_client
from cartsnitch_api.database import dispose_engine
from cartsnitch_api.middleware.audit import add_audit_middleware
from cartsnitch_api.middleware.cors import add_cors_middleware from cartsnitch_api.middleware.cors import add_cors_middleware
from cartsnitch_api.middleware.error_handler import add_error_handlers, add_error_monitor_middleware from cartsnitch_api.middleware.error_handler import add_error_handlers, add_error_monitor_middleware
from cartsnitch_api.middleware.rate_limit import add_rate_limit_middleware from cartsnitch_api.middleware.rate_limit import add_rate_limit_middleware
from cartsnitch_api.middleware.audit import add_audit_middleware
from cartsnitch_api.routes.alerts import router as alerts_router from cartsnitch_api.routes.alerts import router as alerts_router
from cartsnitch_api.routes.coupons import router as coupons_router from cartsnitch_api.routes.coupons import router as coupons_router
from cartsnitch_api.routes.health import router as health_router from cartsnitch_api.routes.health import router as health_router
@@ -25,7 +26,6 @@ from cartsnitch_api.routes.user import router as user_router
@asynccontextmanager @asynccontextmanager
async def lifespan(app: FastAPI): async def lifespan(app: FastAPI):
from cartsnitch_api.database import dispose_engine
await cache_client.initialize() await cache_client.initialize()
yield yield
await cache_client.close() await cache_client.close()
+2 -4
View File
@@ -177,10 +177,8 @@ async def _create_test_user_and_session(
async with db_engine.begin() as conn: async with db_engine.begin() as conn:
await conn.execute( await conn.execute(
text( text(
"INSERT INTO users (id, email, hashed_password, display_name, " "INSERT INTO users (id, email, hashed_password, display_name, email_verified, created_at, updated_at) "
"email_verified, created_at, updated_at) " "VALUES (:id, :email, :hashed_password, :display_name, :email_verified, :created_at, :updated_at)"
"VALUES (:id, :email, :hashed_password, :display_name, :email_verified, "
":created_at, :updated_at)"
), ),
{ {
"id": user_id, "id": user_id,
+1 -2
View File
@@ -138,8 +138,7 @@ async def test_expired_session_rejected(client, db_engine):
async with db_engine.begin() as conn: async with db_engine.begin() as conn:
await conn.execute( await conn.execute(
text( text(
"INSERT INTO users (id, email, hashed_password, display_name, " "INSERT INTO users (id, email, hashed_password, display_name, email_verified, created_at, updated_at) "
"email_verified, created_at, updated_at) "
"VALUES (:id, :email, :hp, :dn, :ev, :ca, :ua)" "VALUES (:id, :email, :hp, :dn, :ev, :ca, :ua)"
), ),
{ {
+2
View File
@@ -1,5 +1,7 @@
"""Tests for Settings config, specifically the database_url env var fallback.""" """Tests for Settings config, specifically the database_url env var fallback."""
import os
from cartsnitch_api.config import Settings from cartsnitch_api.config import Settings
+1 -2
View File
@@ -65,8 +65,7 @@ class TestSessionValidation:
async with db_engine.begin() as conn: async with db_engine.begin() as conn:
await conn.execute( await conn.execute(
text( text(
"INSERT INTO users (id, email, hashed_password, display_name, " "INSERT INTO users (id, email, hashed_password, display_name, email_verified, created_at, updated_at) "
"email_verified, created_at, updated_at) "
"VALUES (:id, :email, :hp, :dn, :ev, :ca, :ua)" "VALUES (:id, :email, :hp, :dn, :ev, :ca, :ua)"
), ),
{ {
+1 -1
View File
@@ -1,7 +1,7 @@
"""Tests for rate limiting middleware.""" """Tests for rate limiting middleware."""
import time import time
from unittest.mock import AsyncMock, MagicMock from unittest.mock import AsyncMock, MagicMock, patch
import pytest import pytest