All checks were successful
Mirror to GitHub / mirror (push) Successful in 3s
Root cause of the 06:32 AM outage: running 'pytest tests/' inside the
resolutionflow_backend container silently dropped the public schema on
the DEV database. Two layered bugs made this possible; both are fixed.
Bug 1 — env-var lookup in conftest.TEST_DATABASE_URL put DATABASE_URL
(which normally points at the dev/prod DB) ahead of DATABASE_TEST_URL.
When DATABASE_URL is set, pytest used the dev DB as the 'test' DB and
the test_db fixture's DROP SCHEMA public CASCADE wiped it. Fixed:
- Honor only DATABASE_TEST_URL (or the localhost fallback).
- Assert at module load that the DB name contains 'test' — refuses
to run otherwise. Makes future misconfiguration impossible.
Bug 2 — conftest overrode app.dependency_overrides[get_db] but not
get_admin_db. Endpoints using get_admin_db (register, admin routes)
bypassed the test session and hit the real admin DB. Before Bug 1 was
fixed this was hidden because both engines pointed at the same dev DB.
With isolation in place, register started failing 'Email already
registered' because of stale users in the dev DB. Fixed:
- Also override get_admin_db to yield the same test session. RLS is
not enabled in the create_all-managed test schema, so sharing is
safe.
Also adds DATABASE_TEST_URL=resolutionflow_test to docker-compose.dev.yml
so pytest in the container works out of the box.
Verified: 49/50 Phase 8 + 9 tests pass against resolutionflow_test; the
1 failure is the pre-existing Phase 8 Issue #4
(test_record_decision_persists_and_bumps_state_version).
Refs gitea #145 (will update that issue with this as the primary fix).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
73 lines
2.2 KiB
YAML
73 lines
2.2 KiB
YAML
name: resolutionflow
|
|
|
|
services:
|
|
db:
|
|
image: pgvector/pgvector:pg16
|
|
container_name: resolutionflow_postgres
|
|
environment:
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: postgres
|
|
POSTGRES_DB: resolutionflow
|
|
ports:
|
|
- "${POSTGRES_PORT:-5433}:5432"
|
|
volumes:
|
|
- rf_postgres_data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
backend:
|
|
build:
|
|
context: ./backend
|
|
dockerfile: Dockerfile.dev
|
|
container_name: resolutionflow_backend
|
|
command: uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
|
|
ports:
|
|
- "8000:8000"
|
|
volumes:
|
|
- ${REPO_ROOT}/backend:/app
|
|
environment:
|
|
- APP_NAME=ResolutionFlow
|
|
- DEBUG=true
|
|
- DATABASE_URL=postgresql+asyncpg://postgres:postgres@db:5432/resolutionflow
|
|
- DATABASE_URL_SYNC=postgresql://postgres:postgres@db:5432/resolutionflow
|
|
# Dedicated test database — pytest will refuse to run against any DB
|
|
# whose name doesn't contain 'test' (conftest.py safety assertion).
|
|
- DATABASE_TEST_URL=postgresql+asyncpg://postgres:postgres@db:5432/resolutionflow_test
|
|
- SECRET_KEY=${SECRET_KEY}
|
|
- ALGORITHM=HS256
|
|
- ACCESS_TOKEN_EXPIRE_MINUTES=15
|
|
- REFRESH_TOKEN_EXPIRE_DAYS=7
|
|
- REQUIRE_INVITE_CODE=true
|
|
- FEEDBACK_EMAIL=feedback@resolutionflow.com
|
|
- AI_PROVIDER=anthropic
|
|
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
|
|
- GOOGLE_AI_API_KEY=${GOOGLE_AI_API_KEY:-}
|
|
- ENABLE_MCP_MICROSOFT_LEARN=true
|
|
- FRONTEND_URL=http://docker-01:5173
|
|
- CORS_ORIGINS=["http://localhost:5173","http://127.0.0.1:5173","http://docker-01:5173","http://100.64.78.44:5173"]
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
|
|
frontend:
|
|
build:
|
|
context: ./frontend
|
|
dockerfile: Dockerfile.dev
|
|
container_name: resolutionflow_frontend
|
|
command: npm run dev -- --host 0.0.0.0 --port 5173
|
|
ports:
|
|
- "5173:5173"
|
|
volumes:
|
|
- ${REPO_ROOT}/frontend:/app
|
|
- /app/node_modules
|
|
environment:
|
|
- VITE_API_URL=http://docker-01:8000
|
|
- CHOKIDAR_USEPOLLING=true
|
|
depends_on:
|
|
- backend
|
|
|
|
volumes:
|
|
rf_postgres_data: |