Skip to content

updates#655

Open
davayd wants to merge 1 commit into
immichFrame:mainfrom
davayd:dd-edits
Open

updates#655
davayd wants to merge 1 commit into
immichFrame:mainfrom
davayd:dd-edits

Conversation

@davayd

@davayd davayd commented Jun 27, 2026

Copy link
Copy Markdown

Summary by CodeRabbit

  • New Features

    • Added a new Memories view endpoint that returns assets in grouped sections instead of a single flat list.
    • Memory assets are now organized and delivered per account, improving how grouped content is displayed.
  • Bug Fixes

    • Improved authenticated asset requests to work reliably with protected access.
    • Preserved empty-group handling so only meaningful memory groups are shown.
  • Tests

    • Updated asset controller coverage for authenticated requests and memory-related responses.

@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a GET api/Asset/Memories endpoint that returns memory assets grouped by account and year. MemoryAssetsPool is refactored to expose grouped results via GetAssetGroups, filtering empty year groups. MultiImmichFrameLogicDelegate concurrently fetches and records asset locations. A NuGet.Config and AGENTS.md are also added.

Changes

Memory Assets Grouped Endpoint

Layer / File(s) Summary
Interface contracts
ImmichFrame.Core/Interfaces/IImmichFrameLogic.cs
Adds GetMemoryAssets to IImmichFrameLogic and RecordAssetLocation to IAccountSelectionStrategy.
MemoryAssetsPool grouped loading
ImmichFrame.Core/Logic/Pool/MemoryAssetsPool.cs
Adds GetAssetGroups public method; refactors LoadAssetGroups to return nested lists skipping empty year groups; LoadAssets now flattens via SelectMany.
PooledImmichFrameLogic and strategy
ImmichFrame.Core/Logic/PooledImmichFrameLogic.cs, ImmichFrame.Core/Logic/AccountSelection/TotalAccountImagesSelectionStrategy.cs
GetMemoryAssets delegates to MemoryAssetsPool.GetAssetGroups; RecordAssetLocation delegates to the injected tracker.
MultiImmichFrameLogicDelegate orchestration
ImmichFrame.Core/Logic/MultiImmichFrameLogicDelegate.cs
Concurrently fetches grouped assets per account, filters empty groups, records locations, and returns account-scoped grouped assets.
AssetController endpoint
ImmichFrame.WebApi/Controllers/AssetController.cs
New GET api/Asset/Memories endpoint that returns List<List<AssetResponseDto>>.
Tests with authorization
ImmichFrame.WebApi.Tests/Controllers/AssetControllerTests.cs
Adds CreateAuthorizedClient() helper; updates setup with AuthenticationSecret and adjusted feature flags; existing tests use authorized client.

Supporting Config and Docs

Layer / File(s) Summary
NuGet config and docs
NuGet.Config, AGENTS.md
Adds nuget.org v3 package source config and release writeup instructions.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 Memories hop through the years with glee,
Grouped by account for all to see,
Each asset recorded, no empty year stays,
Bearer tokens guard the endpoint's maze,
The rabbit writes notes so releases shine bright! ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 3.85% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title is too generic to describe the pull request's actual changes. Rename it to reflect the main change, such as adding memory asset grouping and the new Memories API endpoint.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
ImmichFrame.WebApi.Tests/Controllers/AssetControllerTests.cs (1)

195-262: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Please add an integration test for /api/Asset/Memories.

This PR adds a new authenticated route and a nested response shape, but the new coverage still only exercises /api/Asset and /api/Asset/RandomImageAndInfo. A small test with one empty memory group and one populated group would protect the controller wiring and the empty-group filtering in this slice.

🤖 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 `@ImmichFrame.WebApi.Tests/Controllers/AssetControllerTests.cs` around lines
195 - 262, Add an integration test in AssetControllerTests for the authenticated
/api/Asset/Memories route, since current coverage only exercises GetAssets and
GetRandomImageAndInfo. Create a test that mocks the memory response shape with
one empty memory group and one populated group, then call the controller through
CreateAuthorizedClient and assert the nested response is wired correctly and the
empty group is filtered out. Use the existing test patterns in
GetAssets_ReturnsVideoDurationFromImmichMetadata and the AssetController
endpoint setup to locate the right place.
🤖 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 `@ImmichFrame.Core/Logic/Pool/MemoryAssetsPool.cs`:
- Around line 10-16: `GetAssetGroups()` in `MemoryAssetsPool` bypasses the
shared cached read path and calls `LoadAssetGroups()` directly, so grouped
requests never benefit from the `CachingApiAssetsPool` cache. Update the
grouped-read flow to go through a single cached fetch path used by both
`GetAssetGroups()` and `LoadAssets()`, or add caching around the grouped result
so `SearchMemoriesAsync` and the asset-info fetches are not repeated on every
request.

In `@ImmichFrame.Core/Logic/PooledImmichFrameLogic.cs`:
- Around line 78-80: GetMemoryAssets currently creates a new MemoryAssetsPool on
every call, which discards any cached state such as DailyApiCache. Update
PooledImmichFrameLogic to hold a dedicated MemoryAssetsPool instance as a field
(initialized once from _immichApi and AccountSettings) and have GetMemoryAssets
reuse that field instead of constructing a fresh pool in the method body.

---

Nitpick comments:
In `@ImmichFrame.WebApi.Tests/Controllers/AssetControllerTests.cs`:
- Around line 195-262: Add an integration test in AssetControllerTests for the
authenticated /api/Asset/Memories route, since current coverage only exercises
GetAssets and GetRandomImageAndInfo. Create a test that mocks the memory
response shape with one empty memory group and one populated group, then call
the controller through CreateAuthorizedClient and assert the nested response is
wired correctly and the empty group is filtered out. Use the existing test
patterns in GetAssets_ReturnsVideoDurationFromImmichMetadata and the
AssetController endpoint setup to locate the right place.
🪄 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

Run ID: 87909de8-e59e-49bd-b967-3f65fce4919e

📥 Commits

Reviewing files that changed from the base of the PR and between efc850c and d8bcf4f.

📒 Files selected for processing (9)
  • AGENTS.md
  • ImmichFrame.Core/Interfaces/IImmichFrameLogic.cs
  • ImmichFrame.Core/Logic/AccountSelection/TotalAccountImagesSelectionStrategy.cs
  • ImmichFrame.Core/Logic/MultiImmichFrameLogicDelegate.cs
  • ImmichFrame.Core/Logic/Pool/MemoryAssetsPool.cs
  • ImmichFrame.Core/Logic/PooledImmichFrameLogic.cs
  • ImmichFrame.WebApi.Tests/Controllers/AssetControllerTests.cs
  • ImmichFrame.WebApi/Controllers/AssetController.cs
  • NuGet.Config

Comment on lines +10 to +16
public async Task<IEnumerable<IEnumerable<AssetResponseDto>>> GetAssetGroups(CancellationToken ct = default)
=> await LoadAssetGroups(ct);

protected override async Task<IEnumerable<AssetResponseDto>> LoadAssets(CancellationToken ct = default)
=> (await LoadAssetGroups(ct)).SelectMany(assets => assets);

private async Task<List<List<AssetResponseDto>>> LoadAssetGroups(CancellationToken ct = default)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🚀 Performance & Scalability | 🟠 Major | 🏗️ Heavy lift

Share the grouped read path with the daily cache.

GetAssetGroups() goes straight to LoadAssetGroups(), so callers never hit CachingApiAssetsPool's cached load path. On a busy /Memories client this will replay SearchMemoriesAsync and the follow-up asset-info fetches on every request; please cache the grouped result too, or make this method read from a single cached fetch path.

🤖 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 `@ImmichFrame.Core/Logic/Pool/MemoryAssetsPool.cs` around lines 10 - 16,
`GetAssetGroups()` in `MemoryAssetsPool` bypasses the shared cached read path
and calls `LoadAssetGroups()` directly, so grouped requests never benefit from
the `CachingApiAssetsPool` cache. Update the grouped-read flow to go through a
single cached fetch path used by both `GetAssetGroups()` and `LoadAssets()`, or
add caching around the grouped result so `SearchMemoriesAsync` and the
asset-info fetches are not repeated on every request.

Comment on lines +78 to +80
public Task<IEnumerable<IEnumerable<AssetResponseDto>>> GetMemoryAssets()
{
return new MemoryAssetsPool(_immichApi, AccountSettings).GetAssetGroups();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🚀 Performance & Scalability | 🟠 Major | ⚡ Quick win

Avoid allocating a new MemoryAssetsPool per request.

This throws away DailyApiCache every time GetMemoryAssets() runs, so even a cached pool instance cannot help here. Reuse a dedicated pool field instead of constructing a fresh pool in the method body.

🤖 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 `@ImmichFrame.Core/Logic/PooledImmichFrameLogic.cs` around lines 78 - 80,
GetMemoryAssets currently creates a new MemoryAssetsPool on every call, which
discards any cached state such as DailyApiCache. Update PooledImmichFrameLogic
to hold a dedicated MemoryAssetsPool instance as a field (initialized once from
_immichApi and AccountSettings) and have GetMemoryAssets reuse that field
instead of constructing a fresh pool in the method body.

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