Aias00 commented on PR #6530:
URL: https://github.com/apache/shenyu/pull/6530#issuecomment-5193385623

   Clean defensive fix — adding `@Existed(provider = 
DiscoveryHandlerMapper.class)` on `discoveryHandlerId` rejects invalid handler 
ids at the validation boundary instead of persisting broken rows (the #6466 
root cause). Two things worth confirming:
   
   Is the validation actually exercised on every write path that can persist a 
`DiscoveryUpstreamDTO`? `@Existed` is a bean-validation annotation, so it only 
fires when the DTO passes through a `@Valid` controller method (or a 
programmatic `Validator` call). The config-import path in 
`DiscoveryUpstreamServiceImpl.importData(...)` takes DTOs and inserts them 
directly — if that path doesn't go through bean validation, the annotation 
won't catch broken imports there, and the `getOrDefault(id, id)` guard from 
#6532 remains the only protection on that flow. Worth a note on which paths are 
covered.
   
   No test (the body's "submit test cases" checkbox is unchecked). A test 
passing a non-existent `discoveryHandlerId` through a `@Valid` endpoint and 
asserting a validation failure would pin the behavior.
   


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