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

   ### Which Issue(s) This PR Fixes
   
   Fixes #5933
   
   ### Problem / Evidence
   
   `mergeAndSave` reconciles the page state from a settings read taken before 
the write:
   
   ```ts
   const base = await loadFreshSettings();
   await saveGeneralSettings(buildPayload({ ...base, ...patch }));
   setSettings({ ...base, ...statePatch });
   ```
   
   `dingtalkSigningSecretConfigured` is derived server-side and stripped by 
`buildPayload`, so it stays false after the save - and it is the sole condition 
for the clear action:
   
   ```
   GeneralSettingsTab: reveals the clear action once a signing secret has been 
saved
   TestingLibraryElementError: Unable to find role="button" and name "清除钉钉签名密钥"
   ```
   
   The operator therefore cannot revoke a mistyped secret without reloading the 
page, and the fallback ("empty the field, save") reports 保存成功 while 
`SettingsService` keeps the stored value (blank means "keep the current one") - 
a wrong secret keeps signing DingTalk notifications. The AI key field in the 
same page already marks itself configured on a successful save; this form had 
no equivalent.
   
   ### Root cause / Fix
   
   A server-derived marker that the save path never re-derives. Mark the secret 
configured from the submission itself after a successful save and empty the 
field so the next save does not resubmit it.
   
   ### Priority and scoring
   
   **PRIORITY 52** — impact 18/40 (a secret that cannot be removed or replaced 
from the UI, and a success message for a save that changed nothing), blast 
radius 12/20 (every deployment that uses a DingTalk signing secret), 
reproducibility 18/20 (deterministic, pinned by the new test), maintenance 
value 4/20.
   
   **FIX_CONFIDENCE 88** — the sibling field on the same page establishes the 
pattern.
   
   ### Tests
   
   `cd web && npx vitest run 
src/pages/settings/__tests__/GeneralSettingsTab.test.tsx` -> `Tests 9 passed`.
   
   | Test | Before | After |
   |---|---|---|
   | `reveals the clear action once a signing secret has been saved` | FAIL (no 
clear button) | PASS |
   | `can explicitly clear a configured DingTalk signing secret` | PASS | PASS |
   
   The new case also asserts the field is emptied after the save. `npx eslint` 
reports no errors; `npx tsc -b` passes.
   
   ### Risk
   
   Only the page's own state changes; the payload, the save path and the server 
behaviour are untouched.


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