Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Address feedback from three review passes: fix Alembic existing-deployment handling, HTMX/StreamingResponse conflict, CSRF double-submit pattern, multi-profile atomicity, and various clarifications. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
13-task plan covering pydantic-settings, Alembic migrations, HTMX frontend, in-memory generation, and code quality upgrades. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace the manual Config class (os.getenv + validate method) with a pydantic-settings BaseSettings singleton. All modules now import `settings` instead of `Config`. Removes load_dotenv() from main.py since pydantic-settings handles .env files natively. Removes the E402 per-file-ignore that was needed for the load_dotenv() workaround. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Set up Alembic with initial migration for all 4 tables - Remove create_schema() from database.py and its call in main.py - Add entrypoint.sh with DB stamping logic for existing databases - Update Dockerfile with sqlite3 dep, alembic files, and ENTRYPOINT - Remove test_create_schema test since the function no longer exists Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace per-request httpx.AsyncClient creation with a single shared client managed via FastAPI's lifespan context manager and injected through Depends. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Makefile: run target now runs alembic migrations first, removed preview target - Dockerfile: added comments explaining entrypoint.sh steps - README: added TIMEZONE and LOG_FORMAT env vars, updated make run description Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The middleware was generating a new token on every GET response, but the template read the token from the incoming request cookie (which was the old/empty value). Now reuses the existing cookie token and only generates a new one on first visit, injecting it into the request so templates can read it. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Downloads now named appointments_YYYY-MM-DD-HH-MM-SS.pdf/.zip Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
await request.form() in the middleware consumed the body stream, leaving nothing for FastAPI's Form(...) parameters. Now caches the body and re-injects it after CSRF validation so downstream handlers can read it. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Create blob with explicit MIME type (application/pdf or application/zip) and use arrayBuffer instead of blob() to ensure correct content type. Also defer cleanup with setTimeout to avoid race conditions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
v5.0 — Best-Practices Refactoring & Architecture Improvements
Umfassende Modernisierung der Codebase nach aktuellen Best Practices. 49 Dateien geändert, 96 Tests bestanden.
Highlights
Konfiguration & Infrastruktur
pydantic-settingsersetzt manuelleConfig-Klasse mitos.getenv()— typsichere, validierte KonfigurationBase.metadata.create_all()— sicheres DB-Schema-Management mitentrypoint.shfür bestehende Datenbankenpytzdurchzoneinfo(Python 3.12 stdlib) ersetzt, Zeitzone konfigurierbar viaTIMEZONEEnv-Varpyproject.tomlgepinntPerformance & Ressourcen
httpx.AsyncClientvia FastAPI Lifespan statt Client-pro-RequestBytesIO+StreamingResponse— keine temporären Dateien mehrpathlibdurchgängig stattos.pathSicherheit
ErrorResponse-Schema und Exception-HandlernObservability
structlog(Console/JSON konfigurierbar viaLOG_FORMAT)/health-Endpoint mit DockerHEALTHCHECKFrontend
/fragments/appointments)YYYY-MM-DD-HH-MM-SS)Multi-Profil-Support
Code-Qualität
Neue Umgebungsvariablen
TIMEZONEEurope/BerlinLOG_FORMATconsoleconsoleoderjsonDeployment
Vollständig rückwärtskompatibel.
entrypoint.sherkennt bestehende Datenbanken automatisch und stamped sie für Alembic. Kein manueller Eingriff nötig.Commits (22)
071ce6frefactor: replace Config class with pydantic-settings2196558refactor: migrate from pytz to zoneinfo, make timezone configurable2b57997feat: add Alembic migrations, remove create_schemaeca1b96refactor: shared async httpx client with lifespan management508066drefactor: in-memory PDF/JPEG generation with StreamingResponse9ee1211feat: add /health endpoint with Docker HEALTHCHECK00b35d7feat: structured logging with structlog, configurable formatc6e29a5feat: add CSRF protection middleware (double-submit cookie)e267478feat: standardized error response model and exception handlers4a0f742refactor: replace os.path with pathlib throughout99190b3refactor: add complete type annotations74788e8feat: multi-profile settings with clone, delete, and orphan cleanupfd3c152feat: HTMX + Alpine.js frontend upgrade7ee3462docs: update Makefile, Dockerfile comments, and README7f611bbfix: CSRF token mismatch on first login6da9257feat: add timestamp to download filenamesd3f3fd7chore: bump uvicorn to 0.42.09fc00abchore: pin all dependency versions in pyproject.toml85b3b35fix: CSRF middleware consuming form body before FastAPI can parse it65a5af5fix: browser marking downloads as insecure