Skip to content

fix: handle FileNotFoundError for temporary coverage files - #745

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/cli-48-file-not-found
Open

fix: handle FileNotFoundError for temporary coverage files#745
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/cli-48-file-not-found

Conversation

@sentry

@sentry sentry Bot commented Jul 28, 2026

Copy link
Copy Markdown

This PR addresses CLI-48, a FileNotFoundError occurring when the upload-coverage command attempts to read temporary coverage files (e.g., .tmp/coverage-N.json) that have been deleted between discovery and the actual read operation. This is a TOCTOU (time-of-check-time-of-use) race condition.

The fix involves wrapping the file reading operations in codecov_cli/services/upload/upload_sender.py (_get_files) and codecov_cli/services/upload/legacy_upload_sender.py (_generate_coverage_files_section) with try-except FileNotFoundError blocks. If a file is no longer found, it is now gracefully skipped, and a warning is logged, preventing the entire upload command from crashing.

Fixes CLI-48

@codecov

codecov Bot commented Jul 28, 2026

Copy link
Copy Markdown

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
723 1 722 1
View the full list of 1 ❄️ flaky test(s)
api.temp.calculator.test_calculator::test_divide

Flake rate in main: 100.00% (Passed 0 times, Failed 1625 times)

Stack Traces | 0.001s run time
def
                test_divide():
                > assert Calculator.divide(1, 2) == 0.5
                E assert 1.0 == 0.5
                E + where 1.0 = <function Calculator.divide at 0x104c9eb90>(1, 2)
                E + where <function Calculator.divide at 0x104c9eb90> = Calculator.divide
                .../temp/calculator/test_calculator.py:30: AssertionError

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants