pagepiper/tests
pyr0ball 8eef52a054 feat: per-user database isolation for cloud instances (closes #4)
Implements Option A from the issue design: each cloud user gets their own
data directory (DATA_DIR/users/{user_id}/) with separate pagepiper.db,
pagepiper_vecs.db, uploads/, and books/. Local mode is unchanged.

Key changes:
- app/startup.py: extract apply_migrations, reembed_docs,
  check_and_rebuild_vec_schema out of main.py (no circular imports)
- app/config.py: add LOCAL_USER_ID constant and user_data_dir() helper
- app/cloud_session.py: extract resolve_authenticated_user(); require_paid_tier
  now returns user_id (str) instead of None
- app/deps.py: add UserCtx dataclass (db_path, vec_db_path, data_dir,
  watch_dir, bm25) + get_user_ctx dependency; per-user startup guard runs
  migrations + vec schema check once per process per user
- app/main.py: _bm25 singleton -> _bm25_map dict keyed by user_id;
  add _get_bm25_for(); lifespan only runs startup checks in local mode
- app/api/library.py, search.py, chat.py: thread UserCtx through all
  endpoints; remove module-level _mark_bm25_dirty injection pattern
- tests/conftest.py: override get_user_ctx in addition to get_db so all
  endpoints get a consistent test UserCtx
2026-05-13 16:31:51 -07:00
..
__init__.py feat: add database schema and migration runner 2026-05-04 17:10:38 -07:00
conftest.py feat: per-user database isolation for cloud instances (closes #4) 2026-05-13 16:31:51 -07:00
test_bm25_index.py fix(services): add SQLite error handling and strengthen top_k test 2026-05-04 17:20:26 -07:00
test_chat_api.py feat(api): add retriever, synthesizer, and chat endpoint (BSL — BYOK gate) 2026-05-04 17:47:10 -07:00
test_db_migrate.py fix(config): handle /v1 suffix in PAGEPIPER_OLLAMA_URL; add DATA_DIR mkdir guard 2026-05-04 17:13:50 -07:00
test_ingest.py fix(ingest): batch embedding, connection guard, correct upsert id param, module-level imports in tests 2026-05-04 17:36:18 -07:00
test_library_api.py feat(ingest): add full PDF ingest pipeline (cf-orch task, BYOK embed) 2026-05-04 17:33:02 -07:00
test_search_api.py feat: per-user database isolation for cloud instances (closes #4) 2026-05-13 16:31:51 -07:00
test_startup.py feat: per-user database isolation for cloud instances (closes #4) 2026-05-13 16:31:51 -07:00
test_synthesizer.py fix: T7 quality — SynthesisResult.citations tuple, retriever comments, test assertion 2026-05-04 17:51:22 -07:00
test_text_clean.py feat: RAG retrieval quality, artifact cleaning, and ingestion progress UI 2026-05-06 08:25:58 -07:00