Use NullPool for Celery workers so connections are opened/closed per task
instead of accumulating in per-process pools. Add worker_process_init
signal to dispose inherited engines on fork. Keep QueuePool for the web
service. Increase PostgreSQL max_connections to 200 as a safety net.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Pipeline: Mermaid CLI (mmdc) renders diagrams directly to PDF via
Puppeteer, pdfcrop trims whitespace, pandoc + xelatex produces the
final 20-page document with vector diagrams, syntax-highlighted code,
styled headers/footers, and table of contents.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Comprehensive technical reference covering system architecture, Celery
queue topology, Cloud Run video offloading, resilience patterns, and
configuration. Includes 6 Mermaid diagrams.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
These fields are populated by earlier tasks in the Celery chain and are
not dependent on video generation succeeding.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add a named volume for Redis so queue data survives container restarts.
Add deploy-backend-safe.sh that rebuilds and recreates only app/worker
containers while leaving db and redis untouched, preserving the queue.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Offload CPU-intensive FFmpeg video creation to an autoscaling Cloud Run
service to clear the 1600+ task backlog. The Celery video worker becomes
a thin HTTP client (concurrency bumped from 2 to 50) that dispatches to
Cloud Run when CLOUD_RUN_VIDEO_URL is set, with local fallback for dev.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Prompt now requires an animal/pet as primary subject; rejects human-primary
images, non-photos, and images with no animals
- Gemini content filter blocks (empty response or safety exception) now
reject the image instead of failing open
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds Google Gemini vision API as a configurable alternative to NudeNet
for image safety checks. Controlled via IMAGE_SAFETY_METHOD env var
(default: gemini). Gemini checks for a broader range of unsafe content
including nudity, violence, and offensive material. Fail-open on errors.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove word-boundary anchors so banned words are caught even when
embedded in larger strings (e.g. "xBatmanx" now matches "Batman").
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Load banned_words.txt at module init and check against it using
word-boundary regex matching, alongside the existing better-profanity
library check.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>