Skip to content

fix: Prevent AttributeError in Sentry cleanup and optimize gcov plugin - #774

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/cli-gn-attributeerror
Open

fix: Prevent AttributeError in Sentry cleanup and optimize gcov plugin#774
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/cli-gn-attributeerror

Conversation

@sentry

@sentry sentry Bot commented Aug 23, 2026

Copy link
Copy Markdown

This PR addresses issue CLI-GN, which manifested as an AttributeError: 'NoneType' object has no attribute 'get' during the 'Do Upload' transaction.

The root cause was a combination of two factors:

  1. Unbounded Gcov plugin scan: The gcov plugin, when enabled, would perform an exhaustive search for .gcno files across the entire project directory, including large vendor directories like node_modules. This often led to extremely long runtimes and subsequent KeyboardInterrupt signals (e.g., due to CI timeouts).
  2. Fragile Sentry exception handling: During the cleanup phase of a Sentry transaction, specifically within the _before_send hook, the code was attempting to call .get() on potentially None values within the exception event structure. This would occur when a KeyboardInterrupt (or similar exception) was being processed, leading to the AttributeError.

Changes implemented:

  • Gcov plugin: Modified codecov_cli/plugins/gcov.py to include node_modules, .git, and vendor in the default folders_to_ignore list for the GcovPlugin. This prevents the plugin from scanning these large, irrelevant directories by default, significantly reducing scan times and the likelihood of timeouts.
  • Sentry _before_send: Updated codecov_cli/opentelemetry.py to make the .get() calls within the _before_send function more robust. It now explicitly handles cases where intermediate dictionary keys might have None values, preventing the AttributeError during exception processing.

Fixes CLI-GN

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

@codecov

codecov Bot commented Aug 23, 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 1726 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