Skip to content

Catch agnostic HTTP error types in prefect and swap the pagination raise#24284

Draft
mwdd146980 wants to merge 1 commit into
mwdd146980/httpx-migration-basefrom
mwdd146980/w1b-prefect
Draft

Catch agnostic HTTP error types in prefect and swap the pagination raise#24284
mwdd146980 wants to merge 1 commit into
mwdd146980/httpx-migration-basefrom
mwdd146980/w1b-prefect

Conversation

@mwdd146980

@mwdd146980 mwdd146980 commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Widens PrefectClient.http_exceptions to admit the backend-agnostic HTTP error types alongside the existing requests ones, and swaps the InvalidURL raise in check_pagination_url to the agnostic HTTPInvalidURLError. Mirrors the widened tuple into the mock_prefect_client test fixture.

Motivation

Part of the requests to httpx migration (W1b workstream). Production funnels every HTTP call through the single self.http_exceptions tuple, so widening it repairs all eight catch sites at once. The check_pagination_url raise is the one production behavior change in this PR: it must be swapped together with the tuple widening, since the raised value is caught by that same tuple, decoupling them would produce an unhandled exception rather than a clean test failure.

No observable behavior change under the default requests backend: the logged message text is identical either way and the exception never surfaces past the internal catch.

Verification

Red-then-green on test_paginate_events_rejects_external_next_page: swapping only the test assertion first produced a clean AssertionError (the requests InvalidURL is not an HTTPInvalidURLError), confirming the right red before the paired production edit landed. ddev test prefect passes all 5 unit tests, ddev test -fs prefect is clean, and no requests reference remains in tests/test_unit.py.

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Add qa/required if this PR needs QA validation, or qa/skip-qa if it does not. Exactly one of the two is required.
  • If you need to backport this PR to another branch, you can add the backport/<branch-name> label to the PR and it will automatically open a backport PR once this one is merged

Widen PrefectClient.http_exceptions to admit the backend-agnostic HTTP
error types alongside the requests ones, and raise HTTPInvalidURLError
instead of requests' InvalidURL from check_pagination_url so the check
stays correct after the httpx migration.
@datadog-datadog-us1-prod

datadog-datadog-us1-prod Bot commented Jul 1, 2026

Copy link
Copy Markdown

Pipelines  Tests  Code Coverage

Fix all issues with BitsAI

⚠️ Warnings

🚦 3 Pipeline jobs failed

PR | test / test-minimum-base-package (linux, ubuntu-22.04, prefect, Prefect (py3.13-3.6.17), py3.13-3.6.17) / minimum-base-package-Prefect (py3.13-3.6.17)-py3.13-3.6.17   View in Datadog   GitHub Actions

Validate repository | Run Validations / Validate   View in Datadog   GitHub Actions

PR | test / check   View in Datadog   GitHub Actions

ℹ️ Info

No other issues found (see more)

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 88.21% (+0.07%)

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: bdb07a1 | Docs | Datadog PR Page | Give us feedback!

@mwdd146980 mwdd146980 added the qa/skip-qa Automatically skip this PR for the next QA label Jul 1, 2026
@dd-octo-sts

dd-octo-sts Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Validation Report

Validation Description Status
dep Verify dependency pins are consistent and Agent-compatible

Run ddev validate all changed --fix to attempt to auto-fix supported validations.

Passed validations (20)
Validation Description Status
agent-reqs Verify check versions match the Agent requirements file
ci Validate CI configuration and code coverage settings
codeowners Validate every integration has a CODEOWNERS entry
config Validate default configuration files against spec.yaml
http Validate integrations use the HTTP wrapper correctly
imports Validate check imports do not use deprecated modules
integration-style Validate check code style conventions
jmx-metrics Validate JMX metrics definition files and config
labeler Validate PR labeler config matches integration directories
legacy-signature Validate no integration uses the legacy Agent check signature
license-headers Validate Python files have proper license headers
licenses Validate third-party license attribution list
metadata Validate metadata.csv metric definitions
models Validate configuration data models match spec.yaml
openmetrics Validate OpenMetrics integrations disable the metric limit
package Validate Python package metadata and naming
qa-label Validate the pull request declares whether it needs QA for the next Agent release
readmes Validate README files have required sections
saved-views Validate saved view JSON file structure and fields
version Validate version consistency between package and changelog

View full run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration/prefect qa/skip-qa Automatically skip this PR for the next QA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant