pgapi-bfs-propagation-in-python
IN premise
PgApi implements BFS propagation in application-level Python (not stored procedures), using JSONB containment queries (`@>`) against GIN indexes to find dependents
Summary
The system's truth propagation logic runs as breadth-first search in Python application code rather than inside the database. It finds dependent beliefs by querying JSONB support lists with PostgreSQL's containment operator, which hits GIN indexes for fast lookup. This means propagation performance depends on round-trips between the app and database rather than being handled entirely within PostgreSQL, and the efficiency of dependent lookups hinges on those GIN indexes being properly maintained.
Dependents
These beliefs depend on this one:
- pg-multi-tenancy-is-referentially-complete — PgApi's multi-tenant isolation with composite primary keys and application-level BFS propagation prevents all cross-project data leakage and ensures consistent truth maintenance — unless antecedent references stored as JSONB arrays lack foreign key constraints, allowing phantom node references within a project.
- pgapi-achieves-implementation-parity — PgApi achieves full behavioral parity with the in-memory Network implementation: it reimplements the core algorithms (entrenchment scoring, nogood resolution, BFS propagation, dialectics) in SQL with BFS propagation executed in application-level Python.
Details
| Source | entries/2026/04/28/reasons_lib-pg.md |