diff --git a/Brainarr.Plugin/Services/Enrichment/MusicBrainzResolver.cs b/Brainarr.Plugin/Services/Enrichment/MusicBrainzResolver.cs index 5aea20fb..9a6dc4d9 100644 --- a/Brainarr.Plugin/Services/Enrichment/MusicBrainzResolver.cs +++ b/Brainarr.Plugin/Services/Enrichment/MusicBrainzResolver.cs @@ -100,6 +100,7 @@ public async Task> EnrichWithMbidsAsync(List(); + mbidResolver.Setup(r => r.EnrichWithMbidsAsync(It.IsAny>(), It.IsAny())) + .Returns((List recs, CancellationToken _) => Task.FromResult(recs)); + var artistResolver = new Mock(); + artistResolver.Setup(r => r.EnrichArtistsAsync(It.IsAny>(), It.IsAny())) + .Returns((List recs, CancellationToken _) => Task.FromResult(recs)); + var orchestrator = new BrainarrOrchestrator( _logger, providerFactory.Object, @@ -121,6 +133,8 @@ public async Task FetchRecommendations_WithTopUpEnabled_FillsToTarget() modelDetection.Object, http.Object, duplicationPrevention, + mbidResolver: mbidResolver.Object, + artistResolver: artistResolver.Object, breakerRegistry: breakerRegistry.Object, duplicateFilter: duplicateFilter); diff --git a/CLAUDE.md b/CLAUDE.md index bb75f859..ef4a6171 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -445,4 +445,4 @@ Claude Code will automatically apply the appropriate specialist context based on |------|-----------|-----| | `E2EHermeticGateTests.LogRedaction_*` | NLog config race — tests use `TestLogger.Create()` which mutates global `LogManager.Configuration` but class lacked `[Collection("LoggingTests")]`, allowing parallel execution with other NLog tests | Add `[Collection("LoggingTests")]` to `E2EHermeticGateTests` | | `LoggerWarnOnceTests.WarnOnceWithEvent_Logs_OnlyOnce_PerKey` | Static `_warnOnceKeys` dictionary persists across tests — if another test used the same event+key combo, this test sees 0 logs | Call `LoggerExtensions.ClearWarnOnceKeysForTests()` in constructor | -| `BrainarrOrchestratorTopUpTests.FetchRecommendations_WithTopUpEnabled_FillsToTarget` | `DuplicationPreventionService` adds items to history during initial pipeline pass; when the final merge re-runs dedup, "Lana Del Rey" is falsely treated as already recommended. Normalization mismatch between `DuplicationPreventionService.NormalizeString()` (regex whitespace collapse) and `TopUpPlanner.NormalizeTopUpKey()` (no whitespace collapse) amplifies the issue. | Unify normalization logic: `TopUpPlanner.NormalizeTopUpKey()` should use the same regex whitespace normalization as `DuplicationPreventionService`. Also consider not adding items to dedup history until final merge is complete. | +| `BrainarrOrchestratorTopUpTests.FetchRecommendations_WithTopUpEnabled_FillsToTarget` | **Fixed.** Two issues: (1) `MusicBrainzResolver.EnrichWithMbidsAsync` catch block silently dropped recommendations on HTTP failure instead of preserving them (production bug). (2) Test created real resolvers that hit the MusicBrainz API, making results non-deterministic. | Production fix: added `result.Add(rec)` in catch block. Test fix: injected pass-through mock resolvers to eliminate external HTTP calls. |