zjncs opened a new pull request, #5499:
URL: https://github.com/apache/rocketmq-dashboard/pull/5499

   ## Defect
   
   `SubscriptionEntry.consistency` is a **free-form string** produced by three 
different backend converters, and the frontend only understood one of them 
(plus the mock values):
   
   | Producer | Value form | Evidence |
   |---|---|---|
   | Apache (`RocketMQMetadataProvider`) | `consistent` / `inconsistent` / null 
| `RocketMQMetadataProvider.java:758` |
   | Aliyun (`AliyunConverters`) | `String.valueOf(Boolean)` → `true` / `false` 
| `AliyunConverters.java:223`; `AliyunConvertersTest.java:48` asserts 
`.consistency(true)` |
   | Tencent (`TencentInstanceProvider`) | `String.valueOf(Long)` → `1` / `0` | 
`TencentInstanceProvider.java:1036`; `TencentInstanceProviderTest.java:693` 
asserts `setConsistency(0L)` |
   
   The frontend checks in `consumerGroupDiagnostics.ts:123-127` and 
`consumer.tsx:167-171` only matched `['consistent', '一致']` / `['inconsistent', 
'不一致']`. On an Aliyun or Tencent instance every subscription therefore fell 
into `SUBSCRIPTION_UNKNOWN` (warning, −12 health points each), and **a genuine 
inconsistency (`false` / `0`) never escalated to `SUBSCRIPTION_INCONSISTENT` 
(critical)** — the most important signal the health check exists to raise. The 
tag color mapping additionally displayed the raw `true` / `0` strings.
   
   Verified on master with vitest: `analyzeConsumerGroupHealth` with 
`consistency: 'false'` produces `SUBSCRIPTION_UNKNOWN`, not 
`SUBSCRIPTION_INCONSISTENT`.
   
   ## Fix
   
   Add all three value domains (`true`/`false`, `1`/`0`) to the 
consistent/inconsistent buckets in **both** copies of the check (the 
diagnostics util and the consumer page, which has its own local copy for the 
tag colors).
   
   ## Tests
   
   New `web/src/utils/__tests__/consistencyDomains.test.ts` (6 cases, driving 
the real `analyzeConsumerGroupHealth` signature):
   
   - `'true'` → no subscription issue (failed on master: SUBSCRIPTION_UNKNOWN)
   - `'false'` → SUBSCRIPTION_INCONSISTENT **critical** (failed on master: 
SUBSCRIPTION_UNKNOWN warning)
   - `'1'` → consistent; `'0'` → critical inconsistent (both failed on master)
   - `'consistent'` / `'inconsistent'` controls unchanged; `'later'` still 
SUBSCRIPTION_UNKNOWN
   
   Verification: fail-before (4 failed) → pass-after (6/6) → mutation 
(reverting the diagnostics value lists) → 4 failures return → existing 
`consumerGroupDiagnostics.test.ts` stays green (36/36).
   
   ## Collision check
   
   No open PR touches `consumerGroupDiagnostics.ts` or the consistency checks 
in `consumer.tsx`. #5198 (mine, open) touches `consumer.tsx` in the 
subscription-verdict refresh area — different lines, no overlapping hunks.
   


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