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
+30
View File
@@ -0,0 +1,30 @@
"""Ports only; concrete intake, embedding and publication arrive in later phases."""
from typing import Mapping, Protocol, Sequence
from uuid import UUID
from .types import EmbeddingProfile
class FileStore(Protocol):
def put(self, content: bytes) -> str:
"""Create a new immutable original under a generated key; never overwrite."""
...
def read(self, storage_key: str) -> bytes: ...
class EmbeddingProvider(Protocol):
@property
def profile(self) -> EmbeddingProfile: ...
def embed(self, texts: Sequence[str]) -> Sequence[Sequence[float]]: ...
class DocumentRepository(Protocol):
def get_document(
self, organization_id: UUID, document_id: UUID
) -> Mapping[str, object] | None: ...
def get_enabled_administrator(self, user_id: UUID) -> Mapping[str, object] | None:
"""Resolve scope from a trusted operator's persisted administrator identity."""
...