Skip to content

Handle unhandled uv errors prefixed with CPython interpreter info#14433

Merged
thavaahariharangit merged 4 commits into
mainfrom
harry/handle-uv-conflicting-urls-resolution-error
Mar 13, 2026
Merged

Handle unhandled uv errors prefixed with CPython interpreter info#14433
thavaahariharangit merged 4 commits into
mainfrom
harry/handle-uv-conflicting-urls-resolution-error

Conversation

@thavaahariharangit
Copy link
Copy Markdown
Contributor

@thavaahariharangit thavaahariharangit commented Mar 13, 2026

What are you trying to accomplish?

Catch unhandled uv errors that start with Using CPython <version> interpreter at: and surface them as DependencyFileNotResolvable instead of letting them propagate as raw HelperSubprocessFailed / unknown_error.

Anything you want to highlight for special attention from reviewers?

How will you know you've accomplished your goal?

  • Unit tests: Added tests in lock_file_error_handler_spec.rb covering both error scenarios — uv conflicting URLs resolution failure and uv.lock parse failure — both prefixed with Using CPython. Tests verify the correct exception type (DependencyFileNotResolvable) is raised and that the Using CPython prefix is stripped from the error message.
  • All existing tests pass: The 30 existing handler tests continue to pass, confirming that more-specific handlers (git errors, auth errors, build failures, etc.) still take priority over the new fallback.
  • Sentry validation: After deployment, the ~1867 unknown_error events with Using CPython prefix should stop appearing and instead be recorded as dependency_file_not_resolvable, which is an expected/actionable error type.

Checklist

  • I have run the complete test suite to ensure all tests and linters pass.
  • I have thoroughly tested my code changes to ensure they work as expected, including adding additional tests for new functionality.
  • I have written clear and descriptive commit messages.
  • I have provided a detailed description of the changes in the pull request, including the problem it addresses, how it fixes the problem, and any relevant details about the implementation.
  • I have ensured that the code is well-documented and easy to understand.

@thavaahariharangit thavaahariharangit requested a review from a team as a code owner March 13, 2026 12:12
Copilot AI review requested due to automatic review settings March 13, 2026 12:12
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves uv error handling in the Uv::FileUpdater::LockFileErrorHandler by converting previously-unhandled uv helper failures that include a Using CPython ... interpreter at: prefix into a standardized DependencyFileNotResolvable, and by stripping the interpreter prefix from surfaced messages.

Changes:

  • Add a fallback handler that raises DependencyFileNotResolvable when uv errors include the Using CPython interpreter prefix.
  • Strip the Using CPython ... interpreter at: line from cleaned error messages.
  • Add spec coverage for two “Using CPython”-prefixed unhandled error scenarios (conflicting URLs + uv.lock parse failure).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
uv/lib/dependabot/uv/file_updater/lock_file_error_handler.rb Adds a CPython-prefixed fallback mapping to DependencyFileNotResolvable and strips the CPython prefix in message cleanup.
uv/spec/dependabot/uv/file_updater/lock_file_error_handler_spec.rb Adds tests ensuring CPython-prefixed unhandled errors are converted to DependencyFileNotResolvable and the prefix is removed.
Comments suppressed due to low confidence (1)

uv/lib/dependabot/uv/file_updater/lock_file_error_handler.rb:328

  • USING_CPYTHON_REGEX is introduced as a constant, but clean_error_message uses a separate hard-coded regex to strip the CPython prefix. This duplication makes it easy for the match and the stripping behavior to drift. Consider reusing the constant (or redefining it to match the whole prefix line) in both places.
        def clean_error_message(message)
          message
            .gsub(/Using CPython \S+ interpreter at: [^\n]+\n?/, "")
            .gsub(/#{Regexp.escape(Utils::BUMP_TMP_DIR_PATH)}[^\s]*/o, "")

Comment thread uv/lib/dependabot/uv/file_updater/lock_file_error_handler.rb
thavaahariharangit and others added 2 commits March 13, 2026 12:17
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@thavaahariharangit thavaahariharangit changed the title Harry/handle uv conflicting urls resolution error Handle unhandled uv errors prefixed with CPython interpreter info Mar 13, 2026
@thavaahariharangit thavaahariharangit merged commit 522121a into main Mar 13, 2026
85 checks passed
@thavaahariharangit thavaahariharangit deleted the harry/handle-uv-conflicting-urls-resolution-error branch March 13, 2026 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants