You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
❌ Patch coverage is 41.17647% with 30 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.47%. Comparing base (1ec3045) to head (8f36096). ⚠️ Report is 49 commits behind head on main.
✅ All tests successful. No failed tests found.
The reason will be displayed to describe this comment to others. Learn more.
Bug: The delete_downloaded_files function deletes database records even when the physical file is not found, leading to an inconsistent state where a failure is reported but a partial success occurs. Severity: MEDIUM
Suggested Fix
Move the database deletion logic, including the calls to repos["download_files"].delete() and repos["downloads"].delete(), inside the if resolved_path.exists(): block. This will ensure database records are only removed after the corresponding physical file has been successfully deleted.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: packages/hermes-api/app/api/v1/endpoints/files.py#L232
Potential issue: In the `delete_downloaded_files` function, when a requested file path
does not exist on disk, the operation is correctly added to the `failed_files` list.
However, the code proceeds to delete the associated `DownloadFile` and `Download`
records from the database regardless. This creates an inconsistent state where the API
caller is informed of a failure, but the database is modified as if the operation was
successful. This can occur if a file is removed from the disk by an external process.
Did we get this right? 👍 / 👎 to inform future reviews.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Validation