xiaobaicai66695 opened a new pull request, #3660:
URL: https://github.com/apache/dubbo-go/pull/3660
## Background
Dubbo Admin publishes v3 dynamic configuration with the rule-level YAML
field `configVersion` and optional `configs[].match` constraints. Dubbo-Go
parses that YAML into configurator URLs before `overrideConfigurator` decides
which matching semantics to use and applies parameters to consumer or provider
URLs.
The Dynamic Config E2E exposed two runtime problems in this path. A rule
could be present in Admin and ZooKeeper while the consumer either followed the
deprecated configurator path or failed when evaluating an empty match. This
made a persistence-only check insufficient and could produce a false-positive
E2E result.
## Root cause
1. The configurator read the wrong version key.
`ConfigVersionKey` belongs to the config-center component parameter
namespace and currently resolves to `config-center.configVersion`. The dynamic
rule schema and `DefaultConfigurationParser`, however, use `configVersion`. The
constant originally also contained `configVersion`, but it was namespaced
together with other config-center component keys in a historical
registry-parameter cleanup. `overrideConfigurator` kept reusing it, so standard
v3 rule URLs had no version from the configurator's perspective and fell into
the deprecated pre-2.7 path.
2. Empty or partial v3 matches dereferenced nil fields.
An omitted match or the valid YAML form `match: {}` leaves
`ConditionMatch` or its optional fields nil. `ConditionMatch.IsMatch` called
every matcher unconditionally, so the real v3 path could panic before applying
the configured parameters. A partially specified match had the same problem for
every omitted dimension.
## Why both fixes are necessary
The version-key fix is required to ensure a standard Admin v3 rule actually
executes the v3 configurator path instead of accidentally succeeding through
deprecated behavior. Once that dispatch is corrected, empty-match handling is
required for the default match-all rule emitted by Admin and for partial match
constraints.
Without both changes, the Dynamic Config E2E cannot prove the intended chain:
Admin rule -> config center data -> v3 parser/configurator -> final URL
parameters -> observable invocation behavior.
These are runtime contract fixes, not test-only accommodations. The E2E uses
load-balancing behavior for its assertion and does not require any CallOption
semantic changes.
## Changes
- Add `constant.RuleConfigVersionKey` for the rule-level `configVersion`
field, keeping it separate from config-center component keys.
- Use the rule constant consistently when parser-generated URLs are built,
when configurator versions are read, and when metadata keys are excluded from
applied parameters.
- Treat an absent or empty `ConditionMatch` as match-all and evaluate only
explicitly configured match dimensions.
- Add regression coverage for rule-version dispatch, empty match behavior,
parser output, and v3 configuration application.
## Testing
```text
go test ./config_center/parser ./config_center/configurator
./cluster/router/condition
```
--
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]