Skip to content

fix: gracefully handle TypeError during file fixes#720

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/graceful-file-fix-errors
Open

fix: gracefully handle TypeError during file fixes#720
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/graceful-file-fix-errors

Conversation

@sentry

@sentry sentry Bot commented Jun 17, 2026

Copy link
Copy Markdown

This PR adds a defensive TypeError exception handler to the _get_file_fixes function in upload_collector.py.

Root Cause:
In older CLI versions (e.g., cli@11.2.8), a TypeError: 'list' object is not callable occurred when processing certain files (like .dart files) during the file fixing stage. This happened because the code was incorrectly iterating over the fix_patterns_to_apply namedtuple itself, treating its elements (including lists of regexes) as direct callables, instead of accessing the specific without_reason or with_reason fields which contain the actual regex patterns.

Solution:
The primary bug (incorrect iteration logic) has already been resolved in the main branch, where the code now correctly accesses fix_patterns_to_apply.with_reason and fix_patterns_to_apply.without_reason. This PR adds an additional layer of robustness by catching TypeError specifically within the _get_file_fixes function. If a TypeError occurs during file processing, it will now be caught, logged as a warning, and the file's fixes will be skipped, allowing the overall upload process to continue without crashing. This prevents unexpected errors from halting the entire CLI operation for end-users.

Fixes CLI-F2

@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
700 1 699 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 214 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

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