fix(extension): stop deleting unrelated zip files from the working directory#1250
Merged
Merged
Conversation
…rectory extension zip globbed <Name>-*.zip in the process working directory and removed every match before packing, regardless of --filename and --output-directory. Any user file matching the pattern (backups, old release artifacts) was silently destroyed. The cleanup is removed entirely: the resolved output file is still replaced on rebuild because the zip writer truncates it on create. Adds a regression test running the command end-to-end with decoy files in the working directory.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1250 +/- ##
==========================================
+ Coverage 53.46% 53.65% +0.18%
==========================================
Files 303 303
Lines 23322 23325 +3
==========================================
+ Hits 12470 12515 +45
+ Misses 10848 10783 -65
- Partials 4 27 +23
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Soner (shyim)
approved these changes
Jul 24, 2026
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.
What changed?
Removed the "Clear previous zips" block from
extension zip. It globbed<Name>-*.zipin the process working directory and deleted every match before packing, ignoring--filenameand--output-directory. No replacement is needed: the resolved output file is still overwritten on rebuild because the zip writer truncates it on create.Before: running
extension zip --output-directory dist --filename custom-name.zip <path>from a directory containingFroshTest-backup-2024.zipsilently deleted that file.After: user files in the working directory are never removed; only the resolved output file is written.
Why?
Any user file matching the pattern (backups, old release artifacts) was destroyed without a prompt or log line, even when the new zip was written to a completely different location. See #1225 for the full analysis.
How was this tested?
TestZipDoesNotDeleteUnrelatedZipsInWorkingDirectoryruns the command end-to-end with decoy files in the working directory. It fails on the previous code (both decoys deleted) and passes with the fix.go test ./...passes.Related issue or discussion
Fixes #1225