Skip to content

docs: document Smart Memories and sync the backend directory tables - #1433

Open
rohan-pandeyy wants to merge 4 commits into
AOSSIE-Org:mainfrom
rohan-pandeyy:docs/smart-memories
Open

docs: document Smart Memories and sync the backend directory tables#1433
rohan-pandeyy wants to merge 4 commits into
AOSSIE-Org:mainfrom
rohan-pandeyy:docs/smart-memories

Conversation

@rohan-pandeyy

@rohan-pandeyy rohan-pandeyy commented Jul 29, 2026

Copy link
Copy Markdown
Member

Follow-up to #1429.

Documents the Smart Memories feature shipped in #1430, and brings the backend
directory tables back in line with the tree.

The docs still described the implementation that #1430 deleted — DBSCAN
location clustering, reverse geocoding, "Trip to [City], [Year]" titles, the
/api/memories/* endpoints and four components that no longer exist.

New

  • docs/backend/backend_python/memories.md — the backend reference:
    the four tables and their vocabularies, the three curation triggers and
    their rules, the seven scoring signals, the API, the pipeline hooks and the
    preference block. Added to the nav.

Rewritten

  • docs/frontend/memories.md — replaced wholesale. Now covers the grid
    page, the story viewer (segmented progress, autoplay, keyboard and swipe
    navigation, video clips, the per-slide sound toggle), the settings page and
    the React Query data layer.

Updated

File Change
database.md The four memories tables: columns, keys, cascades, indexes and creation order
directory-structure.md Memories modules; the semantic label tables are no longer dormant; plus the pre-existing gaps below
image-processing.md Capture dates from EXIF sub-IFDs, Takeout sidecars and video container boxes, and the date_source field
semantic-search.md Corrected the pipeline ordering; recorded memory curation as a consumer of embeddings and event labels
features.md, architecture.md, state-management.md, ui-components.md Brought in line

Directory tables

The backend tables had drifted well beyond memories. Added the 22 modules that
were never listed — videos and video_frames across database/routes/schemas/
utils, the connection context manager, the model and session registries, the
semantic-vocabulary utils and scripts, and the hardware, model-bootstrap,
face-search and face-quality helpers. Dropped microservice.py, which no
longer exists. Every table was diffed against the filesystem afterwards: zero
missing, zero stale.

Notes for reviewers

Three things are deliberately not documented as working, because they
aren't yet:

  • Story background music — frontend/public/memory-theme.mp3 is not bundled,
    so the toggle is silent.
  • Desktop notifications — the preference is persisted but nothing delivers
    them (Phase 3).
  • GET /memories/today and useTodayMemory are implemented but have no
    consumer, so nothing currently surfaces "the memory to show now".

Two diagrams need a maintainer, and both carry a temporary note on their page
saying so:

  • docs/assets/backend-architecture.jpeg — needs a Memories curation box
    downstream of indexing and semantic scoring (it shares the single-worker
    executor), trigger arrows from the folder add / sync / AI-tagging pipelines,
    and a write into SQLite naming the four tables.
  • The dbdiagram.io ER schema — the four memories tables are absent. Full
    column lists and all five foreign-key relationships are in the new
    "Memories tables" section of database.md, which is written to be usable as
    the source for it.

Delete the corresponding note once each diagram is regenerated.

Verification

  • mkdocs build — no warnings, every internal link resolves
  • markdownlint-cli2 with .github/.markdownlint-cli2.jsonc — 0 errors
    across docs/
  • Admonition bodies are indented so MkDocs renders them inside the box; two
    pre-existing ones in semantic-search.md were rendering as empty boxes and
    are fixed
  • No source changes, so no test impact

Summary by CodeRabbit

  • Documentation
    • Expanded Smart Memories docs with an end-to-end guide covering curation triggers, scoring, storage, API behavior, and settings.
    • Added detailed database schema coverage, including memories tables, constraints, indexing, and trusted date/source rules.
    • Broadened semantic search and image-processing documentation to clarify request flow, vocabularies, capture-date/location handling, and parameter/reference details.
    • Updated backend directory-structure, architecture, and overview feature pages; rewrote frontend Memories/state-management/UI guidance.
    • Added the Smart Memories documentation page to the site navigation.

- New `backend/backend_python/memories.md`: schema, curation triggers,
  scoring signals, API, pipeline hooks and preferences. Added to the nav.
- Rewrote `frontend/memories.md`, which described the removed implementation
  (DBSCAN location clustering, reverse geocoding, `/api/memories/*`).
- `database.md`: the four memories tables, their keys, cascades and indexes.
- `directory-structure.md`: the new modules, the rewritten memories router,
  and the semantic label tables, which are no longer dormant.
- `image-processing.md`: capture-date extraction from EXIF sub-IFDs, Takeout
  sidecars and video container boxes, and the `date_source` field.
- `semantic-search.md`: corrected the pipeline ordering and recorded memory
  curation as a consumer of embeddings and event labels.
- `features.md`, `architecture.md`, `state-management.md`, `ui-components.md`
  updated to match.

Admonition bodies are indented so MkDocs renders them inside the box.
Adds the modules that were never listed: videos and video_frames across
database/routes/schemas/utils, the connection context manager, the model and
session registries, the semantic vocabulary utils and scripts, and the
hardware, model-bootstrap, face-search and face-quality helpers.

Drops `microservice.py`, which no longer exists.
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ No issue was linked in the PR description.
Please make sure to link an issue (e.g., 'Fixes #issue_number')

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@rohan-pandeyy, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 36 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: bb6d431b-a4dd-429a-847b-3c2440a86b6a

📥 Commits

Reviewing files that changed from the base of the PR and between 2eda401 and 9dc353f.

📒 Files selected for processing (1)
  • docs/backend/backend_python/database.md

Walkthrough

This documentation-only change adds Smart Memories backend and frontend references, updates semantic-search and image-processing documentation, refreshes backend directory descriptions, revises architecture and feature overviews, and adds the backend Memories page to MkDocs navigation.

Changes

Smart Memories backend

Layer / File(s) Summary
Backend memory contracts and curation
docs/backend/backend_python/database.md, docs/backend/backend_python/image-processing.md, docs/backend/backend_python/memories.md
Documents the Memories schema, capture-date handling, curation pipeline, scoring, APIs, preferences, and test coverage.
Backend structure and semantic processing
docs/backend/backend_python/directory-structure.md, docs/backend/backend_python/semantic-search.md
Refreshes backend module listings and documents semantic-search flow, vocabulary consumers, settings, API behavior, session lifecycle, and tests.

Frontend Memories

Layer / File(s) Summary
Frontend memory experience
docs/frontend/memories.md, docs/frontend/state-management.md, docs/frontend/ui-components.md
Documents Memories routes, grid and story-viewer behavior, refresh polling, React Query data flow, Redux state, UI components, helpers, and tests.

Overview and navigation

Layer / File(s) Summary
Product overview and documentation navigation
docs/overview/architecture.md, docs/overview/features.md, mkdocs.yml
Updates architecture and feature descriptions and adds the backend Memories page to navigation.

Estimated code review effort: 2 (Simple) | ~15 minutes

Suggested labels: Documentation

Poem

A rabbit hops through docs so bright,
Mapping memories day and night.
Tables bloom and stories play,
React hops along the way.
Fresh pages make the burrow shine!

🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning This PR only updates documentation; it does not implement the Smart Memories behavior, endpoints, or curation pipeline required by #1429. Add the feature code for persisted curation, viewer/API behavior, ranking, capture-date extraction, and pipeline hooks, or relabel the PR as docs-only.
✅ Passed checks (3 passed)
Check name Status Explanation
Out of Scope Changes check ✅ Passed The changed docs all support Smart Memories or backend tree synchronization, with no clear unrelated additions.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the two main changes: Smart Memories documentation and backend directory table synchronization.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ No issue was linked in the PR description.
Please make sure to link an issue (e.g., 'Fixes #issue_number')

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/backend/backend_python/database.md`:
- Around line 168-171: Update the documentation paragraph describing
images.captured_at and videos.captured_at to scope the non-null requirement
specifically to candidate-media queries over those tables. Remove the claim that
every memories query filters captured_at IS NOT NULL, and clarify that
generated-memory reads use fields such as surface_date and status while
date_created continues to drive gallery display.

In `@docs/backend/backend_python/directory-structure.md`:
- Line 77: Update the folders.py description in the directory structure table to
remove the claim that SigLIP2 embedding is triggered last; describe it as
occurring after YOLO/face processing and before semantic scoring, memory
curation, and video processing, consistent with the semantic-search
documentation and project requirements.

In `@docs/backend/backend_python/semantic-search.md`:
- Around line 357-361: Update the Smart Memories description to state that only
stored image-embedding reads filter by model_version; describe event-label reads
as selecting from the active vocabulary and scored image_classes rows. Verify
the revised documentation against the project requirements and objectives.
- Line 627: Update the documentation entry for
image_util_process_unembedded_images to say the vision session is always closed
even if embedding inference raises, replacing the inaccurate reference to
scoring; verify the wording against the project’s documentation requirements and
objectives.

In `@docs/frontend/memories.md`:
- Around line 226-229: Update the Testing section in the memories documentation
to include the existing Redux slice suite,
frontend/src/features/__tests__/memoriesSlice.test.ts, alongside the listed
MemoryStoryViewer and useRefreshMemories tests.

In `@docs/frontend/ui-components.md`:
- Around line 115-122: Update the MemorySettings documentation to distinguish
persistence events by control type: describe the ToggleRow switches as writing
on their switch-change event, while retaining onValueCommit for slider changes.
Keep the existing descriptions of controls, clamping, and save-state disabling
unchanged.

In `@docs/overview/architecture.md`:
- Around line 34-37: Update the new architecture paragraph to use the canonical
“SQLite” capitalization instead of “sqlite” when referring to the database,
leaving the surrounding wording unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: eb770f0e-2649-4cfe-8fec-fba7ed2d0b93

📥 Commits

Reviewing files that changed from the base of the PR and between d9fb073 and b9d2586.

📒 Files selected for processing (11)
  • docs/backend/backend_python/database.md
  • docs/backend/backend_python/directory-structure.md
  • docs/backend/backend_python/image-processing.md
  • docs/backend/backend_python/memories.md
  • docs/backend/backend_python/semantic-search.md
  • docs/frontend/memories.md
  • docs/frontend/state-management.md
  • docs/frontend/ui-components.md
  • docs/overview/architecture.md
  • docs/overview/features.md
  • mkdocs.yml

Comment thread docs/backend/backend_python/database.md Outdated
Comment thread docs/backend/backend_python/directory-structure.md Outdated
Comment thread docs/backend/backend_python/semantic-search.md Outdated
Comment thread docs/backend/backend_python/semantic-search.md Outdated
Comment thread docs/frontend/memories.md
Comment on lines 226 to +229
## Testing

### Backend Tests

Located in `backend/tests/`:

- 100 unit tests covering all routes
- Run with: `pytest tests/`

### Frontend Tests

Located in `frontend/src/pages/__tests__/`:

- Page rendering tests
- Run with: `npm test`

### Manual Testing

Use `backend/test_memories_api.py` for API endpoint testing:

```bash
python test_memories_api.py
```

## Performance Considerations

1. **Lazy Loading**: Images load on-demand with `loading="lazy"`
2. **Thumbnail Optimization**: Uses Tauri's `convertFileSrc()` for efficient file access
3. **Redux Memoization**: Uses `React.memo()` for card components
4. **Efficient Queries**: SQLite indexes on `latitude`, `longitude`, `captured_at`
5. **Background Processing**: Memory generation runs asynchronously
- `components/Memories/__tests__/MemoryStoryViewer.test.tsx`
- `hooks/__tests__/useRefreshMemories.test.tsx`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Include the Redux slice test in the testing index.

The supplied context includes frontend/src/features/__tests__/memoriesSlice.test.ts, which covers critical viewer-state behavior, but this testing section lists only the viewer and refresh-hook suites. Add the slice test so the documentation accurately reflects existing coverage.

As per path instructions, test code must be automated, comprehensive, and cover critical functionality.

Suggested documentation update
 - `components/Memories/__tests__/MemoryStoryViewer.test.tsx`
 - `hooks/__tests__/useRefreshMemories.test.tsx`
+- `features/__tests__/memoriesSlice.test.ts`
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
## Testing
### Backend Tests
Located in `backend/tests/`:
- 100 unit tests covering all routes
- Run with: `pytest tests/`
### Frontend Tests
Located in `frontend/src/pages/__tests__/`:
- Page rendering tests
- Run with: `npm test`
### Manual Testing
Use `backend/test_memories_api.py` for API endpoint testing:
```bash
python test_memories_api.py
```
## Performance Considerations
1. **Lazy Loading**: Images load on-demand with `loading="lazy"`
2. **Thumbnail Optimization**: Uses Tauri's `convertFileSrc()` for efficient file access
3. **Redux Memoization**: Uses `React.memo()` for card components
4. **Efficient Queries**: SQLite indexes on `latitude`, `longitude`, `captured_at`
5. **Background Processing**: Memory generation runs asynchronously
- `components/Memories/__tests__/MemoryStoryViewer.test.tsx`
- `hooks/__tests__/useRefreshMemories.test.tsx`
## Testing
- `components/Memories/__tests__/MemoryStoryViewer.test.tsx`
- `hooks/__tests__/useRefreshMemories.test.tsx`
- `features/__tests__/memoriesSlice.test.ts`
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/frontend/memories.md` around lines 226 - 229, Update the Testing section
in the memories documentation to include the existing Redux slice suite,
frontend/src/features/__tests__/memoriesSlice.test.ts, alongside the listed
MemoryStoryViewer and useRefreshMemories tests.

Source: Path instructions

Comment thread docs/frontend/ui-components.md Outdated
Comment thread docs/overview/architecture.md
@github-actions github-actions Bot added GSoC 2026 enhancement New feature or request labels Jul 29, 2026
@rohan-pandeyy rohan-pandeyy added documentation Improvements or additions to documentation and removed enhancement New feature or request labels Jul 29, 2026
- `captured_at IS NOT NULL` applies to the candidate queries over images and
  videos, not to every memories query; reads of generated memories go through
  the memories table on surface_date and status.
- folders.py no longer described as triggering the embedding pass "last": it
  runs before semantic scoring, memory curation and the video pass.
- Only the embedding reads filter on model_version; the event-label reads take
  no model_version at all.
- image_util_process_unembedded_images closes its session if embedding
  inference raises, not scoring, which it never performs.
- Listed the memories slice and utils suites in the frontend testing index,
  and gave the backend memories page the test-coverage table its sibling
  pages already have.
- Switches persist on change, sliders on onValueCommit.
- SQLite, not sqlite, throughout the architecture page.
@github-actions github-actions Bot added the enhancement New feature or request label Jul 29, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ No issue was linked in the PR description.
Please make sure to link an issue (e.g., 'Fixes #issue_number')

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ No issue was linked in the PR description.
Please make sure to link an issue (e.g., 'Fixes #issue_number')

@rohan-pandeyy rohan-pandeyy removed the enhancement New feature or request label Jul 31, 2026
@rohan-pandeyy rohan-pandeyy linked an issue Jul 31, 2026 that may be closed by this pull request
30 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation GSoC 2026

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Smart Memories - surface photo collections proactively

1 participant