Skip to content

refactor: snapshot storage now supports multiple databases per project#5

Merged
radim merged 22 commits intomasterfrom
snapshot-store-refactor
May 1, 2026
Merged

refactor: snapshot storage now supports multiple databases per project#5
radim merged 22 commits intomasterfrom
snapshot-store-refactor

Conversation

@radim
Copy link
Copy Markdown
Member

@radim radim commented May 1, 2026

The original PoC for DryRun counted with one database, but in reality a single project uses more than one database. The change continues in the migration from a single URL-hashed history table to a SnapshotStore abstraction keyed by (project_id, database_id).

Add the storage part for #4

radim and others added 12 commits May 1, 2026 12:18
14 new tests in trait_tests module:
- put inserts/dedupes; isolation across (project_id, database_id)
- list ordering and TimeRange filtering (from inclusive, to exclusive)
- latest returns None or most recent summary
- get(Latest/At/Hash) including key-scoped hash lookup and error on miss
- delete_before returns affected count and is key-scoped
- legacy save_snapshot and trait put coexist without cross-contamination
- synthetic_db_url_hash deterministic and disjoint from real URL hashes

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@radim radim force-pushed the snapshot-store-refactor branch from 6967302 to c5e5523 Compare May 1, 2026 10:19
radim and others added 10 commits May 1, 2026 16:41
Produces ZST compress file
Adds 5 tests covering bits that were untested:

- list_keys_returns_distinct_streams_ordered: empty store -> []; three
  streams with mixed counts -> three distinct keys ordered by
  (project, database).
- complete_key_uses_resolved_database_id_when_set: profile's
  database_id wins over the snapshot.database fallback.
- complete_key_falls_back_to_snapshot_database: <cli> mode (no
  profile database_id) uses the introspected DB name.
- write_snapshot_export_roundtrips: write -> decompress -> parse;
  asserts the layout and that content_hash + database survive.
- write_snapshot_export_isolates_streams: two keys produce two
  subdirectories, one file each.

Extracts the inline export per-snapshot write into
write_snapshot_export(out_root, key, snap) so it's unit-testable.
Adds tempfile = "3" to dry_run_cli dev-deps.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@radim radim added the enhancement New feature or request label May 1, 2026
@radim radim merged commit 7f99fbb into master May 1, 2026
5 checks passed
@radim radim deleted the snapshot-store-refactor branch May 1, 2026 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant