af: strip query string from airflow_url so version detection works#210
Merged
af: strip query string from airflow_url so version detection works#210
Conversation
Stored URLs with a query string (eg the ?orgId=… that some Astro
deployments include in metadata.webserver_url) silently broke every
API call: building URLs via f"{airflow_url}/api/v2/version" left the
path at /dep and pushed /api/... into the query string. The 200/HTML
or redirect that came back was swallowed by detect_version's bare
except, surfacing only "Failed to detect Airflow version".
Normalize the base URL (strip query, fragment, trailing slash) at
three boundaries so existing bad configs keep working without
re-discovery: detect_version on entry, the adapter base __init__,
and AstroDeployment.from_inspect_yaml during discovery. Also surface
the actual probe failure (status code or exception) in the
RuntimeError so the next opaque report isn't a black box.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
jlaneve
approved these changes
May 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Failed to detect Airflow version at https://…/<deploymentid>?orgId=org_…. Ensure Airflow is running and accessible.fromaf config version(and every otherafcommand). Reproduced against an Astro deployment by appending?orgId=…to the stored URL.metadata.webserver_urlfromastro deployment inspectcame back with a?orgId=…query string for that deployment. We stored it as-is, then built API URLs viaf"{airflow_url}/api/v2/version"— the result left the path at/depand pushed/api/...into the query string. Server returned a 200/HTML redirect, JSON parse failed, anddetect_version's bareexcept Exception: passswallowed it.detect_versionon entry, the adapter base__init__, andAstroDeployment.from_inspect_yamlduring discovery. Existing bad configs keep working without forcing users to re-discover.RuntimeErrorfromdetect_versionnow includes the actual status code (or exception) from each probe, so the next opaque report won't be a black box.Test plan
detect_versionstrips a?orgId=…query string before probing and returns the version.detect_versionsurfaces actual HTTP status codes in the failure message.AirflowV2Adapter.__init__normalizes a URL with a query string.AstroDeployment.from_inspect_yamlstrips the query string fromwebserver_url.normalize_airflow_urlhandles query, fragment, trailing slash, empty, clean URLs.pytestsuite (566 tests) passes.?orgId=…,af config versionpreviously returned"Failed to detect Airflow version at …"and now returns the actual version JSON.🤖 Generated with Claude Code