codewithsruthi opened a new pull request, #72753:
URL: https://github.com/apache/airflow/pull/72753

   ## Summary
   
   ### What this is about
   
   The Airflow UI builds documentation links by interpolating the running 
Airflow version into 
`https://airflow.apache.org/docs/apache-airflow/<version>/...`. That works 
after a version has been released and its docs are published. It does **not** 
work on `main` or other unreleased builds.
   
   On current `main`, `__version__` is already `3.4.0`, but 
`https://airflow.apache.org/docs/apache-airflow/3.4.0/` is a 404 because 3.4.0 
has not been released. The same happens for pre-release strings such as 
`3.4.0.dev0` or `3.4.0rc1`. Users who click **Docs** in the nav, or the 
connections empty-state “learn more” link, land on a broken page.
   
   This is [issue #64541](https://github.com/apache/airflow/issues/64541). The 
`target="blank"` typo mentioned in that issue was already fixed in #64542. Two 
later PRs (#64830, #67409) tried the version fallback and were closed; this PR 
takes a different approach that avoids their heuristics (`endsWith(".0")`, 
importing RST into a React component).
   
   ### Why we are doing this
   
   Airflow bumps `__version__` to the *next* final `X.Y.Z` before that 
version’s docs exist on airflow.apache.org. Suffix-only detection (looking for 
`dev` / `a` / `b`) misses the common case: a clean `3.4.0` on main. Help links 
should always resolve. Released installs (`3.3.1`, `3.2.0`, …) should still get 
version-specific docs so they are not jumped to a newer docs set.
   
   Python `get_docs_url()` had the same hole: it only special-cased substring 
matches and pointed those at an unofficial HTTP S3 staging URL. CLI and config 
error messages that use it would also 404 for current main.
   
   ### How we did it
   
   A version is treated as unpublished when it is missing, not a final PEP 440 
`X.Y.Z`, or **newer than the latest published 3.x patch** in 
`SUPPORTED_VERSIONS` (today `3.3.1`). Those cases use official `stable` docs. 
Older published versions keep their versioned URL.
   
   - The existing `supported_versions` prek hook now writes that latest 
published version into:
     - a generated UI constant, `LATEST_PUBLISHED_AIRFLOW_VERSION`
     - a marked block in `airflow.utils.docs` (no new `airflow.utils` module)
   - The UI helper `getAirflowDocsUrl()` uses that constant. `DocsButton` and 
the connections empty state call it. The visible version label is unchanged; 
only the href falls back.
   - Python `get_docs_url()` uses the same unpublished rule and the official 
HTTPS `stable` URL.
   
   closes: #64541
   
   ## Test plan
   
   - [x] `pnpm test src/utils/links.test.ts src/layouts/Nav/DocsButton.test.tsx 
src/pages/Connections/NothingFoundInfo.test.tsx` (64 passed)
   - [x] `pytest airflow-core/tests/unit/utils/test_docs.py 
scripts/tests/ci/prek/test_supported_versions.py` (9 passed)
   - [ ] On an unreleased build (`3.4.0` / `.dev0` / `rc`), open the nav Docs 
menu and confirm the version item goes to `/stable/index.html` and still shows 
the raw version as the label
   - [ ] On a released version (`3.3.1` or `3.2.0`), confirm the same item 
still goes to `/<version>/index.html`
   - [ ] Connections empty state: unpublished version → stable connection 
howto; published version → versioned howto
   - [ ] Confirm `prek run update-supported-versions` keeps the generated UI 
constant and the `docs.py` marker in sync when `SUPPORTED_VERSIONS` is bumped
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Cursor Grok 4.6
   
   Generated-by: Cursor Grok 4.6 following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   
   
   Made with [Cursor](https://cursor.com)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to