-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Fix for Edit and Delete request issue 53681 #53815
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
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)
|
|
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 |
|
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. |
|
@uranusjr ; could we take both the approaches we could restrict and for those entities already created we can avoid the error using encodeUriComponent? should we check how to put deprecation notice on this. |
pierrejeambrun
left a comment
There was a problem hiding this 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:
Fixing the 53681 issue
Bug fix/53681
removed the UI based Url Encoding
There was a problem hiding this 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?
jason810496
left a comment
There was a problem hiding this 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:
airflow/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_pools.py
Lines 34 to 35 in 7e5785d
| POOL2_NAME = "pool2" | |
| POOL2_SLOT = 10 |
Maybe replacing the original value of POOL2_NAME with pool name with / in it will be enough.
Updated the pool test cases for testing '/' in poolname
|
@pierrejeambrun @jason810496 Thanks for the update,
|
Updated the PoolName
pierrejeambrun
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice thanks.
|
Static check need fixing, we can also take the opportunity to rename |
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_pools.py
Outdated
Show resolved
Hide resolved
…into bugFix/53681
|
@pierrejeambrun
This avoids collation issues while still verifying the correct pool names are returned. |
pierrejeambrun
left a comment
There was a problem hiding this 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.
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_pools.py
Outdated
Show resolved
Hide resolved
Which test ordering was failing specifically? |
|
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
Expected Behavior (Local): Given: POOL1_NAME = "pool1", POOL2_NAME = "pool2", POOL3_NAME = "pool/3" Database sorting by name should return:
(/ sorts before alphanumeric characters in ASCII order). Issue (CI/CD):
—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:
Permanent Fix (Preferred): On reviewing other test cases such as test_variable.py, where keys include slashes:
I updated POOL3_NAME to "pool3/with_slashes". |
|
Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions. |
* 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>
) * 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>

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.rstor{issue_number}.significant.rst, in airflow-core/newsfragments.