-
Notifications
You must be signed in to change notification settings - Fork 804
fix(nacos-starter): auto-configurations should be opt-in (matchIfMissing=false) and fix A2A server-addr override #1709
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,7 +54,7 @@ | |
| prefix = NacosConstants.A2A_NACOS_PREFIX, | ||
| name = "enabled", | ||
| havingValue = "true", | ||
| matchIfMissing = true) | ||
| matchIfMissing = false) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [critical] Changing All positive test cases must be updated to add Example fix for .withPropertyValues(
"agentscope.a2a.nacos.enabled=true",
"agentscope.a2a.nacos.discovery.enabled=true",
"agentscope.a2a.nacos.registry.enabled=true",
"agentscope.a2a.nacos.server-addr=127.0.0.1:8848",
"agentscope.a2a.nacos.namespace=public") |
||
| public class AgentscopeA2aNacosAutoConfiguration implements Closeable { | ||
|
|
||
| private static final Logger log = | ||
|
|
@@ -81,7 +81,7 @@ private AiService a2aService( | |
| AgentScopeA2aNacosProperties a2aNacosProperties) | ||
| throws NacosException { | ||
| Properties nacosClientProperties = nacosProperties.getNacosProperties(); | ||
| nacosClientProperties.putAll(a2aNacosProperties.getNacosProperties()); | ||
| nacosClientProperties.putAll(a2aNacosProperties.getExplicitNacosProperties()); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [praise] Good fix. Using
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [praise] Good fix. Using |
||
| return AiFactory.createAiService(nacosClientProperties); | ||
| } | ||
|
|
||
|
|
@@ -112,7 +112,7 @@ public void close() throws IOException { | |
| prefix = NacosConstants.A2A_NACOS_DISCOVERY_PREFIX, | ||
| name = "enabled", | ||
| havingValue = "true", | ||
| matchIfMissing = true) | ||
| matchIfMissing = false) | ||
| public AgentCardResolver nacosAgentCardResolver() { | ||
| return new NacosAgentCardResolver(a2aService); | ||
| } | ||
|
|
@@ -128,7 +128,7 @@ public AgentCardResolver nacosAgentCardResolver() { | |
| prefix = NacosConstants.A2A_NACOS_REGISTRY_PREFIX, | ||
| name = "enabled", | ||
| havingValue = "true", | ||
| matchIfMissing = true) | ||
| matchIfMissing = false) | ||
| public AgentRegistry nacosAgentRegistry(AgentScopeA2aNacosProperties a2aNacosProperties) { | ||
| return NacosAgentRegistry.builder(a2aService) | ||
| .nacosA2aProperties(buildNacosA2aProperties(a2aNacosProperties)) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[critical] Changing
matchIfMissingtofalseis correct for the production code, but at least 10 existing tests inAgentscopeA2aNacosAutoConfigurationTestwill break because they never setagentscope.a2a.nacos.enabled=true. Tests likeshouldCreateDefaultBeansWhenEnabled,shouldCreateNacosAgentCardResolverBean,shouldCreateNacosAgentRegistryBean,shouldNotCreateNacosAgentCardResolverWhenDiscoveryDisabled,shouldNotCreateNacosAgentRegistryWhenRegistryDisabled,shouldBindNacosProperties,shouldCreateWithCustomAgentCardResolver,shouldCreateWithCustomAgentRegistry,shouldCreateBeansWithRegistryProperties,shouldCreateBeansWithDiscoveryProperties, andshouldCloseNacosServiceOnShutdownall rely on the oldmatchIfMissing=truebehavior.All positive test cases must be updated to add
agentscope.a2a.nacos.enabled=true. Additionally, tests that expectAgentCardResolverorAgentRegistrybeans must also setagentscope.a2a.nacos.discovery.enabled=trueand/oragentscope.a2a.nacos.registry.enabled=truerespectively, since those bean-level conditions also changed tomatchIfMissing=false.Example fix for
shouldCreateDefaultBeansWhenEnabled: