fix issue 3453: bridge ParamFlow and Authority rules to Nacos correctly (#3453)
This pull request fixes issue #3453 by ensuring that ParamFlow and Authority rules published by Sentinel‑Dashboard to Nacos can be correctly parsed by Sentinel clients. In version 1.8.8 the dashboard’s entity classes and the core rule classes became out of sync, causing clients to fail to deserialize JSON and never load the rules.
What was changed:
- Introduced two “CorrectEntity” classes
-
ParamFlowRuleCorrectEntity -
AuthorityRuleCorrectEntity
These mirror the fields of the coreParamFlowRuleandAuthorityRuletypes exactly.
-
- Registered new FastJSON Converter beans in
NacosConfigfor-
String ↔ List<ParamFlowRuleCorrectEntity> -
String ↔ List<AuthorityRuleCorrectEntity>
-
- Added dedicated Nacos provider & publisher components for both rule types:
-
ParamFlowRuleNacosProvider/ParamFlowRuleNacosPublisher -
AuthorityRuleNacosProvider/AuthorityRuleNacosPublisher
These bridge between the CorrectEntity JSON and the original DashboardRuleEntitytypes viaBeanUtils.copyProperties.
-
Describe what this PR does / why we need it
Sentinel‑Dashboard and Sentinel clients must share a consistent JSON schema when persisting rules in Nacos. After upgrading to 1.8.8, the Dashboard’s entity definitions drifted from the core rule classes, breaking client‑side deserialization. This PR restores compatibility so that rules published via Dashboard are correctly loaded by any Sentinel client.
Does this pull request fix one issue?
Fixes #3453
Describe how you did it
- Added two “CorrectEntity” classes that exactly match the core rule classes’ fields.
- Registered FastJSON converters in
NacosConfigfor the new entity lists. - Implemented provider & publisher beans that convert between Dashboard entities and core rule types at runtime.
Describe how to verify it
- Start Sentinel‑Dashboard (v1.8.8+) and connect it to a Nacos instance.
- Create / update ParamFlow and Authority rules via the Dashboard UI.
- On a Sentinel client, load rules from Nacos and assert that:
- No JSON parsing errors occur.
- The rules take effect as expected (e.g. QPS limits and authority checks).
Special notes for reviews
- Backward compatibility is preserved: older clients (pre‑1.8.8) will still see the old JSON structure.
- No changes to other rule types or transports.
- All new classes and beans are isolated under the
sentinel-dashboardNacos extension.
Thank you for your time and feedback!
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.
Thank you for your submission! Before we can review the code, the CLA needs to be signed.
Due to this PR's inactivity and the unsigned CLA, we are temporarily closing it. Feel free to create a new PR if you still intend to contribute after addressing the CLA requirement.