feat(files): add source-file upload with MinIO storage and Postgres repositories
Why: - Implements plan 001 Phase 3's upload orchestration. Changes: - ObjectStorage port and MinIO adapter, thread-offloaded per ADR-0017. - Tenant-scoped repositories for api_keys, source_files, ingestion_jobs. - upload_source_file implementing the two-transaction shape with (tenant_id, domain, content_sha256) idempotency. Impact: - This phase stores bytes only -- chunks_indexed is always 0 until Phase 4/5 add parsing/embedding.
This commit is contained in:
17
src/application/files/errors.py
Normal file
17
src/application/files/errors.py
Normal file
@@ -0,0 +1,17 @@
|
||||
"""Upload-validation failures (ADR-0008). No HTTP knowledge here —
|
||||
`src/api/errors.py` maps these to status codes.
|
||||
"""
|
||||
|
||||
|
||||
class FilesError(Exception):
|
||||
"""Base class for file-upload failures."""
|
||||
|
||||
|
||||
class InvalidUploadError(FilesError):
|
||||
"""Missing domain, empty file, or content that doesn't match its
|
||||
declared extension. Maps to `400`.
|
||||
"""
|
||||
|
||||
|
||||
class FileTooLargeError(FilesError):
|
||||
"""The upload exceeds `INGESTION_MAX_UPLOAD_SIZE_MB`. Maps to `413`."""
|
||||
Reference in New Issue
Block a user