Repository navigation
Remove a failed import's image folder - #442
Merged
Merged
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 54 minutes. View limit details
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. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Nothing on screen changes: this is disk cleanup, so the proof is a before and after count from a running build.
ci: analyze test
A failed import left a folder behind in the app's data, for a strategy that was never saved, and nothing ever cleans it up. #426 described it as an empty folder, but in the running build it's usually worse: the image files had already been copied in, so a rejected file leaves its pictures on disk.
_importStrategyFilecreates the new strategy's image folder before it reads the JSON, so the version check and every parse error come after it. Each one left the folder.The import now tracks whether the strategy was saved, and if it wasn't, removes that strategy's folder, using the same
getImageFolder(id).parentdelete that duplicate and move already use. The id is one this import just generated, so nothing else can live there. The removal can't hide the original error: it catches its own failure, so the update message still arrives.What I checked
Windows release driver builds, main and the fixes, same script: four failed imports and four good ones, listing the app's data folder before and after. The fixes build holds all three import PRs.
On main the script left 8 folders, 4 of them leftovers. This branch left 4, one per strategy saved.
canvas-compatibility-v97.icaimported and opened on both builds with the same counts (58 agents, 29 texts on its first page).Three new tests in
strategy_integrity_test.dartrun the real import against a throwaway app folder, with a newer file, a zip with no strategy, and a broken strategy. All three fail without the fix.Web has no import, so nothing changes in a browser.
What this doesn't cover


Confidence Score: 5/5
The PR appears safe to merge; no actionable issues were found.Summary
Removes the new strategy’s image folder when an import fails before saving.
Source review found no actionable issues. Tests and the running app were not executed during this review.
SunkenInTime explicitly deferred removing folders left by earlier imports and empty library folders created during failed folder imports. Those remain outside this change.
Reviews (1) · Last reviewed commit: "Remove a failed import's image folder" · Reviewed by Greptile