Repository navigation
fix: keep the previous repository copy when a download fails part way - #192
Merged
Merged
Conversation
downloadRepository removed the existing repository folder before the new one was complete, so a copy that failed part way left a folder that exists but holds only part of the library, and every downstream check took it for a whole one. The extraction is now its own function, extractRepositoryArchive. It unzips into a staging folder beside the repository folder, checks the one-folder layout of a GitHub archive, and only then removes the previous copy and renames the new one into place. A failed extraction leaves the previous copy untouched and the staging folder is removed either way. The commit is recorded after the move, as before. Fixes #187. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Contributor
Test Results (R2022a)858 tests 854 ✅ 4m 42s ⏱️ Results for commit 34fa783. |
Contributor
Test Results (R2026a)858 tests 856 ✅ 4m 36s ⏱️ Results for commit 34fa783. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #192 +/- ##
==========================================
- Coverage 80.37% 80.14% -0.23%
==========================================
Files 423 424 +1
Lines 4392 4403 +11
==========================================
- Hits 3530 3529 -1
- Misses 862 874 +12 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Fixes #187.
Problem
downloadRepositoryremoved the existing repository folder and then copied the unzipped download into its place. A copy that failed part way, from a full disk or an interrupted job, left a folder that exists but holds only part of the library:isfolderpasses, some version folders are there and others are not, and everything downstream reports those versions as holding no instances.One correction to the issue as filed:
copyfiledoes throw when called without outputs, so a failed copy was not recorded as the current commit. What was wrong is the order, the previous copy was deleted before the new one was complete, and that a partial copy could not be told from a whole one.Fix
The extraction is its own function,
openminds.internal.utility.git.extractRepositoryArchive. It unzips into a staging folder beside the repository folder, on the same volume, so that putting the result in place is a rename rather than a second copy of 17,000 files, and only then removes the previous copy and moves the new one over. An extraction that fails leaves the previous copy untouched, and the staging folder is removed whether or not it succeeded. The one-folder layout of a GitHub archive is checked before anything is touched and reported asOPENMINDS:Git:UnexpectedArchiveLayout; a move that fails is reported asOPENMINDS:Git:MoveFailedwith the message from the OS. The commit is recorded after the move, as before.What remains: between removing the previous copy and renaming the new one into place there is no copy on disk. That window is two operations on sibling folders, not a copy of every file.
Tests
GitDownloadTestgains three tests against local archives, no network: the previous copy is replaced rather than merged into and nothing of the staging folder remains; a damaged archive leaves the previous copy untouched; an archive that does not hold one folder is rejected by identifier before the previous copy is touched. The existing download test is unchanged.🤖 Generated with Claude Code