dual-storage-backends-are-interchangeable

IN derived (depth 4)

Both SQLite and PostgreSQL backends can be used interchangeably for any operation, with identical safety guarantees through backend-appropriate mechanisms and complete API surface coverage, so applications can switch backends without behavioral changes.

Summary

The system guarantees that switching between SQLite and PostgreSQL requires no application-level changes. Both backends expose the same API and enforce the same safety properties — atomic operations, isolated mutations, safe hypothetical reasoning — just implemented through different mechanisms under the hood. This means deployment decisions about which database to use are purely operational, not architectural.

Justifications

SL — Backend safety equivalence (depth-4) and backend-independent atomicity (depth-2) establish interchangeability, but only when PgApi achieves full API coverage — partial coverage means some operations work on SQLite but not PostgreSQL

Antecedents (all must be IN):

  • storage-layer-is-backend-agnostic-and-safe — Both storage backends provide equivalent safety guarantees through backend-appropriate mechanisms: atomic isolated mutations (context-managed load/save for SQLite, per-method transactions for PgApi) and safe hypothetical reasoning (write-flag gating for SQLite, transaction rollback for PgApi), making safety properties independent of backend choice.
  • atomicity-is-backend-independent — Both storage backends enforce atomic isolated operations through backend-appropriate mechanisms: the SQLite backend uses context-managed load/save with write-flag gating and per-function transaction scope, while PostgreSQL uses per-method transactions with composite-key multi-tenancy — achieving the same transactional guarantee at different architectural levels

Unless (any of these IN defeats this justification):

  • pgapi-partial-api-coverage — PgApi implements core operations (add/retract/assert/search/nogood/explain) but defers simulation, dialectics, namespace support, import/export, and maintenance operations to future work

Details