feat(api): image embedding and projection cache tables + records service - #34
Open
lstein wants to merge 1 commit into
Open
feat(api): image embedding and projection cache tables + records service#34lstein wants to merge 1 commit into
lstein wants to merge 1 commit into
Conversation
lstein
requested review from
JPPhoto,
Pfannkuchensack and
blessedcoolant
as code owners
August 2, 2026 20:19
lstein
marked this pull request as draft
August 2, 2026 22:23
lstein
marked this pull request as ready for review
August 3, 2026 18:28
Adds the storage layer for the semantic image map feature: - Migration 34 creates `image_embeddings` (one row per image + embedding model content hash, float32 L2-normalized BLOB) and `image_projections` (per-user cached 2D UMAP coordinates with a scope hash fingerprinting the accessible image set). - New `image_index` records service (base/common/sqlite) with embedding CRUD, backfill listing, index status counts, per-user accessible-image scoping (own images + shared/public boards, admin sees all), and projection cache get/set. - Wired into InvocationServices and ApiDependencies; dormant until the indexer service lands in a follow-up. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Review fix: the access scope now matches the gallery 'all' listing semantics (board-owner arm and archived-board exclusion), with regression tests.
lstein
force-pushed
the
feat/image-map-01-schema
branch
from
August 4, 2026 05:37
b3f4618 to
712ed53
Compare
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
First PR in the Image Map stack (semantic UMAP gallery panel + semantic search; 11 PRs planned). This one adds the dormant storage layer:
image_embeddings— one row per(image_name, model_id)wheremodel_idis the embedding model's content hash (stable across reinstalls). Embeddings are float32, L2-normalized BLOBs.ON DELETE CASCADEagainstimages.image_projections— one cached 2D UMAP projection per(user_id, model_id), with ascope_hashfingerprinting the accessible image set so staleness is detected by re-derivation, not bookkeeping.ON DELETE CASCADEagainstusers.image_indexrecords service (base/common/sqlite): embedding CRUD, backfill listing, index status counts, projection cache get/set, and per-user access scoping (own images + shared/public boards + boards individually shared viashared_boards; admin sees all) mirroring the board-listing access model.InvocationServices/ApiDependencies; dormant — nothing writes to it until the indexer worker lands in the next PR of the stack.gallery_maintenance.pynow enablesPRAGMA foreign_keyson its connection so its image deletions honor the cascades (previously it orphanedboard_imagesrows too).An adversarial review of this diff was run; confirmed findings (per-user
shared_boardsscoping, rawIntegrityErrorleaking on image/user delete races, FK-off maintenance script, duplicate-input double-counting, read-only coords arrays) are fixed and covered by tests.Testing
tests/app/services/image_index/test_image_index_records.py: blob round-trips, upsert/get/delete, FK cascade on image delete, chunked (501-name) fetches, eligibility filtering, the full access matrix (own/private/shared/public/individually-shared/admin), delete-race no-ops, projection cache round-trips.tests/test_sqlite_migrator.py+ both multiuser router suites pass (177 tests).🤖 Generated with Claude Code