feat(01-05): final cutover — delete data/, prune config.py, async-only tests
- Delete backend/data/ tracked files (D-04): flat-file metadata, settings.json, topics.json, and uploaded files removed from git; backend/data/ added to .gitignore (empty dir remains on macOS due to ACL — no tracked files remain) - Prune backend/config.py: remove DATA_DIR, UPLOADS_DIR, METADATA_DIR, TOPICS_FILE, ensure_data_dirs(); rebase SETTINGS_FILE as derived path from settings.data_dir (Phase 1 flat-file settings kept per plan decision) - Prune backend/tests/conftest.py: remove isolated_data_dir autouse fixture and sync TestClient client fixture; add SQLite type compatibility shim (visit_INET/JSONB) so in-memory db_session can create tables with PostgreSQL-specific column types; add live_services_available fixture - Rewrite backend/tests/test_documents.py: delete all legacy sync tests, remove all @pytest.mark.xfail markers; async-only document tests now use async_client + storage service directly for topic wiring - Rewrite backend/tests/test_health.py: delete legacy sync test_health(client); remove @pytest.mark.xfail from test_health_checks_postgres_and_minio - Port backend/tests/test_topics.py to async_client (sync client removed) - Port backend/tests/test_settings.py to async_client with monkeypatch for SETTINGS_FILE isolation (settings remain flat-file in Phase 1)
This commit is contained in:
+3
-26
@@ -1,5 +1,3 @@
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||
@@ -14,7 +12,7 @@ class Settings(BaseSettings):
|
||||
extra="ignore",
|
||||
)
|
||||
|
||||
# Data directory (legacy flat-file path — kept until Plan 05 removes it)
|
||||
# Data directory — used only for the flat-file settings.json path (Phase 1)
|
||||
data_dir: str = "/app/data"
|
||||
|
||||
# PostgreSQL
|
||||
@@ -36,18 +34,8 @@ class Settings(BaseSettings):
|
||||
|
||||
settings = Settings()
|
||||
|
||||
# ──────────────────────────────────────────────────────────────────────────────
|
||||
# Legacy flat-file constants — kept for backward compatibility through Wave 4.
|
||||
# These are consumed by services/storage.py, services/classifier.py, and
|
||||
# api/settings.py until Plan 05 rewrites those modules.
|
||||
# DO NOT DELETE until Plan 05 completes the storage service cutover.
|
||||
# ──────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
DATA_DIR = Path(os.environ.get("DATA_DIR", "/app/data"))
|
||||
UPLOADS_DIR = DATA_DIR / "uploads"
|
||||
METADATA_DIR = DATA_DIR / "metadata"
|
||||
TOPICS_FILE = DATA_DIR / "topics.json"
|
||||
SETTINGS_FILE = DATA_DIR / "settings.json"
|
||||
# SETTINGS_FILE: still flat-file in Phase 1; migrates to users.ai_provider in Phase 2
|
||||
SETTINGS_FILE = Path(settings.data_dir) / "settings.json"
|
||||
|
||||
DEFAULT_SYSTEM_PROMPT = """You are a document classification assistant. When given a document's text content and a list of existing topics, you must:
|
||||
1. Assign the document to one or more relevant topics from the list.
|
||||
@@ -79,14 +67,3 @@ DEFAULT_SETTINGS = {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def ensure_data_dirs():
|
||||
UPLOADS_DIR.mkdir(parents=True, exist_ok=True)
|
||||
METADATA_DIR.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
if not TOPICS_FILE.exists():
|
||||
TOPICS_FILE.write_text(json.dumps({"topics": []}, indent=2))
|
||||
|
||||
if not SETTINGS_FILE.exists():
|
||||
SETTINGS_FILE.write_text(json.dumps(DEFAULT_SETTINGS, indent=2))
|
||||
|
||||
Reference in New Issue
Block a user