feat(health): add photo gallery directory health check#220
Conversation
Bundle ReportBundle size has no change ✅ |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #220 +/- ##
==========================================
+ Coverage 43.15% 43.20% +0.04%
==========================================
Files 892 894 +2
Lines 51697 51860 +163
Branches 4824 4845 +21
==========================================
+ Hits 22310 22406 +96
- Misses 28843 28908 +65
- Partials 544 546 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
|
@coderabbitai full review |
✅ Action performedFull review finished. |
📝 WalkthroughWalkthroughAdds ChangesPhoto Gallery Health Check
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
♻️ Duplicate comments (1)
web/Classes/HealthChecks/PhotoGalleryHealthCheck.cs (1)
27-35: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick winAdd
<summary>tag to constructor documentation.Constructor documentation has
<param>tags but is missing the<summary>tag.📝 Proposed fix
+ /// <summary> + /// Creates a new photo gallery health check. + /// </summary> /// <param name="photoPath">🤖 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 `@web/Classes/HealthChecks/PhotoGalleryHealthCheck.cs` around lines 27 - 35, Add a <summary> XML doc for the PhotoGalleryHealthCheck constructor summarizing what the constructor does (e.g., initializes a new PhotoGalleryHealthCheck with the photoPath and healthyWhenMissing behavior), placed above the existing <param> tags in the constructor's documentation for the PhotoGalleryHealthCheck(string? photoPath, bool healthyWhenMissing = false) method; keep the description concise and mention that healthyWhenMissing causes a missing directory to be treated as Healthy/"skipped".
🤖 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.
Duplicate comments:
In `@web/Classes/HealthChecks/PhotoGalleryHealthCheck.cs`:
- Around line 27-35: Add a <summary> XML doc for the PhotoGalleryHealthCheck
constructor summarizing what the constructor does (e.g., initializes a new
PhotoGalleryHealthCheck with the photoPath and healthyWhenMissing behavior),
placed above the existing <param> tags in the constructor's documentation for
the PhotoGalleryHealthCheck(string? photoPath, bool healthyWhenMissing = false)
method; keep the description concise and mention that healthyWhenMissing causes
a missing directory to be treated as Healthy/"skipped".
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 56ac7eb5-1bc1-4beb-8415-8e03c8e5fe76
📒 Files selected for processing (3)
test/HealthChecks/PhotoGalleryHealthCheckTests.csweb/Classes/HealthChecks/HealthCheckExtensions.csweb/Classes/HealthChecks/PhotoGalleryHealthCheck.cs
868cfd6 to
12dd8e0
Compare
There was a problem hiding this comment.
Pull request overview
Adds a new readiness health check to validate that the configured ID-card photo share is not just on a drive with free space, but is actually reachable and contains photo content (detecting mounted-but-empty/wrong shares). Includes unit tests to cover the intended severity model and edge cases.
Changes:
- Introduced
PhotoGalleryHealthCheckto validate reachability + minimum photo count with Degraded/Unhealthy split. - Registered the new
photo-gallerycheck in the health check wiring (with adaptive polling). - Added
PhotoGalleryHealthCheckTeststo cover all major result branches and the exact-.jpgcounting behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| web/Classes/HealthChecks/PhotoGalleryHealthCheck.cs | New health check that probes the photo directory and reports status + telemetry data. |
| web/Classes/HealthChecks/HealthCheckExtensions.cs | Registers the new photo-gallery readiness check alongside existing disk-space checks. |
| test/HealthChecks/PhotoGalleryHealthCheckTests.cs | Unit tests covering healthy/unhealthy/degraded/dev-skip/unconfigured-path behaviors. |
Adds a photo-gallery check that complements disk-space-photos: it confirms the ID-card photo share is reachable and holds more than one photo, catching a mounted-but-empty or wrong share that a free-space check would pass. - Severity tracks user impact: an unreachable share is Degraded (the app still works, falling back to the default image) while a reachable but near-empty share is Unhealthy (the photo data itself is gone) - Wrapped in adaptive polling so the SMB directory scan runs hourly while healthy and every 5 min once failing, instead of on every 5-min poll - Skipped (Healthy) in Development, where the share is not mounted
12dd8e0 to
c7ff3a0
Compare
What
Adds a
photo-galleryhealth check that complements the existingdisk-space-photoscheck. Wheredisk-space-photosonly reports free space on the hosting drive, this verifies the ID-card photo share (PhotoGallery:IDCardPhotoPath) is actually reachable and populated, catching a mounted-but-empty or wrong share that a free-space check would happily pass.Severity model
Status reflects user impact:
The split is deliberate: an unreachable share degrades gracefully (users see
nopic.jpg), so it's yellow; a reachable-but-empty share means photo data loss, so it's the red alarm.Notes
*.jpgwith an exact-extension filter to dodge the Windows 3-char wildcard quirk (*.jpgalso matching.jpginfo).WithAdaptivePollingso the SMB directory scan runs ~hourly while healthy and every 5 min once failing, rather than on every 5-min dashboard poll.S:\share isn't mounted on dev machines), mirroring thedisk-space-photospattern.Tests
PhotoGalleryHealthCheckTestscovers every branch: healthy (2 photos), unhealthy (0 and 1 photo), degraded (unreachable dir), dev-skip, exact-.jpgcounting, and unconfigured path. Full backend suite green; pre-commit lint/test/verify passed.