unbridled-41 opened a new pull request, #5946:
URL: https://github.com/apache/rocketmq-dashboard/pull/5946

   ### Which Issue(s) This PR Fixes
   
   Fixes #5945
   
   ### Problem / Evidence
   
   ```ts
   // TopicConfigComparison.valueOf (before)
   const value = topic[field];
   return typeof value === 'string' ? value.trim() : value;
   ```
   
   The providers disagree on how they spell "absent" - the Apache provider 
never sets `namespace`, so the wire value is `null`, while a Tencent topic can 
answer `""` - and the raw value was therefore both compared and rendered:
   
   ```
   TopicConfigComparison: does not report a provider-absent value as the JS 
null token
   AssertionError: expected 'DRIFT' to be 'MATCH'
   ```
   
   `null` vs `""` was reported as a configuration drift, and the difference 
text (and the drawer's CSV export) contained the JS token `null`.
   
   ### Root cause / Fix
   
   A missing normalisation in the field accessor, while the comparison uses 
`===`. Normalise an absent value to the empty string, as the sibling fields are 
trimmed for the same heterogeneity.
   
   ### Priority and scoring
   
   **PRIORITY 45** — impact 14/40 (false drift reports and a `null` in an 
exported file; the compared configuration itself is right), blast radius 12/20 
(every cross-provider comparison), reproducibility 18/20 (deterministic, pinned 
by the new test), maintenance value 1/20.
   
   **FIX_CONFIDENCE 88** — one accessor, with the file's own trimming 
convention as the precedent.
   
   ### Tests
   
   `cd web && npx vitest run src/utils/topicConfigComparison.test.ts 
src/components/__tests__/TopicConfigComparisonDrawer.test.tsx` -> `Tests 21 
passed`.
   
   | Test | Before | After |
   |---|---|---|
   | `does not report a provider-absent value as the JS null token` | FAIL 
(`DRIFT` instead of `MATCH`) | PASS (also asserts the rendered text has no 
`null`) |
   | the existing trimming case | PASS | PASS |
   
   `npx eslint` reports no errors; `npx tsc -b` passes.
   
   ### Risk
   
   The only behaviour change is that an absent value now compares equal to an 
empty one and renders as an empty field instead of the token `null`.


-- 
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]

Reply via email to