fix: use missing_ok for temp file cleanup to avoid masking errors - #3820
Open
Quratulain-bilal wants to merge 2 commits into
Open
fix: use missing_ok for temp file cleanup to avoid masking errors#3820Quratulain-bilal wants to merge 2 commits into
Quratulain-bilal wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR attempts to prevent temporary-file cleanup from masking write failures.
Changes:
- Replaces existence checks with
Path.unlink(missing_ok=True)in three atomic-write paths. - However, non-
FileNotFoundErrorcleanup failures can still mask original exceptions.
Show a summary per file
| File | Description |
|---|---|
src/specify_cli/shared_infra.py |
Updates shared-file cleanup. |
src/specify_cli/integrations/manifest.py |
Updates manifest cleanup. |
src/specify_cli/_utils.py |
Updates settings JSON cleanup. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 3
- Review effort level: Medium
Wrap unlink(missing_ok=True) in try/except OSError in finally/except blocks to prevent cleanup failures from masking the original exception.
Quratulain-bilal
force-pushed
the
fix/presets-registry-encoding
branch
from
July 29, 2026 13:24
4c32666 to
bbe9657
Compare
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.
Replace if temp_path.exists(): temp_path.unlink() with emp_path.unlink(missing_ok=True) in 3 files: integrations/manifest.py, shared_infra.py, _utils.py. The old pattern could raise OSError if unlink() fails, masking the original exception in inally/except blocks.