Skip to content

Feat: Startup version check & fail, Bump immich openapi#676

Merged
JW-CH merged 4 commits into
mainfrom
startup-version-check
Jul 14, 2026
Merged

Feat: Startup version check & fail, Bump immich openapi#676
JW-CH merged 4 commits into
mainfrom
startup-version-check

Conversation

@JW-CH

@JW-CH JW-CH commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features
    • Added startup compatibility checks for connected Immich servers and now blocks startup when requirements aren’t met (major version 3+).
  • Bug Fixes
    • Updated asset search-related API invocation to match the latest contract.
    • Refreshed API specifications and validation (e.g., stricter asset ID/UUID handling and percentageLimit range/type).
    • Extended contracts for “recently added” visibility and HLS/video codec resolution support.
  • Chores
    • Updated unit tests and HTTP mocking to align with the new startup flow and search API signature.

@JW-CH JW-CH added the enhancement New feature or request label Jul 14, 2026
@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 524ec448-65f1-4486-807f-fea24f7d0a2c

📥 Commits

Reviewing files that changed from the base of the PR and between e7da93e and e08c64b.

📒 Files selected for processing (9)
  • ImmichFrame.Core.Tests/Logic/Pool/AlbumAssetsPoolTests.cs
  • ImmichFrame.Core.Tests/Logic/Pool/AllAssetsPoolTests.cs
  • ImmichFrame.Core.Tests/Logic/Pool/FavoriteAssetsPoolTests.cs
  • ImmichFrame.Core.Tests/Logic/Pool/PersonAssetsPoolTests.cs
  • ImmichFrame.Core.Tests/Logic/Pool/TagAssetsPoolTests.cs
  • ImmichFrame.WebApi.Tests/Controllers/AssetControllerTests.cs
  • ImmichFrame.WebApi.Tests/Controllers/ConfigControllerTests.cs
  • ImmichFrame.WebApi.Tests/Mocks/ImmichApiMock.cs
  • ImmichFrame.WebApi.Tests/Mocks/MockHttpMessageHandler.cs
💤 Files with no reviewable changes (1)
  • ImmichFrame.WebApi.Tests/Mocks/MockHttpMessageHandler.cs

📝 Walkthrough

Walkthrough

The change updates Immich asset-search calls and OpenAPI schemas, adds recently-added and HLS contracts, and replaces startup version logging with compatibility validation that terminates startup when configured servers are unsupported.

Changes

Immich compatibility updates

