yixianOu opened a new pull request, #12794:
URL: https://github.com/apache/apisix/pull/12794

   
   ### Description
   
   This PR implements dependency protocol checking and deletion protection for 
stream routes, resolving #6939.
   
   Previously, it was possible to create a subordinate stream route referencing 
a non-existent `superior_id` or a superior route with a mismatched protocol. 
Additionally, superior routes could be deleted even while being referenced by 
subordinate routes, leading to potential runtime errors.
   
   ### Checklist
   
   - [x] I have read the 
[CONTRIBUTING](https://github.com/apache/apisix/blob/master/CONTRIBUTING.md) 
guidelines.
   - [x] I have added tests to cover my changes.
   - [x] I have verified that the changes work as expected.
   
   ### Changes
   
   1.  **Dependency Checking**: Added validation in `check_conf` to ensure that 
when a `superior_id` is provided:
       -   The referenced superior route exists.
       -   The protocol of the subordinate route matches the superior route.
   2.  **Deletion Protection**: Implemented a `delete_checker` to prevent the 
deletion of a stream route if it is currently referenced as a `superior_id` by 
other routes.
   3.  **Tests**: Added a new test file `t/admin/stream-routes-subordinate.t` 
covering various scenarios including creation, protocol mismatch, and deletion 
protection.
   
   ### Related Issue
   
   Resolves #6939


-- 
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