-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add scanner error reporting to Status API and UI #4094
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Introduced LastScanErrorKey constant for error tracking. - Updated StatusInfo struct to include LastError field. - Modified scanner logic to store and retrieve last scan error. - Enhanced ScanStatus response to include error information. - Updated UI components to display last scan error when applicable. - Added tests to verify last scan error functionality. Signed-off-by: Deluan <deluan@navidrome.org>
- Added LastScanTypeKey and LastScanStartTimeKey constants for tracking scan type and start time. - Updated StatusInfo struct to include ScanType and ElapsedTime fields. - Implemented getScanInfo method to retrieve scan type, elapsed time, and last error. - Modified scanner logic to store scan type and start time during scans. - Enhanced ScanStatus response and UI components to display scan type and elapsed time. - Added formatShortDuration utility for better elapsed time representation. - Updated activity reducer to handle new scan status fields. Signed-off-by: Deluan <deluan@navidrome.org>
- Removed the old controller_status_test.go file. - Merged relevant tests into the new controller_test.go file for better organization and maintainability. - Ensured all existing test cases for controller status are preserved and functional. Signed-off-by: Deluan <deluan@navidrome.org>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Important
Looks good to me! 👍
Reviewed everything up to 227b503 in 1 minute and 46 seconds. Click for details.
- Reviewed
691
lines of code in13
files - Skipped
0
files when reviewing. - Skipped posting
4
draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. scanner/controller.go:121
- Draft comment:
Consider handling errors from property retrieval (e.g. time.Parse failures) rather than ignoring them to aid debugging. - Reason this comment was not posted:
Confidence changes required:33%
<= threshold50%
None
2. scanner/scanner.go:65
- Draft comment:
Avoid ignoring errors from Property.Put calls; consider handling or logging these errors for improved reliability. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50% This is a tricky case. On one hand, ignoring errors is generally bad practice. On the other hand, these Property.Put calls appear to be for tracking scan status/metadata, and the code seems to intentionally ignore these errors consistently throughout the file. The main scanning functionality would continue even if these properties fail to be stored. Looking at lines 190-199, when Property.Put errors actually matter, they ARE being handled properly. I might be wrong about the importance of these properties - perhaps failing to store the scan type or error state could cause issues elsewhere in the system. Also, consistently ignoring errors doesn't necessarily make it correct. The code shows a clear pattern of handling Property.Put errors when they are critical (like in runUpdateLibraries) and intentionally ignoring them for status tracking. This suggests the ignored errors are indeed non-critical by design. The comment should be deleted. The error handling appears to be intentional - critical Property.Put errors are handled while status tracking errors are consistently ignored.
3. ui/src/layout/ActivityPanel.jsx:80
- Draft comment:
Consider memoizing the triggerScan function (e.g. using useCallback) to optimize performance and avoid unnecessary re-renders. - Reason this comment was not posted:
Confidence changes required:33%
<= threshold50%
None
4. ui/src/utils/formatters.test.js:69
- Draft comment:
Typo: The test description reads "format dates". For consistency with other test descriptions, consider changing it to "formats dates". - Reason this comment was not posted:
Comment was on unchanged code.
Workflow ID: wflow_5eNbS89YCJLSJi6Y
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Important
Looks good to me! 👍
Reviewed c4b3a79 in 1 minute and 24 seconds. Click for details.
- Reviewed
13
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
1
draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. scanner/controller.go:117
- Draft comment:
The updated comment is less descriptive. It would be clearer to mention that the function retrieves the last error, scan type, and start time (used to compute elapsed time) from the database properties. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% The comment is technically correct - the function does retrieve those specific fields. However, the new comment is also correct and follows the principle of abstraction by focusing on what the function does conceptually rather than implementation details. The suggested change doesn't point out any actual issues or improvements in the code itself. The comment is about documentation style rather than code quality. It's subjective whether more detailed comments are better - sometimes more abstract comments are preferable. While the suggestion is technically accurate, it doesn't highlight any real issues that need fixing. The new comment is sufficient for understanding the function's purpose. This comment should be deleted as it's purely about documentation style preferences rather than identifying actual code issues that need fixing.
Workflow ID: wflow_aqNleg8CxhXZUrQK
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
What's Changed
This PR adds the ability to track and display scanner errors in the UI. It includes:
Three new properties in the database to store scan-related information:
LastScanError
: Stores the most recent scan error messageLastScanType
: Tracks whether the last scan was "quick" or "full"LastScanStartTime
: Captures when the scan started to calculate elapsed timeUpdated the scanner controller to track these properties and include them in status responses.
Enhanced the Activity Panel in the UI to show:
Screenshot
Changes