Skip to content

fix: resolve file paths correctly for file fixes - #794

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/file-fixes-path-resolution
Open

sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/file-fixes-path-resolution

Conversation

@sentry

@sentry sentry Bot commented Sep 18, 2026

Copy link
Copy Markdown

This PR addresses a FileNotFoundError occurring during the file fixing process in codecov_cli/services/upload/upload_collector.py.

Root Cause:
Previously, the _get_file_fixes() method would attempt to open files using paths returned by git ls-files. These paths are relative to the repository root (network_root_folder). However, the CLI process's current working directory (CWD) is not always guaranteed to be the network_root_folder. When the CWD differed, open(filename, 'r') would fail to locate the file, leading to a FileNotFoundError.

Solution:

  1. Path Resolution: Modified _get_file_fixes() to construct an absolute path by prepending self.network_finder.network_root_folder to the filename before attempting to open it. This ensures the file is always looked for in the correct location relative to the repository root.
  2. Error Handling: Added specific FileNotFoundError handling to gracefully log a warning and skip applying file fixes for that particular file if it cannot be found. This prevents the entire upload process from crashing due to a missing file, similar to how UnicodeDecodeError and IsADirectoryError are handled.

This fix ensures that file fixes are correctly applied in various CI environments where the CWD might not align with the repository root.

Fixes CLI-94

@sentry <feedback>: Autofix iterates on these changes
@sentry stop iterating: Autofix stops iterating on this run

This PR was automatically generated by Sentry. You can adjust this setting at any time.

@sentry

sentry Bot commented Sep 18, 2026

Copy link
Copy Markdown
Author

⚠️ Seer needs additional GitHub permissions

Seer wants to keep iterating on this pull request to get CI passing, but the Sentry GitHub App installation is missing permissions it needs to read the failing checks and push a fix.

Review and accept the updated permissions to let Seer continue: https://github.com/organizations/codecov/settings/installations/86101127/permissions/update

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