Repository navigation
Matching: signature store interface, optional Postgres store, owner decisions - #537
Merged
Merged
Conversation
…ecisions - SignatureStore interface in matching/store.py, SqliteSignatureStore (default, own database file, separate from the web UI state store). SignatureStore(path) still creates a SQLite store (backwards compatible). - PostgresSignatureStore (psycopg 3, optional `postgres` extra, imported lazily), persistence only, similarity search stays in numpy. - open_signature_store(url): sqlite:///..., plain paths, postgresql://... - Schema version handling: a store with another schema version is rebuilt. - Contract tests for SQLite and Postgres (integration marker, PY_IMAGE_DEDUP_TEST_POSTGRES_DSN), Postgres service in the CI integration job. - docs/matching-prototype.md: owner decisions replace the open questions, store backends documented; TODO.md and AGENTS.md updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SignatureStoreinterface (py_image_dedup/matching/store.py) with what the pipeline needs: upsert/get by path,get_all()/iter_all()for the numpy search,get_file_states()+needs_analysis(),remove()/remove_missing(),set_full_pixel_hash(),schema_version.SqliteSignatureStore: the default, lives in its own database file (separate from the web UI state store), so it can be deleted and rebuilt.SignatureStore(path)still creates a SQLite store, so existing call sites (pipeline, benchmark, tests) are unchanged.PostgresSignatureStore(matching/store_postgres.py): psycopg 3, optionalpostgresextra ([project.optional-dependencies]), imported lazily. Persistence only, the similarity search stays in Python/numpy. Tablesmatching_files/matching_meta, advisory lock around schema creation, server side cursor for streaming.open_signature_store(url):sqlite:///relative.db,sqlite:////abs.db, plain paths,sqlite://(memory),postgresql://.... Ready to be wired intoconfig.pylater.SCHEMA_VERSIONis dropped and rebuilt (it is a cache).tests/test_matching_store.pyruns the same contract tests for SQLite (memory + file) and Postgres (integrationmarker, skipped withoutPY_IMAGE_DEDUP_TEST_POSTGRES_DSN). The CI integration job gets a Postgres service and installs the extra.docs/matching-prototype.md, the store backends are documented, andTODO.mdandAGENTS.mdare updated (follow-ups: rotation/mirror matching, variants to review, crop embeddings, side-by-sidematching.backend, HEIC/RAW extras, config wiring).Test plan
poetry run pytest: 172 passedpytest -m integration tests/test_matching_store.pyagainst a localpostgres:17-alpine: 10 passeddocker build . -t py-image-dedup:test(the extra is not installed in the image)🤖 Generated with Claude Code