Skip to content

feat(store): browse photo assets with QueryV1 photo predicates - #777

Merged
wesm merged 10 commits into
mainfrom
pr/465-5-photo-browse
Oct 5, 2026
Merged

wesm merged 10 commits into
mainfrom
pr/465-5-photo-browse

Conversation

@rodboev

@rodboev rodboev commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Clients can find photo assets by camera, lens, ISO, capture date, GPS, kind or asset ID. RAW/JPEG pairs appear once, with a total and exact preview links. Unreadable capture times sort last. Documents directs photo-only sorts to Photos.

Photo metadata filters use the selected display file, so a sidecar cannot make a Canon photo match NOT camera:Canon. Camera and lens labels ignore case. Capture-date filters follow the recorded local day; capture sorting uses UTC when an offset is known.

Stored, indexed capture keys let later pages seek from their cursor. The first page counts all matches, and later pages retain that total while reading live results. On a synthetic 100,000-photo library, ordinary 50-item continuation pages took about 2–6 ms across both SQLite drivers. For those queries, initial counts took about 1–3 seconds. Duplicate-collapsing queries still evaluate the full matching population; their continuation pages took about 1–1.7 seconds.

Browsers may cache previews but must revalidate before reuse. Matching previews return 304 without rereading the image; excluded assets and replaced displays return 404. Uses retained previews from #750.

Light Dark
Before Camera query rejected before this PR, light theme Camera query rejected before this PR, dark theme
After Camera query accepted by this PR, light theme Camera query accepted by this PR, dark theme

The query editor previously rejected camera predicates as unknown fields. These real-daemon captures use a temporary synthetic vault.

Refs #465, slice 5, photo predicates and the browse route.

@rodboev
rodboev added this pull request to stack #747 October 3, 2026 16:56
@roborev-ci

roborev-ci Bot commented Oct 3, 2026

Copy link
Copy Markdown

roborev: Combined Review (de54949)

Verdict: No findings at or above medium severity.


Reviewers: 2x codex, codex (security) | Synthesis: codex, 8s | Total: 37m48s

@roborev-ci

roborev-ci Bot commented Oct 3, 2026

Copy link
Copy Markdown

roborev: Combined Review (daa856f)

Verdict: No findings at or above medium severity.


Reviewers: 2x codex, codex (security) | Synthesis: codex, 8s | Total: 37m28s

@rodboev
rodboev marked this pull request as draft October 3, 2026 19:17
@roborev-ci

roborev-ci Bot commented Oct 3, 2026

Copy link
Copy Markdown

roborev: Combined Review (ad0ce33)

Verdict: Changes require fixes for 1 finding.

Medium

  • internal/store/photo_query.go:126: Photo browsing fails when a display file has no MIME type. CreateFile stores an empty MIME type as SQL NULL, but the photo query selects it unchanged and scans it into row.MediaType, a string, causing the entire browse page to fail.

    Fix: Select COALESCE(v.mime_type,'') AS mime_type and add browse regression coverage for eligible display files without MIME types, including a promoted RAW file.


Reviewers: 2x codex, codex (security) | Synthesis: codex, 9s | Total: 8m33s

@roborev-ci

roborev-ci Bot commented Oct 3, 2026

Copy link
Copy Markdown

roborev: Combined Review (500c46d)

Verdict: No findings at or above medium severity.


Reviewers: 2x codex, codex (security) | Synthesis: codex, 9s | Total: 9m0s

@rodboev
rodboev force-pushed the pr/465-5-photo-browse branch from 500c46d to 74914f2 Compare October 3, 2026 22:42
@roborev-ci

roborev-ci Bot commented Oct 3, 2026

Copy link
Copy Markdown

roborev: Combined Review (74914f2)

Verdict: No findings at or above medium severity.


Reviewers: 2x codex, codex (security) | Synthesis: codex | Total: 3m53s

@rodboev
rodboev force-pushed the pr/465-5-photo-browse branch from 74914f2 to 17a6ca9 Compare October 3, 2026 23:04
@roborev-ci

roborev-ci Bot commented Oct 3, 2026

Copy link
Copy Markdown

roborev: Combined Review (17a6ca9)

Verdict: Changes require fixes for 1 finding.

Medium

  • internal/api/routes_photo_query.go:150: Rename accepts filenames without a length limit. A 17,000-byte ASCII display filename with name sorting, page_size=1, and another asset afterward produces a cursor under 32 KiB, but continuing with that cursor fails because its key exceeds MaxWalkPathBytes (16 KiB), preventing pagination despite unchanged query options.

    Fix: Apply a consistent sort-key bound before returning pages, or support accepted keys throughout cursor encoding and validation. Add a regression test that continues using the emitted cursor.


Reviewers: 2x codex, codex (security) | Synthesis: codex, 7s | Total: 9m45s

@roborev-ci

roborev-ci Bot commented Oct 3, 2026

Copy link
Copy Markdown

roborev: Combined Review (8a2ba88)

Verdict: No findings at or above medium severity.


Reviewers: 2x codex, codex (security) | Synthesis: codex | Total: 9m17s

@rodboev
rodboev marked this pull request as ready for review October 3, 2026 23:49
Base automatically changed from pr/465-4-preview-recipes to main October 4, 2026 21:11
@wesm
wesm force-pushed the pr/465-5-photo-browse branch from 8a2ba88 to 02268dd Compare October 4, 2026 21:23
@roborev-ci

roborev-ci Bot commented Oct 4, 2026

Copy link
Copy Markdown

roborev: Combined Review (02268dd)

Verdict: No findings at or above medium severity.


Reviewers: 2x codex, codex (security) | Synthesis: codex | Total: 7m48s

Scrolling a photo library repeated its full count and capture-time work
for every page. Keep derived capture keys in the projection and seek from
indexed sort keys. Count once per browse; duplicate collapse still needs
the full matching population to choose representatives.

Use the display file for photo metadata so sidecars cannot defeat NOT
filters. Compare capture dates by the recorded local day and ignore case
in camera and lens labels. Let browsers revalidate cached previews after
checking current asset eligibility, without rereading unchanged images.

The failing Windows retry test assumed every request had measurable wall
clock latency. Use a controlled clock to assert exact request accounting
and cancellation during the retry wait.

Generated with Codex
Co-authored-by: Codex <noreply@openai.com>
@roborev-ci

This comment has been minimized.

A valid cache revalidation response was an error in the generated clients.
Expose unchanged previews separately from returned image bytes, including
caller-owned streams, while preserving real HTTP errors. Keep the API
schema and generated client contract aligned with the server response.

Saved photo queries chose duplicate representatives before excluding
ineligible assets. An excluded older copy could therefore hide an included
photo. Apply the same eligibility boundary as direct photo queries before
choosing representatives, while retaining document-query semantics.

Implements both user-approved findings from
#777 (comment)

Generated with Codex
Co-authored-by: Codex <noreply@openai.com>
@roborev-ci

roborev-ci Bot commented Oct 5, 2026

Copy link
Copy Markdown

roborev: Combined Review (d5c917a)

Verdict: No findings at or above medium severity.


Reviewers: 2x codex, codex (security) | Synthesis: codex | Total: 7m20s

@wesm
wesm merged commit 0f05e92 into main Oct 5, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants