Skip to content

Conversation

@mandeepzemo
Copy link
Contributor

@mandeepzemo mandeepzemo commented Jul 28, 2025

closes: #53681


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.

@boring-cyborg
Copy link

boring-cyborg bot commented Jul 28, 2025

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our pre-commits will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

@boring-cyborg boring-cyborg bot added area:API Airflow's REST/HTTP API area:UI Related to UI/UX. For Frontend Developers. labels Jul 28, 2025
@jscheffl
Copy link
Contributor

jscheffl commented Jul 28, 2025

Did we also consider to restrict pool names to use a "/" character? Like we did with run_ids? I assume there might be a bit more places like variables where the same problem applies?

closes: #53681

@uranusjr
Copy link
Member

We could consider banning slashes altogether, but it’d cause too much breakage we need a long deprecation period, and a fix like this would be required in the meantime anyway.

As a side, this will not only affect slashes, but also some percent usages that may be unintentionally identified as escape sequences. This should have a significant newsfragment calling out potential incompatibilities.

@akshayvijayjain
Copy link

@uranusjr ;
I am not directly working on task, just overviewing with @mandeepzemo , please excuse if I do oversight.

could we take both the approaches

we could restrict create request from using \ or other chars; using a valid regular expression for identifier https://stackoverflow.com/questions/14953861/representing-identifiers-using-regular-expression

and for those entities already created we can avoid the error using encodeUriComponent?

should we check how to put deprecation notice on this.

Copy link
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

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

We don't need to do that to handle / in pool name. Pool is an easy resource to fix because there is no 'action' define under pools/{pool_name}/some_action.

So we can just use the starlette path convertor:

@pools_router.patch(
    "/{pool_name:path}",
    responses=create_openapi_http_exception_doc(
        [
            status.HTTP_400_BAD_REQUEST,
            status.HTTP_404_NOT_FOUND,
        ]
    ),
    dependencies=[Depends(requires_access_pool(method="PUT")), Depends(action_logging())],
)
def patch_pool(
    pool_name: str,
    patch_body: PoolPatchBody,
    session: SessionDep,
    update_mask: list[str] | None = Query(None),
) -> PoolResponse:
Screenshot 2025-08-01 at 18 16 57

@mandeepzemo
Copy link
Contributor Author

@jscheffl As taken refer from variables and updated the pool routes code for PATCH, DELETE and GET Methods
#53815

Copy link
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

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

Can you add a small test that edit or retrieve a pool that has a / in its name please?

Copy link
Member

@jason810496 jason810496 left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

Can you add a small test that edit or retrieve a pool that has a / in its name please?

FYI:

POOL2_NAME = "pool2"
POOL2_SLOT = 10

Maybe replacing the original value of POOL2_NAME with pool name with / in it will be enough.

@mandeepzemo
Copy link
Contributor Author

mandeepzemo commented Aug 5, 2025

@pierrejeambrun @jason810496 Thanks for the update,
Updated the test cases for testing Pool Name with '/'.
And Also sharing the local test result below.
Please also let me know, if any other changes need to update.

image

Copy link
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

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

Nice thanks.

@pierrejeambrun pierrejeambrun added this to the Airflow 3.0.5 milestone Aug 6, 2025
@pierrejeambrun
Copy link
Member

Static check need fixing, we can also take the opportunity to rename POOL3_NAME = "test/3" to POOL3_NAME = "pool/3". (pool1 and pool2 are named pool1 and pool2)

@pierrejeambrun pierrejeambrun added the backport-to-v3-1-test Mark PR with this label to backport to v3-1-test branch label Aug 7, 2025
@mandeepzemo
Copy link
Contributor Author

@pierrejeambrun
The pool list ordering test was passing locally but failing in CI/CD due to locale-dependent sorting of POOL3_NAME = "pool/3". To make the result consistent across environments, I updated the assertion to compare sorted lists in Python:

assert sorted([pool["name"] for pool in body["pools"]]) == sorted(expected_ids)

This avoids collation issues while still verifying the correct pool names are returned.

Copy link
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

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

We need to investigate, that's not normal and not the correct approach. Returned items of the API should be ordred in a deterministic way. This is what is happening for all endpoints and this test shouldn't differ.

Something might be wrong.

@pierrejeambrun
Copy link
Member

failing in CI/CD due to locale-dependent sorting of POOL3_NAME = "pool/3"

Which test ordering was failing specifically?

@mandeepzemo
Copy link
Contributor Author

mandeepzemo commented Aug 8, 2025

@pierrejeambrun

In test_pool.py (lines 186–195), the test checks if the /pools endpoint returns the pool list in the expected order when using the order_by=name query param.

Example

assert [pool["name"] for pool in body["pools"]] == expected_ids

Expected Behavior (Local):

Given: POOL1_NAME = "pool1", POOL2_NAME = "pool2", POOL3_NAME = "pool/3"

Database sorting by name should return:

["pool/3", "pool2", "pool1"]

(/ sorts before alphanumeric characters in ASCII order).

Issue (CI/CD):
In CI runs, the same query returns:

["pool1", "pool2", "pool/3"]

—indicating sorting behavior differs between the local environment and the CI environment (likely due to DB collation or locale settings). Logs

Resolution Founded

Initial Fix:

To make the test consistent across environments, I changed the assertion to compare sorted lists:

assert sorted([pool["name"] for pool in body["pools"]]) == sorted(expected_ids)

Permanent Fix (Preferred):

On reviewing other test cases such as test_variable.py, where keys include slashes:

TEST_VARIABLE_KEY = "test_variable_key" TEST_VARIABLE_KEY4 = "test_variable_key/with_slashes"

I updated POOL3_NAME to "pool3/with_slashes".
This makes the sorting order deterministic across environments and removes the need for the sorted() workaround entirely.

@pierrejeambrun pierrejeambrun merged commit 0caa87b into apache:main Aug 8, 2025
103 checks passed
@boring-cyborg
Copy link

boring-cyborg bot commented Aug 8, 2025

Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions.

github-actions bot pushed a commit that referenced this pull request Aug 8, 2025
* Fix for Edit and Delete request

* updated the pool outes by adding path
Fixing the 53681 issue

* removed the UI based Url Encoding

* Updated the pool test cases for testing '/' in poolname

* Updated the PoolName

* updated poolName in testcase

* Faile testcase Resolved

* fix(tests): make pool list ordering test locale-independent

* Fix pool ordering test inconsistency across environments

* Removed Sorted Comparision
(cherry picked from commit 0caa87b)

Co-authored-by: mandeepzemo <mandeep.jaswal@zemosolabs.com>
@github-actions
Copy link

github-actions bot commented Aug 8, 2025

Backport successfully created: v3-0-test

Status Branch Result
v3-0-test PR Link

potiuk pushed a commit that referenced this pull request Aug 8, 2025
)

* Fix for Edit and Delete request

* updated the pool outes by adding path
Fixing the 53681 issue

* removed the UI based Url Encoding

* Updated the pool test cases for testing '/' in poolname

* Updated the PoolName

* updated poolName in testcase

* Faile testcase Resolved

* fix(tests): make pool list ordering test locale-independent

* Fix pool ordering test inconsistency across environments

* Removed Sorted Comparision
(cherry picked from commit 0caa87b)

Co-authored-by: mandeepzemo <mandeep.jaswal@zemosolabs.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:API Airflow's REST/HTTP API area:UI Related to UI/UX. For Frontend Developers. backport-to-v3-1-test Mark PR with this label to backport to v3-1-test branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot edit or delete pools with "/" in the name in the UI

6 participants