feat(ingestion): add Phase 1 database and application foundation

Add the scoped PostgreSQL/pgvector schema, independent ingestion settings and ports, embedding profile checks, and trusted administrator bootstrap.

Include repository contracts and guidance, organized provider-free and PostgreSQL tests, deployment setup, and byte-preserving migration attributes.

Validation: 163 tests passed; all 48 PostgreSQL cases passed with pgvector Python 0.5.0 and 0.3.6. No production schema or historical metadata was changed.
This commit is contained in:
amirhosein mazaheri
2026-10-05 16:38:28 +03:30
parent cb54a35c90
commit baf58da562
50 changed files with 4628 additions and 3 deletions
+29
View File
@@ -0,0 +1,29 @@
"""Ingestion imports do not initialize providers or chat."""
import os
import subprocess
import sys
def test_ingestion_imports_do_not_initialize_chat_or_io():
script = """
import importlib, sys
class BlockImports:
def find_spec(self, fullname, *args):
if fullname.startswith(("app.services", "app.core.config", "openai",
"fastembed", "langchain", "chromadb")):
raise AssertionError("Forbidden import: " + fullname)
sys.meta_path.insert(0, BlockImports())
def audit(event, args):
if event in ("socket.connect", "os.walk", "os.scandir"):
raise AssertionError("Unexpected I/O: " + event)
sys.addaudithook(audit)
for name in ("app.modules.documents.settings", "app.modules.documents.types",
"app.modules.documents.ports", "app.infrastructure.database", "app.bootstrap"):
importlib.import_module(name)
assert "app.core.config" not in sys.modules
"""
environment = {k: v for k, v in os.environ.items()
if not k.startswith(("INGEST_", "API_KEY", "LLM_"))}
result = subprocess.run([sys.executable, "-c", script], env=environment,
capture_output=True, text=True)
assert result.returncode == 0, result.stderr