Description
When a peer is deleted via the API, applications associated with that peer remain in the system and are not automatically cleaned up.
Steps to Reproduce
- Delete a peer using the API:
curl -X DELETE -u $WORMHOLE_USERNAME:$WORMHOLE_PASSWORD http://localhost:8082/api/peers/v1/client-infra
- Query the apps API:
curl -X GET -u $WORMHOLE_USERNAME:$WORMHOLE_PASSWORD http://localhost:8082/api/apps/v1 | jq | grep -C 5 client-infra
Expected Behavior
After deleting a peer, all applications associated with that peer should be automatically removed from the system.
Actual Behavior
Applications associated with the deleted peer remain in the system:
{
"name": "enemy-agent",
"address": "client-infra-enemy-agent.blafry-wormhole:80",
"peer": "client-infra",
"originalPort": 80,
"targetLabels": ""
},
{
"name": "opa",
"address": "client-infra-opa.blafry-wormhole:8080",
"peer": "client-infra",
"originalPort": 8080,
"targetLabels": ""
},
{
"name": "adpp",
"address": "client-infra-adpp.blafry-wormhole:8080",
"peer": "client-infra",
"originalPort": 8080,
"targetLabels": ""
}
Impact
This creates orphaned application entries that reference a non-existent peer, potentially causing:
- Data inconsistency
- Confusion when listing applications
- Possible errors when attempting to use these orphaned apps
Proposed Solution
Implement cascade deletion: when a peer is deleted, autopatically delete all associated applications or add a cleanup mechanism to handle orphaned apps.
Description
When a peer is deleted via the API, applications associated with that peer remain in the system and are not automatically cleaned up.
Steps to Reproduce
Expected Behavior
After deleting a peer, all applications associated with that peer should be automatically removed from the system.
Actual Behavior
Applications associated with the deleted peer remain in the system:
{ "name": "enemy-agent", "address": "client-infra-enemy-agent.blafry-wormhole:80", "peer": "client-infra", "originalPort": 80, "targetLabels": "" }, { "name": "opa", "address": "client-infra-opa.blafry-wormhole:8080", "peer": "client-infra", "originalPort": 8080, "targetLabels": "" }, { "name": "adpp", "address": "client-infra-adpp.blafry-wormhole:8080", "peer": "client-infra", "originalPort": 8080, "targetLabels": "" }Impact
This creates orphaned application entries that reference a non-existent peer, potentially causing:
Proposed Solution
Implement cascade deletion: when a peer is deleted, autopatically delete all associated applications or add a cleanup mechanism to handle orphaned apps.