Copilot commented on code in PR #3251:
URL: https://github.com/apache/dubbo-go/pull/3251#discussion_r2935075491


##########
cluster/router/tag/router.go:
##########
@@ -52,8 +52,8 @@ func (p *PriorityRouter) Route(invokers []base.Invoker, url 
*common.URL, invocat
                logger.Warnf("[tag router] invokers from previous router is 
empty")
                return invokers
        }
-       // get prefix from invoker
-       application := invokers[0].GetURL().GetParam(constant.Tagkey, "")
+       // get application name from invoker to look up tag routing config
+       application := invokers[0].GetURL().GetParam(constant.ApplicationKey, 
"")
        key := strings.Join([]string{application, 
constant.TagRouterRuleSuffix}, "")

Review Comment:
   The fix changes the config lookup key to use `constant.ApplicationKey`, but 
there isn’t a unit test that would have caught the previous regression (tests 
for `Route` don’t set an application on the invoker URL and don’t assert that a 
router config stored under `<application> + TagRouterRuleSuffix` is loaded). 
Add/adjust a `Route` test to set 
`invokers[0].GetURL().SetParam(constant.ApplicationKey, ...)`, store 
`p.routerConfigs` under that derived key, and assert `Route` takes the dynamic 
path (i.e., returns the expected filtered invokers).



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to