Skip to main content

Module synthetic_store

Module synthetic_store 

Source
Expand description

The synthetic store every test database opens over: its synced schema, its migration ladder, and the Database constructors that combine the two.

Domain-free on purpose — three tables exercising the engine’s generic mechanics rather than any host’s real shape.

Functions§

create_synced_schema
Create the synthetic test schema on a connection. Run as the host migration step for open_test_db (see test_migrations).
open_test_db
Open a Database over a fresh in-memory connection with the synthetic test schema and the test_synced_tables synced set.
open_test_db_schema
Like open_test_db but with an explicit synced set and migration ladder, for tests that exercise a different schema (gate tests).
open_test_db_with_blob
Open a test Database over the synthetic schema with note_photos declared blob-bearing per decl.
open_test_db_with_hlc
Open a test Database over the synthetic schema with a caller-supplied register clock (so a test can control the wall clock), plus an extra seed step run after the host schema is created to plant host rows before Database::open reads its floor.
open_test_db_with_tombstone_grace
open_test_db_with_user_and_host_blobs
Open a test Database with both note_photos (per photo_decl) and note_covers (per cover_decl) declared blob-bearing — the schema for the per-provenance transition tests.
photo_decl
The host-provided, eagerly-cached photo blob declaration most blob tests use.
read_test_db
Open a read-test Database whose note_photos child carries a blob in namespace, so read_blob’s locality dispatch can resolve a blob in that namespace up to its gated notes root. The decl’s namespace MUST match the blobs the test reads (the read path resolves the carrying table from the blob’s namespace); its provenance/fill don’t matter to that resolution (the read reads the row → root → gate, and takes provenance off the BlobRef), so this fixes them. Pair with Database::plant_blob_row_for_test.
read_test_db_with_download_limit
Like read_test_db but with a chosen max_concurrent_downloads, so a pin test can drive the download loop concurrently. Uploads run one at a time (not exercised here).
remote_root_db
The notes schema with a remote-root parent, carrying decl on note_photos.
store_database
The Store view of a test database. Every sync test builds one; naming it here keeps the three test modules that used to declare it from drifting apart.
store_dir_for_test_database
test_migrations
The synthetic test schema as a single-migration ladder, so a test db opens at schema_version() == 1. The host-schema ladder for every open_test_db* helper.
test_store_dir
Construct an isolated Store directory for a test composition root.
test_synced_tables
The synthetic, domain-free schema the sync tests run against. Three synced tables exercising the engine’s generic mechanics: a gated root (notes, gated by its shared boolean), a child with a foreign key (note_tags, which inherits the gate and exercises FK-violation retry), and a child that CAN carry a blob (note_photos, also FK-to-notes, so it inherits the gate). note_photos carries no blob here; blob tests declare one with test_synced_tables_with_blob.
test_synced_tables_remote_root_with_blob
test_synced_tables_with_blob with an ungated notes root: the rows are remote from the start rather than waiting on a gate, which is what a snapshot test needs to have something to publish before any gate is opened.
test_synced_tables_with_blob
test_synced_tables with note_photos declared blob-bearing per decl, for tests exercising the blob push/pull/backfill paths. The blob id defaults to the note_photos primary key; note_photos.cloud_path holds a readable key for plain-scheme tests, and note_photos.blob_id is there for a decl that names a blob id apart from the PK — the shape a row repointed at a new blob needs, since the row keeps its primary key.
test_synced_tables_with_user_and_host_blobs
test_synced_tables with TWO blob-bearing children of the gated notes root: note_photos per photo_decl (a release file, user-provided) and note_covers per cover_decl (a host-provided asset). Both inherit the notes gate, so a make_remote of a note carries both — the user-provided file through the durable outbox and the host-provided cover through the inline push — exercising the per-provenance split in one subtree.