Files
rag-technical-docs-assistant/tests
amirhosein mazaheri 21a0ea076a chore(backend): save remaining API and deployment changes
Expose frozen factual review policy, update API descriptions and Swagger settings, and adjust local deployment and embedding connectivity.

Include the requested extraction candidates and review-policy regression coverage. Validation: 31 OCR policy tests passed; staged diff whitespace checks passed.
2026-10-10 17:43:17 +03:30
..

Test layout

  • unit/: provider-free configuration, URL security, imports and test-environment regressions.
  • integration/: PostgreSQL constraints, migration/profile lifecycle, concurrency, native vectors and schema isolation.
  • support/: reusable PostgreSQL lifecycle and row helpers; helpers do not live in test modules.
  • conftest.py: shared settings, isolated environment and acceptance option.
  • integration/conftest.py: database fixtures and postgres marker for all integration cases.
  • postgres_prerequisites.py: unchanged prerequisite command entry point.

Run ordinary tests:

.venv/Scripts/python -m pytest -m "not postgres"

For database tests, configure an isolated TEST_DATABASE_URL as described in foundation setup, then run:

.venv/Scripts/python -m tests.postgres_prerequisites
.venv/Scripts/python -m pytest -m postgres --require-postgres

Use .venv/minimum/Scripts/python for the minimum pgvector dependency environment. The same commands and assertions apply. Missing database configuration fails explicit acceptance; skipped database cases are not passing evidence.

Organization validation: installed environment full suite 163 passed; minimum pgvector 0.3.6 PostgreSQL suite 48 passed. Both prerequisite checks passed. Production code and migration history were unchanged.

Phase 5 worker coverage is in unit/test_phase5.py and integration/test_phase5.py; see worker operations. The 2026-10-07 provider-free full suite passed 1004 tests with 3 existing Windows symlink skips; PostgreSQL acceptance passed 160 tests without skips on isolated PostgreSQL 16.15 / pgvector 0.8.7. The final pointer guard rerun passed all 43 worker database tests.

Extended Phase 5 final acceptance (2026-10-07): provider-free 1050 passed, 3 existing Windows symlink skips; isolated PostgreSQL 186 passed, no skips. New configuration/FAQ cases are in unit/test_phase5_review.py. The 69 worker/review PostgreSQL cases include exact PDF/image/multi-page resume, concurrent decisions/ retry, source/lease races, revoked access, audit rollback and whole FAQ inclusion. See worker operations for the remaining HTTP identity/Origin/CSRF dependency and real-provider limitations.

Phase 5 remaining-backend repair coverage is in unit/test_phase5_repairs.py and integration/test_phase5.py: shared/section-specific FAQ conditions and exceptions, excluded exclusive context, ambiguous/malformed relationship rejection, immutable legacy factual review, identical versus conflicting attachment, stale/expired fencing, bounded English/Persian review metadata, exact approved OCR resume, genuine unreadability and context-preserving publication/mismatch rollback. Latest full results: provider-free 1064 passed / 3 existing Windows symlink skips; isolated PostgreSQL 196 passed, zero skips. See worker operations for exact commands, database isolation and remaining HTTP/provider limitations.

Phase 6 integration proof lives in integration/test_phase6.py with real extraction and support/embedding.py deterministic hash vectors. unit/test_phase6.py covers opt-in provider smoke gates and redacted diagnostics. The real-provider command python -m app.ingestion_smoke requires explicit corpus/provider configuration and --allow-provider-calls; pytest never invokes a real provider. See the operator handoff.