Skip to content

Conversation

@yixianOu
Copy link

@yixianOu yixianOu commented Dec 6, 2025

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

  • I have read the CONTRIBUTING guidelines.
  • I have added tests to cover my changes.
  • 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

Sign-off

Signed-off-by: Orician [email protected]

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request labels Dec 6, 2025
@yixianOu yixianOu changed the title feat: Add dependency protocol checking and deletion checking for stre… feat: Add dependency protocol checking and deletion checking for stream routing Dec 6, 2025
…eanup. Fixed status code check in pingpong test to ensure correct error message is output when 400 error is returned

1. Update TEST 15 to expect 400 when creating a route with a non-existent superior_id, reflecting the new validation logic.
2. Add TEST 22 to clean up created stream routes after tests to prevent Etcd data pollution affecting subsequent tests (e.g., redis.t).

Signed-off-by: Orician <[email protected]>
@yixianOu
Copy link
Author

yixianOu commented Dec 8, 2025

Modified t/xrpc/pingpong.t to expect a 400 error code when creating the route with superior_id = 10000. This aligns the test with the new validation logic.
Added cleanup test to avoid residual configuration in etcd affecting subsequent redis tests.
For mcp-bridge testing, I don't know how to fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: As a user, I want to check the subordinate relationship in the Admin API

1 participant