This is an automated email from the ASF dual-hosted git repository.
lizhimins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-dashboard.git
The following commit(s) were added to refs/heads/master by this push:
new 617136326 fix(topic): stop rendering a provider-absent comparison
value as the token null (#5946)
617136326 is described below
commit 6171363260aa27bf45a3ad7c68a2e52c4c52c422
Author: 烤化の初雪 <[email protected]>
AuthorDate: Fri Nov 27 12:17:12 2026 +0800
fix(topic): stop rendering a provider-absent comparison value as the token
null (#5946)
---
web/src/utils/topicConfigComparison.test.ts | 14 ++++++++++++++
web/src/utils/topicConfigComparison.ts | 9 ++++++++-
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/web/src/utils/topicConfigComparison.test.ts
b/web/src/utils/topicConfigComparison.test.ts
index c66e7845a..971722796 100644
--- a/web/src/utils/topicConfigComparison.test.ts
+++ b/web/src/utils/topicConfigComparison.test.ts
@@ -107,6 +107,20 @@ describe('compareTopicInventories', () => {
expect(compareTopicInventories([source],
[target]).rows[0].status).toBe('MATCH');
});
+ it('does not report a provider-absent value as the JS null token', () => {
+ // The Apache provider serializes `namespace: null`, a Tencent one can
answer "" for the same
+ // topic; both mean "no namespace" and must neither drift nor print the
token null.
+ const source = topic('orders', { namespace: null as unknown as string });
+ const target = topic('orders', { namespace: '' });
+
+ const match = compareTopicInventories([source], [target]);
+ expect(match.rows[0].status).toBe('MATCH');
+
+ const drift = compareTopicInventories([source], [topic('orders', {
namespace: 'test_ns' })]);
+ expect(formatTopicDifferences(drift.rows[0].differences)).toBe('namespace:
-> test_ns');
+
expect(formatTopicDifferences(drift.rows[0].differences)).not.toContain('null');
+ });
+
it('reports source-only and target-only topics', () => {
const result = compareTopicInventories(
[topic('source-only'), topic('shared')],
diff --git a/web/src/utils/topicConfigComparison.ts
b/web/src/utils/topicConfigComparison.ts
index 2189db128..bcc5c51a7 100644
--- a/web/src/utils/topicConfigComparison.ts
+++ b/web/src/utils/topicConfigComparison.ts
@@ -58,7 +58,14 @@ export const TOPIC_CONFIG_FIELDS: TopicConfigField[] = [
const valueOf = (topic: Topic, field: TopicConfigField): string | number => {
const value = topic[field];
- return typeof value === 'string' ? value.trim() : value;
+ if (typeof value === 'string') {
+ return value.trim();
+ }
+ // The providers disagree on how they spell "absent": the Apache provider
serializes
+ // `namespace: null` and a Tencent one can return `""` for the same thing.
Left raw, the null
+ // leaks into the difference text and the exported CSV as the token `null`,
and null vs "" was
+ // reported as a configuration drift.
+ return value ?? '';
};
const differencesBetween = (source: Topic, target: Topic):
TopicFieldDifference[] =>