Cover resource service guard and error paths - #94
Conversation
The resource suite covered happy paths but almost none of the guard/error branches. Adds coverage for: - RemoteResourceNotEnabledException across every guarded entry point (built a disabled-config ResourceService directly). - FileNotFoundException for AddLocalResource / AddExistingRemoteResource. - EntityNotFoundException for DownloadResource with an unknown id. - ArgumentException for uploading a missing / already-uploaded resource. - UploadPendingResources no-op when nothing is pending, and the finally-block durability guarantee: successful uploads persist even when a later upload throws (new ThrowOnUploadCall hook on the mock makes the failure point deterministic regardless of iteration order). - DeleteResource sets DeletedAt to the commit time. - HarmonyResource throws when both local and remote resources are null. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 50 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
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. Comment |
AI-generated summary
Third batch from the test-suite review. The resource subsystem had solid happy-path coverage but nearly every guard/error branch was untested — roughly one of the service's throw sites had an assertion.
New tests in
RemoteResourcesTests:GuardedMethods_ThrowWhenResourcesNotEnabled— theRemoteResourceNotEnabledExceptionguard protects 11 methods and was never triggered because the sample kernel always enables resources. Builds aResourceServicedirectly with a disabledHarmonyConfig(the ctor isinternal, visible to tests) and asserts every guarded entry point throws.FileNotFoundExceptionforAddLocalResourceandAddExistingRemoteResourcewith a missing path.EntityNotFoundExceptionforDownloadResourcewith an unknown id;ArgumentExceptionfor uploading a missing resource by id and for uploading an already-uploaded resource.UploadPendingResources— no-op (no commit) when nothing is pending, and thefinally-block durability guarantee: a resource uploaded before a later upload throws is still persisted.DeleteResource_SetsDeletedAtToCommitTime— asserts the actualDeletedAtfield, not just that the resource disappears from queries.HarmonyResource_ThrowsWhenBothResourcesNull.To make the partial-failure test deterministic regardless of iteration order,
RemoteServiceMockgained aThrowOnUploadCall(n)hook that fails the Nth upload call.Test-only; no production code changed.
Test plan
dotnet test --filter FullyQualifiedName~RemoteResourcesTestspasses (32/32 locally, 10 new).