Layer / File(s) Summary
Asset search contract and call sites
ImmichFrame.Core/OpenAPIs/immich-openapi-specs.json, ImmichFrame.Core/Helpers/AssetHelper.cs, ImmichFrame.Core/Logic/Pool/*AssetsPool.cs
The searchAssets operation adds optional key and slug parameters, and asset-loading calls pass the expanded SearchAssetsAsync argument shape.
Asset search test updates
ImmichFrame.Core.Tests/Logic/Pool/*AssetsPoolTests.cs
Pool tests update mocks and verifications for the expanded search signature while preserving pagination, filtering, matching, empty-result, and deduplication assertions.
OpenAPI schema updates
ImmichFrame.Core/OpenAPIs/immich-openapi-specs.json
The specification version and request, response, release-channel, HLS resolution, recently-added, and percentage-limit schemas are updated.
Startup server-version gate
ImmichFrame.WebApi/Helpers/ImmichServerVersionChecker.cs, ImmichFrame.WebApi/Program.cs, ImmichFrame.WebApi.Tests/Mocks/ImmichApiMock.cs, ImmichFrame.WebApi.Tests/Controllers/*Tests.cs
Server version logging is replaced with compatibility checking; startup exits when configuration fails or any server reports a major version below 3, with tests using a shared mocked HTTP handler.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Program
  participant ImmichServerVersionChecker
  participant IServerSettings
  participant ImmichAPI
  Program->>ImmichServerVersionChecker: CheckServerVersions(services, logger)
  ImmichServerVersionChecker->>IServerSettings: load configured accounts
  IServerSettings-->>ImmichServerVersionChecker: return account settings
  loop configured accounts
    ImmichServerVersionChecker->>ImmichAPI: fetch server version with API key
    ImmichAPI-->>ImmichServerVersionChecker: return server version
  end
  ImmichServerVersionChecker-->>Program: return compatibility result
  Program->>Program: exit when validation fails
Loading

Possibly related PRs

Suggested labels: maintenance

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main changes: adding a startup Immich version check with fail-fast behavior and updating the OpenAPI spec.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch startup-version-check

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

🤖 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/AlbumAssetsPool.cs`:
- Line 30: Update SearchAssetsAsync setups, verifications, and invocations to
pass the new key and slug arguments. Apply the corresponding changes in
AlbumAssetsPool.cs (30-30), AssetHelper.cs (26-26), FavoriteAssetsPool.cs
(31-31), PeopleAssetsPool.cs (39-39), and TagAssetsPool.cs (53-53), along with
the related AlbumAssetsPoolTests.cs, AllAssetsPoolTests.cs,
FavoriteAssetsPoolTests.cs, PersonAssetsPoolTests.cs, and TagAssetsPoolTests.cs
mocks.

In `@ImmichFrame.WebApi/Helpers/ImmichServerVersionChecker.cs`:
- Line 42: Update the accounts iteration in the server version checker to handle
a null IServerSettings.Accounts value by falling back to an empty sequence
before the foreach loop. Preserve the existing account-processing and graceful
logging behavior when accounts are configured.
🪄 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: d0bb6360-1088-4677-a6c5-c4d62e2e74b5

📥 Commits

Reviewing files that changed from the base of the PR and between eb0e36e and e7da93e.

📒 Files selected for processing (9)
  • ImmichFrame.Core/Helpers/AssetHelper.cs
  • ImmichFrame.Core/Logic/Pool/AlbumAssetsPool.cs
  • ImmichFrame.Core/Logic/Pool/FavoriteAssetsPool.cs
  • ImmichFrame.Core/Logic/Pool/PeopleAssetsPool.cs
  • ImmichFrame.Core/Logic/Pool/TagAssetsPool.cs
  • ImmichFrame.Core/OpenAPIs/immich-openapi-specs.json
  • ImmichFrame.WebApi/Helpers/ImmichServerVersionChecker.cs
  • ImmichFrame.WebApi/Helpers/ImmichServerVersionLogger.cs
  • ImmichFrame.WebApi/Program.cs
💤 Files with no reviewable changes (1)
  • ImmichFrame.WebApi/Helpers/ImmichServerVersionLogger.cs

Comment thread ImmichFrame.Core/Logic/Pool/AlbumAssetsPool.cs

var allCompatible = true;

foreach (var account in accounts)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Guard against a potential NullReferenceException.

If IServerSettings.Accounts resolves to null (e.g., if the accounts section is missing from the configuration file), the foreach loop will throw an uncaught NullReferenceException. This would crash the startup process abruptly, bypassing the graceful logging intended by this checker.

Consider using a null-coalescing operator to provide an empty fallback.

🛡️ Proposed fix
-            foreach (var account in accounts)
+            foreach (var account in accounts ?? [])

(Note: If using a C# version prior to 12, use accounts ?? Enumerable.Empty<IAccountSettings>() instead).

📝 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
foreach (var account in accounts)
foreach (var account in accounts ?? [])
🤖 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/Helpers/ImmichServerVersionChecker.cs` at line 42, Update
the accounts iteration in the server version checker to handle a null
IServerSettings.Accounts value by falling back to an empty sequence before the
foreach loop. Preserve the existing account-processing and graceful logging
behavior when accounts are configured.

@JW-CH JW-CH merged commit e684ed4 into main Jul 14, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant