Skip to content

[ISSUE #15160] Fix config change pointcut routing for missing srcType#15161

Merged
KomachiSion merged 1 commit into
alibaba:developfrom
Hccake:develop-issue#15160
May 20, 2026
Merged

[ISSUE #15160] Fix config change pointcut routing for missing srcType#15161
KomachiSion merged 1 commit into
alibaba:developfrom
Hccake:develop-issue#15160

Conversation

@Hccake

@Hccake Hccake commented May 15, 2026

Copy link
Copy Markdown
Contributor

Route missing config change source types to unknown pointcuts instead of treating them as RPC, and use remove pointcuts for delete operations.

Assisted-by: Codex

Please do not create a Pull Request without creating an issue first.

What is the purpose of the change

This PR fixes config-change pointcut routing when ConfigRequestInfo.srcType is missing, empty, or not recognized.
本 PR 修复 ConfigRequestInfo.srcType 缺失、为空或无法识别时的配置变更切点路由问题。

Before this change, a config change without an explicit srcType could be treated as an RPC change.
在本次修改前,没有显式 srcType 的配置变更可能会被当作 RPC 变更处理。

This can affect config-change plugins that intentionally skip RPC events.
这会影响那些有意跳过 RPC 事件的配置变更插件。

For example, when a config publish operation is triggered from the console but is classified as RPC, a file-format config-change plugin may skip validation and allow invalid config content to pass.
例如,当配置发布操作从控制台触发但被识别为 RPC 时,文件格式校验插件可能会跳过校验,导致错误配置内容被放行。

This PR also fixes delete operation routing so that delete operations use remove pointcuts instead of publish pointcuts.
本 PR 同时修正删除操作的切点路由,使删除操作使用 remove pointcut,而不是 publish pointcut。

AI-related config operation call paths are not assigned a new explicit source type in this PR.
本 PR 没有为 AI 相关配置操作调用路径新增显式来源类型。

The srcType of AI entry points is not changed in this PR.
本 PR 未调整 AI 入口的 srcType

Some AI paths currently construct an empty ConfigRequestInfo, and their caller context does not always identify a single HTTP or RPC source at that layer.
当前部分 AI 路径会构造空的 ConfigRequestInfo,并且在这些调用层级上并不总能确定单一的 HTTP 或 RPC 来源。

These paths remain unclassified instead of being treated as RPC.
这些路径保持未分类状态,而不是被当作 RPC 处理。

Brief changelog

  • Add unknown config-change pointcut types for unclassified publish and delete operations.

  • 为未分类的发布和删除操作增加 unknown 配置变更切点类型。

  • Route missing, empty, or unrecognized srcType values to unknown pointcuts instead of RPC pointcuts.

  • 将缺失、为空或无法识别的 srcType 路由到 unknown pointcut,而不是 RPC pointcut。

  • Route delete operations to remove pointcuts.

  • 将删除操作路由到 remove pointcut。

  • Set HTTP srcType in HTTP config publish entry points.

  • 在 HTTP 配置发布入口设置 HTTP srcType

  • Add unit tests for RPC, HTTP remove, and unknown source routing behavior.

  • 为 RPC、HTTP 删除以及 unknown 来源路由行为增加单元测试。

Verifying this change

The following checks were run locally:
本地已执行以下检查:

.\mvnw -q -pl config -am '-Dtest=ConfigChangeAspectTest' '-Dsurefire.failIfNoSpecifiedTests=false' test
.\mvnw -q -pl plugin/config,config,console,ai -am -DskipTests compile
git diff --check

The full test suite was not completed locally because some tests in this repository are written for Unix-like environments and cannot pass in my local Windows environment.
本地没有完整执行全部 test suite,因为仓库中部分测试按类 Unix 环境编写,在我的 Windows 本地环境中无法通过。

Follow this checklist to help us incorporate your contribution quickly and easily:

  • Make sure there is a Github issue filed for the change (usually before you start working on it). Trivial changes like typos do not require a Github issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
  • Format the pull request title like [ISSUE #123] Fix UnknownException when host config not exist. Each commit in the pull request should have a meaningful subject line and body.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add integration-test in test module.
  • Run mvn -B clean package apache-rat:check spotbugs:check -DskipTests to make sure basic checks pass. Run mvn clean install to make sure unit-test pass. Run mvn clean test-compile failsafe:integration-test to make sure integration-test pass.

@github-actions

Copy link
Copy Markdown

Thanks for your this PR. 🙏
Please check again for your PR changes whether contains any usage/api/configuration change such as Add new API , Add new configuration, Change default value of configuration.
If so, please add or update documents(markdown type) in docs/next/ for repository nacos-group/nacos-group.github.io


感谢您提交的PR。 🙏
请再次查看您的PR内容,确认是否包含任何使用方式/API/配置参数的变更,如:新增API新增配置参数修改默认配置等操作。
如果是,请确保在提交之前,在仓库nacos-group/nacos-group.github.io中的docs/next/目录下添加或更新文档(markdown格式)。

@Hccake
Hccake force-pushed the develop-issue#15160 branch from 296a426 to bafb1a4 Compare May 18, 2026 04:54
Comment thread core/src/main/java/com/alibaba/nacos/core/context/RequestContextHolder.java Outdated
@Hccake
Hccake force-pushed the develop-issue#15160 branch from bafb1a4 to e69b3b0 Compare May 19, 2026 03:43
Comment thread core/src/main/java/com/alibaba/nacos/core/context/RequestContextHolder.java Outdated
@Hccake
Hccake force-pushed the develop-issue#15160 branch 2 times, most recently from ba8afd7 to 534c0e8 Compare May 19, 2026 14:37
KomachiSion
KomachiSion previously approved these changes May 20, 2026
@KomachiSion

Copy link
Copy Markdown
Collaborator

Error: config] [ERROR] Failures:
Error: config] [ERROR] ConfigChangeAspectTest.testRemoveConfigByIdWithRpcType:438 expected: <PUBLISH_BY_RPC> but was: <REMOVE_BY_HTTP>
[nacos-config] [INFO]
Error: config] [ERROR] Tests run: 1569, Failures: 1, Errors: 0, Skipped: 0

这个单测没有过,好像是你修改的部分,麻烦再看一下

@Hccake

Hccake commented May 20, 2026

Copy link
Copy Markdown
Contributor Author

Error: config] [ERROR] Failures: Error: config] [ERROR] ConfigChangeAspectTest.testRemoveConfigByIdWithRpcType:438 expected: <PUBLISH_BY_RPC> but was: <REMOVE_BY_HTTP> [nacos-config] [INFO] Error: config] [ERROR] Tests run: 1569, Failures: 1, Errors: 0, Skipped: 0

这个单测没有过,好像是你修改的部分,麻烦再看一下

看到了,是昨天别人新增的一个测试用例,合并代码的适合漏处理了,已修改

…srcType

Route missing config change source types to unknown pointcuts instead of treating them as RPC, and use remove pointcuts for delete operations.

Assisted-by: Codex
@Hccake
Hccake force-pushed the develop-issue#15160 branch from 56831d1 to 61c0ff8 Compare May 20, 2026 04:13
@Hccake

Hccake commented May 20, 2026

Copy link
Copy Markdown
Contributor Author

RequestContextHolder 没有清理协议,导致多个测试用例之间的环境污染,影响测试结果。重新在单测开始和结束中添加了RequestContextHolder 的清理操作

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.00000% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...nacos/config/server/aspect/ConfigChangeAspect.java 94.44% 0 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

@KomachiSion
KomachiSion merged commit f57d43b into alibaba:develop May 20, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ConfigChangeAspect may misclassify console config changes as RPC when srcType is missing

3 participants