Deployment-Setup (PostgreSQL+nginx-Installer) + Sprint-0-Fixes aus Subagenten-Reviews
CI / backend-tests (push) Failing after 1s
CI / backend-tests (push) Failing after 1s
Installer (deploy/): - install_server.sh: PostgreSQL+nginx auf Debian 13, idempotente Rolle/DB-Anlage, pgcrypto-Extension, Speicher-Tuning für 4GB-VPS, Zugangsdaten in chmod-600-Datei statt stdout (postgres-expert/owasp-Review) - nginx-Template mit Security-Headern + Rate-Limit auf /auth/login - systemd-Unit-Template mit Sandboxing (NoNewPrivileges/ProtectSystem/PrivateTmp) Backend-Fixes (fastapi-expert-Review): - get_db: einheitliche commit/rollback-Konvention statt Endpunkt-Copy-Paste - Test-Fixtures auf SQLAlchemy-2.0-Savepoint-Pattern umgestellt (join_transaction_mode), da get_db jetzt selbst committet - Lifespan-Handler: Startup-Guard gegen JWT-Secret-Platzhalter, engine.dispose() beim Shutdown - JWT-Payload ohne ungenutztes roles-Claim (Rollen kommen immer frisch aus der DB) Zusätzlich: Subagenten-Definitionen (~/.claude/agents/) auf lauffähiges Modell fixiert. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L85hmKbvX7Cqkq47KnQhFt
This commit is contained in:
@@ -9,5 +9,16 @@ SessionLocal = async_sessionmaker(engine, expire_on_commit=False)
|
||||
|
||||
|
||||
async def get_db() -> AsyncGenerator[AsyncSession, None]:
|
||||
"""Konvention für alle Endpunkte: Erfolg -> commit, Exception -> rollback.
|
||||
|
||||
Endpunkte selbst rufen kein `db.commit()`/`db.rollback()` auf, sondern verlassen
|
||||
sich auf diese Dependency (Review-Fund: Konvention muss zentral, nicht pro
|
||||
Endpunkt copy-paste sein).
|
||||
"""
|
||||
async with SessionLocal() as session:
|
||||
yield session
|
||||
try:
|
||||
yield session
|
||||
await session.commit()
|
||||
except Exception:
|
||||
await session.rollback()
|
||||
raise
|
||||
|
||||
Reference in New Issue
Block a user