Skip to content

API Reference parrot.knowledge.ontology.concept_catalog.reconcile

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.knowledge.ontology.concept_catalog.reconcile

View source

Concept Catalog Reconciliation Job (FEAT-159 TASK-1091).

Detects drift between Postgres (source of truth) and ArangoDB (materialized view). The reconciler is read-only: it reports discrepancies but does not auto-repair them.

Drift categories

  • missing_in_arango — approved PG row has no matching ArangoDB document.
  • orphans_in_arango — ArangoDB document has no corresponding approved PG row (or the PG row is deprecated/rejected).

In-flight rows (updated_at > now() - outbox_drain_interval × 10) are excluded from forward-scan results to prevent false positives during outbox processing.

Alias ArangoOntologyGraphStore

Re-exported from parrot.knowledge.ontology.graph_store.ArangoOntologyGraphStore.

Class ConceptCatalogReconciler

Detect drift between Postgres and ArangoDB for a tenant's concept catalog.

The reconciler performs two scans per collection:

  1. Forward scan — for each approved PG row, verify an ArangoDB document with matching pg_concept_id / pg_isa_edge_id exists.
  2. Reverse scan — for each ArangoDB document, verify a corresponding approved PG row exists.

Only discrepancies are logged (at WARNING level). No writes are made.

Parameter Type Default Description
pg_pool Any asyncpg connection pool.
graph_store ArangoOntologyGraphStore ArangoOntologyGraphStore instance.
outbox_drain_interval int _DEFAULT_DRAIN_INTERVAL_SECONDS Seconds to wait before flagging an in-flight row. Rows updated within outbox_drain_interval × 10 seconds are excluded from forward-scan results.

Method ConceptCatalogReconciler.reconcile

Run a full reconciliation for tenant_id.

reconcile(tenant_id: str) -> ReconciliationReport

Parameter Type Default Description
tenant_id str Tenant to reconcile.

Returns: ReconciliationReport — ReconciliationReport with discrepancy counts and details.

Class ReconciliationReport

Summary of one reconciliation run for a tenant.

Parameter Type Default Description
tenant_id str
missing_in_arango int 0
orphans_in_arango int 0
missing_isa_in_arango int 0
orphan_edges_in_arango int 0
discrepancies list[str] list()

Fields:

Field Type Default Description
tenant_id str Tenant that was reconciled.
missing_in_arango int 0 Count of approved PG concepts absent from ArangoDB.
orphans_in_arango int 0 Count of ArangoDB docs with no matching approved PG row.
missing_isa_in_arango int 0 Count of approved PG edges absent from ArangoDB.
orphan_edges_in_arango int 0 Count of ArangoDB edges with no matching PG row.
discrepancies list[str] field(default_factory=list) Human-readable detail strings for each discrepancy.

Attributes:

Attribute Type Description
has_discrepancies bool Return True if any drift was detected.

Alias TenantContext

Re-exported from parrot.knowledge.ontology.schema.TenantContext.

Attribute logger

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally