Skip to content

fix: Prevent TypeError in GcovPlugin when scanning node_modules#726

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/gcov-typeerror-node-modules
Open

fix: Prevent TypeError in GcovPlugin when scanning node_modules#726
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/gcov-typeerror-node-modules

Conversation

@sentry

@sentry sentry Bot commented Jul 7, 2026

Copy link
Copy Markdown

This PR addresses a TypeError: 'bool' object is not subscriptable that occurred during the 'Upload Coverage' step, specifically within the GcovPlugin.

Root Cause:
The GcovPlugin's run_preparation() method unconditionally calls search_files() to locate .gcno files across the entire project tree. Even when the --disable-search flag was used (which only affects the CoverageFileFinder), the GcovPlugin would still traverse large directories like node_modules. When processing extremely deeply nested paths within node_modules, accessing path.name in Python 3.9.5's pathlib module could lead to the described TypeError.

Solution:

  1. Default Ignore List for GcovPlugin: Modified GcovPlugin.__init__ to include node_modules, .git, and vendor in its default folders_to_ignore list. This prevents the plugin from traversing these directories, which are known not to contain .gcno files, thus avoiding the problematic path structures.
  2. Safety Net for path.name Access: Added a try/except TypeError block around path.name access within the _is_included helper function in folder_searcher.py. This ensures that if a TypeError is still encountered due to an unexpected path structure (e.g., a pathlib bug with deeply nested paths in a frozen environment), the specific file is skipped with a warning instead of crashing the entire upload process.

Fixes CLI-F7

@codecov

codecov Bot commented Jul 7, 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 562 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