Repository navigation
feat(declarative): expose request_url to HttpResponseFilter error_message and predicate - #1229
Conversation
…essage and predicate A filter's error_message and predicate could only interpolate the config, the parsed response body and the response headers. When the body does not identify the resource (a bare 404, for example), the message cannot say which partition was skipped, and setting error_message on an IGNORE filter also replaces the CDK's own log line that carried the URL. request_url is the URL of the response with the query string and any userinfo removed, since some APIs authenticate through a query parameter and an error message can reach a user-facing failure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s edge cases - Say that the query string, fragment and userinfo are removed and the path is kept, in the schema and the HttpResponseFilter docstring. - Match the YAML order of the predicate examples in the generated model. - Test a port, an IPv6 host and a response without a URL. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…esponses HttpResponseFilter runs on every response, including successful pages, so a predicate that checks only the URL matches every 200 of that stream. Pair the example with an error-body condition and assert in the test that a successful page does not match. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ects requests follows redirects, so `request_url` reflects the last hop rather than the URL the requester built (for example, GitHub redirects renamed repositories to /repositories/<id>/...). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
👋 Greetings, Airbyte Team Member!Here are some helpful tips and reminders for your convenience. 💡 Show Tips and TricksTesting This CDK VersionYou can test this version of the CDK using the following: # Run the CLI from this branch:
uvx 'git+https://github.com/airbytehq/airbyte-python-cdk.git@tolik0/http-response-filter-request-url#egg=airbyte-python-cdk[dev]' --help
# Update a connector to use the CDK from this branch ref:
cd airbyte-integrations/connectors/source-example
poe use-cdk-branch tolik0/http-response-filter-request-urlPR Slash CommandsAirbyte Maintainers can execute the following slash commands on your PR:
|
PyTest Results (Fast)5 754 tests +6 5 723 ✅ +5 11m 55s ⏱️ -15s Results for commit acb3e61. ± Comparison against base commit 2082c2d. This pull request skips 1 test. |
PyTest Results (Full)5 757 tests +6 5 726 ✅ +5 16m 51s ⏱️ -9s Results for commit acb3e61. ± Comparison against base commit 2082c2d. This pull request skips 1 test. |
|
/prerelease
|
What
HttpResponseFiltercan now userequest_urlin itserror_messageandpredicateinterpolation, alongsideresponseandheaders(andconfigforerror_message).request_urlis the URL of the response: the final URL after any redirects, with the query string, fragment and userinfo (user:password@) removed. The path is kept as-is, so it should not be surfaced for APIs that put a credential in the path. It is an empty string when the response has no URL.Why
A custom
error_messagereplaces the default "Ignoring response for '' request to ''" log line on IGNORE, so a skip message today cannot say which partition was skipped. Connectors that need this (for example, source-github's stargazers skip after GitHub restricted listing stargazers to collaborators) currently need aCustomErrorHandlersubclass just to put the repository in the message. With this change it becomes:The query string is dropped because some APIs authenticate with a query parameter, and an error message can end up in a user-facing failure.
Changes
http_response_filter.py: new_request_url(response)helper, passed asrequest_urlto both theerror_messageandpredicateevaluations.declarative_component_schema.yaml:request_urladded to both fields'interpolation_context, new examples, and a documentedrequest_urlentry in the interpolation variables.declarative_component_schema.py: examples mirrored by hand. The generator needs dagger, and onlyexampleschanged.Compatibility
This is additive. Interpolation kwargs are local to these two evaluations, so a config key named
request_urlis still reached asconfig['request_url'], and no existing manifest changes behavior.Testing
unit_tests/sources/declarative/requesters/error_handlers: 156 passedruff format --check,ruff checkandmypyare clean on the changed files🤖 Generated with Claude Code