Skip to content

Add table relation cache for smart albums#4553

Merged
ildyria merged 9 commits into
masterfrom
relation-smart-album-user-thumb-2
Jul 23, 2026
Merged

Add table relation cache for smart albums#4553
ildyria merged 9 commits into
masterfrom
relation-smart-album-user-thumb-2

Conversation

@ildyria

@ildyria ildyria commented Jul 22, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features

    • Added smarter, viewer-specific album thumbnails (tag, person, and smart), using a shared cached “thumb” model.
    • Album thumbnail data now refreshes in the background when users change photo tags, highlights, ratings, people assignments, or when photos are moved/deleted.
  • Bug Fixes

    • Improved cache cleanup by removing stale per-user thumbnail rows when albums/accounts are removed.
    • Password-protected album thumbnails now correctly hide/clear locked album thumbs until unlocked.
  • Style

    • Refreshed maintenance screen card layouts and button styling for a more consistent UI.

Copilot AI review requested due to automatic review settings July 22, 2026 18:46
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: af6b4a69-7f94-44ea-9aea-23e123ead7b1

📥 Commits

Reviewing files that changed from the base of the PR and between af2e63f and a0e3d60.

📒 Files selected for processing (2)
  • resources/js/v8/views/admin/Maintenance.vue
  • tests/Feature_v2/Album/AlbumUpdateTest.php
💤 Files with no reviewable changes (1)
  • resources/js/v8/views/admin/Maintenance.vue

📝 Walkthrough

Walkthrough

Changes

Album user thumbnail caching

Layer / File(s) Summary
Cache storage and album thumb resolution
database/migrations/..., app/Models/AlbumUserThumb.php, app/Models/Extensions/*, app/Models/{TagAlbum,PersonAlbum,User}.php, app/Actions/...
Adds the album_user_thumbs cache, viewer-scoped album thumbnail lookup, eager loading, and explicit cleanup.
Explicit viewer context for album photo queries
app/Relations/*, app/SmartAlbums/*
Adds explicit authenticated or guest context handling for relation and smart-album photo queries and thumbnail generation.
Thumbnail recomputation and job debouncing
app/Jobs/RecomputeAlbumUserThumbsJob.php, app/Jobs/Traits/*, app/Jobs/RecomputeAlbum{Size,Stats}Job.php
Adds per-viewer thumbnail recomputation and shared latest-job debounce behavior.
Photo-change event refresh flow
app/Events/*, app/Listeners/*, app/Providers/EventServiceProvider.php, app/Http/Controllers/*, app/Actions/Photo/Rating.php
Dispatches photo mutation events and recomputes affected smart, tag, and person album thumbnails.
Job trait resolution and test baselines
app/Jobs/*, tests/Unit/Actions/Db/*, docs/specs/...
Updates failure-trait imports, job-ID documentation, and database optimization test targets.

Access behavior and maintenance interfaces

Layer / File(s) Summary
Album thumbnail and sharing access behavior
app/Http/Resources/Models/ThumbAlbumResource.php, app/Http/Controllers/Gallery/SharingController.php
Hides thumbnails for locked password-protected albums and changes unauthenticated sharing album handling.
Maintenance card layout and actions
resources/js/v7/components/maintenance/*, resources/js/v8/components/maintenance/*, resources/js/v8/views/admin/Maintenance.vue
Refactors maintenance cards to use header and footer slots, updates styling, changes selected button colors, and removes the duplicate checker from the maintenance grid.

Estimated code review effort: 4 (Complex) | ~60 minutes

Poem

I’m a rabbit with a cache in my burrow so bright,
Thumb rows hop through the albums all night.
Tags and faces send events with a cheer,
Fresh little covers appear viewer-clear.
Old jobs politely yield to the new,
While carrots applaud every thumbnail debut.

🚥 Pre-merge checks | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 72.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.

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.

@ildyria
ildyria removed the request for review from Copilot July 22, 2026 18:46
@ildyria
ildyria marked this pull request as ready for review July 22, 2026 19:09
@ildyria
ildyria requested a review from a team as a code owner July 22, 2026 19:09
@ildyria

ildyria commented Jul 22, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review time!

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

@ildyria: On it — I’ll review the smart-album relation-cache changes. 🐇

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@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: 4


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c0ed7d18-2b9d-4674-995b-550bf9ac43a9

📥 Commits

Reviewing files that changed from the base of the PR and between 29aa16a and 53cdd5b.

📒 Files selected for processing (40)
  • app/Actions/Album/Delete.php
  • app/Actions/Albums/Top.php
  • app/Actions/Photo/Rating.php
  • app/Events/PhotoHighlightToggled.php
  • app/Events/PhotoPersonsChanged.php
  • app/Events/PhotoRatingChanged.php
  • app/Events/PhotoTagsChanged.php
  • app/Factories/AlbumFactory.php
  • app/Http/Controllers/AiVision/FaceController.php
  • app/Http/Controllers/Gallery/AlbumController.php
  • app/Http/Controllers/Gallery/PhotoController.php
  • app/Jobs/CleanUpExtraction.php
  • app/Jobs/ExtractColoursJob.php
  • app/Jobs/ExtractZip.php
  • app/Jobs/GeodecodeLocationJob.php
  • app/Jobs/ImportImageJob.php
  • app/Jobs/ProcessImageJob.php
  • app/Jobs/RecomputeAlbumSizeJob.php
  • app/Jobs/RecomputeAlbumStatsJob.php
  • app/Jobs/RecomputeAlbumUserThumbsJob.php
  • app/Jobs/Traits/DebouncesLatestJobTrait.php
  • app/Jobs/Traits/HasFailedTrait.php
  • app/Listeners/RecomputeAlbumUserThumbsOnPhotoChange.php
  • app/Models/AlbumUserThumb.php
  • app/Models/Extensions/CachesAlbumUserThumb.php
  • app/Models/Extensions/ResolvesUserContext.php
  • app/Models/PersonAlbum.php
  • app/Models/TagAlbum.php
  • app/Models/User.php
  • app/Providers/EventServiceProvider.php
  • app/Relations/BaseHasManyPhotos.php
  • app/Relations/HasManyPhotosByPerson.php
  • app/Relations/HasManyPhotosByTag.php
  • app/SmartAlbums/BaseSmartAlbum.php
  • app/SmartAlbums/MyBestPicturesAlbum.php
  • app/SmartAlbums/MyRatedPicturesAlbum.php
  • app/SmartAlbums/UnsortedAlbum.php
  • database/migrations/2026_07_21_000000_create_album_user_thumbs_table.php
  • tests/Unit/Actions/Db/OptimizeDbTest.php
  • tests/Unit/Actions/Db/OptimizeTablesTest.php

Comment thread app/Http/Controllers/Gallery/PhotoController.php Outdated
Comment thread app/Jobs/Traits/DebouncesLatestJobTrait.php
Comment thread app/Models/PersonAlbum.php
@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 72.64957% with 64 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.03%. Comparing base (91598df) to head (a0e3d60).
⚠️ Report is 1 commits behind head on master.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@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: 4


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6349357f-9ca5-4a00-8efb-11ae6b97f4c0

📥 Commits

Reviewing files that changed from the base of the PR and between 53cdd5b and af2e63f.

📒 Files selected for processing (39)
  • app/Events/PhotoTagsChanged.php
  • app/Http/Controllers/Gallery/PhotoController.php
  • app/Http/Controllers/Gallery/SharingController.php
  • app/Http/Resources/Models/ThumbAlbumResource.php
  • app/Jobs/RecomputeAlbumStatsJob.php
  • app/Jobs/Traits/DebouncesLatestJobTrait.php
  • app/Listeners/RecomputeAlbumUserThumbsOnPhotoChange.php
  • docs/specs/4-architecture/features/004-album-size-statistics/spec.md
  • docs/specs/4-architecture/features/004-album-size-statistics/tasks.md
  • resources/js/v7/components/maintenance/MaintenanceBulkScanFaces.vue
  • resources/js/v7/components/maintenance/MaintenanceBulkScanNsfw.vue
  • resources/js/v7/components/maintenance/MaintenanceCleaning.vue
  • resources/js/v7/components/maintenance/MaintenanceDestroyDismissedFaces.vue
  • resources/js/v7/components/maintenance/MaintenanceResetFaceScanStatus.vue
  • resources/js/v7/components/maintenance/MaintenanceRunClustering.vue
  • resources/js/v7/components/maintenance/MaintenanceSyncFaceEmbeddings.vue
  • resources/js/v8/components/maintenance/MaintenanceBackfillAlbumSizes.vue
  • resources/js/v8/components/maintenance/MaintenanceBulkScanFaces.vue
  • resources/js/v8/components/maintenance/MaintenanceBulkScanNsfw.vue
  • resources/js/v8/components/maintenance/MaintenanceCleaning.vue
  • resources/js/v8/components/maintenance/MaintenanceDestroyDismissedFaces.vue
  • resources/js/v8/components/maintenance/MaintenanceDuplicateChecker.vue
  • resources/js/v8/components/maintenance/MaintenanceFilesize.vue
  • resources/js/v8/components/maintenance/MaintenanceFixJobs.vue
  • resources/js/v8/components/maintenance/MaintenanceFixTree.vue
  • resources/js/v8/components/maintenance/MaintenanceFlushCache.vue
  • resources/js/v8/components/maintenance/MaintenanceFlushQueue.vue
  • resources/js/v8/components/maintenance/MaintenanceFulfillOrders.vue
  • resources/js/v8/components/maintenance/MaintenanceFulfillPrecompute.vue
  • resources/js/v8/components/maintenance/MaintenanceGenSizevariants.vue
  • resources/js/v8/components/maintenance/MaintenanceMissingPalettes.vue
  • resources/js/v8/components/maintenance/MaintenanceOldOrders.vue
  • resources/js/v8/components/maintenance/MaintenanceOptimize.vue
  • resources/js/v8/components/maintenance/MaintenanceResetFaceScanStatus.vue
  • resources/js/v8/components/maintenance/MaintenanceRunClustering.vue
  • resources/js/v8/components/maintenance/MaintenanceSyncFaceEmbeddings.vue
  • resources/js/v8/components/maintenance/MaintenanceUpdate.vue
  • resources/js/v8/components/maintenance/StatisticsIntegrity.vue
  • resources/js/v8/views/admin/Maintenance.vue
💤 Files with no reviewable changes (2)
  • resources/js/v8/views/admin/Maintenance.vue
  • app/Jobs/RecomputeAlbumStatsJob.php
🚧 Files skipped from review as they are similar to previous changes (3)
  • app/Jobs/Traits/DebouncesLatestJobTrait.php
  • app/Http/Controllers/Gallery/PhotoController.php
  • app/Listeners/RecomputeAlbumUserThumbsOnPhotoChange.php

Comment thread app/Http/Controllers/Gallery/SharingController.php
Comment thread app/Http/Resources/Models/ThumbAlbumResource.php
@ildyria
ildyria merged commit 21c1c03 into master Jul 23, 2026
50 checks passed
@ildyria
ildyria deleted the relation-smart-album-user-thumb-2 branch July 23, 2026 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant