docling-studio/document-parser/domain
Pier-Jean Malandrino d81f36d899 feat(#203): per (document, store) ingestion state
Introduces the data layer for multi-store ingestion. Documents can now
live in multiple stores, each with its own Ingested/Stale/Failed state.
The doc-level lifecycle (#202) becomes the aggregate over all per-store
links, computed by a pure domain function.

Domain
- Store entity (name, slug, kind, embedder, config, is_default)
- DocumentStoreLink entity with mark_ingested / mark_stale / mark_failed
  helpers
- StoreKind and DocumentStoreLinkState enums
- aggregate_lifecycle(): pure function — Failed > Stale > Ingested
  > fallback (the doc's pre-link Uploaded/Parsed/Chunked state)

Persistence
- New tables 'stores' and 'document_store_links' with the right indexes
  (doc_id, store_id, state) and a UNIQUE (doc, store) on the link
- Default 'opensearch' store seeded idempotently in init_db, embedder
  pulled from DEFAULT_EMBEDDER (fallback bge-m3)
- SqliteStoreRepository (find_by_slug, find_by_id, get_default, …)
- SqliteDocumentStoreLinkRepository with ON CONFLICT … DO UPDATE upsert

Ports
- StoreRepository and DocumentStoreLinkRepository protocols added

Tests
- 14 new tests: seed idempotency, insert/find round-trips, UNIQUE
  constraint, cascade delete with the document, every link state
  round-trips, aggregation rule with all branches

Refs #203
2026-05-05 09:38:39 +02:00
..
__init__.py Radical architecture change, migration to a more lightweight 2026-03-17 16:06:27 +01:00
events.py feat(#202): introduce Document lifecycle state machine 2026-05-05 09:38:39 +02:00
exceptions.py feat(#202): introduce Document lifecycle state machine 2026-05-05 09:38:39 +02:00
lifecycle.py feat(#202): introduce Document lifecycle state machine 2026-05-05 09:38:39 +02:00
lifecycle_aggregation.py feat(#203): per (document, store) ingestion state 2026-05-05 09:38:39 +02:00
models.py feat(#203): per (document, store) ingestion state 2026-05-05 09:38:39 +02:00
ports.py feat(#203): per (document, store) ingestion state 2026-05-05 09:38:39 +02:00
services.py fix(arch): inject repositories and extract domain logic 2026-04-10 11:44:33 +02:00
value_objects.py feat(#203): per (document, store) ingestion state 2026-05-05 09:38:39 +02:00
vector_schema.py feat(domain): add VectorStore port and SearchResult value object 2026-04-10 20:40:17 +02:00