Skip to content

SchemaStore

The port that keeps an installation's document types: a key, a label, fields and the parser whose signature recognizes it.

Port: SchemaStore, declared in indx_interfaces.protocols over the models in indx_interfaces.schema (ADR-0075).

A DocumentType is a key (invoice), a label, its FieldSpecs (a name and a FieldKind: text, date, amount, id, company or category), and optionally signature, the parser whose format signature recognizes it. The store keeps a workspace’s types by key.

class SchemaStore(Protocol):
def put(self, owner: OwnerId, document_type: DocumentType) -> None: ...
def get(self, owner: OwnerId, type_id: TypeId) -> DocumentType | None: ...
def list(self, owner: OwnerId) -> tuple[DocumentType, ...]: ...
def delete(self, owner: OwnerId, type_id: TypeId) -> bool: ...

A third store port beside DocumentStore and VectorIndex, rather than a key-value store for everything a workspace holds, because the ports split by aggregate: types now, labels and routers later. A type never expires, so there is no purge. Three backends ship: memory (indx-store-memory), sqlite (indx-store-sqlite) and postgres (indx-store-postgres), named by INDX_SCHEMA_STORE.

  • Owner. Every method takes an OwnerId first, and nothing crosses owners. The server passes one workspace per installation until authentication names who is asking.
  • Identity. Within an owner, a type is its key.
  • Replacement. put replaces the type with the same key. The server keeps created_at across a replacement.
  • Idempotence. delete of a key that is not there is False.
  • Order. list returns the owner’s types by key.
  • Validation. Keys and field names match ^[a-z][a-z0-9_]{1,39}$, and a field name appears once per type. The server, not the store, checks that signature names an installed parser.

tests/unit/test_store_conformance.py holds every installed backend to these rules.