ai-yang opened a new issue, #738:
URL: https://github.com/apache/rocketmq-dashboard/issues/738

   ## Affected branch
   
   `rocketmq-studio` at `bbf1b7e0cf25a5065ba049b5450cc8155569f710`
   
   ## Description
   
   The LLM settings page does not bind connection-test and save callbacks to 
the provider/configuration operation that started them. A connection test 
started for one provider can therefore finish after the user has switched 
provider or explicitly saved newer settings, and its late success path still:
   
   - publishes the old provider's success result and toast;
   - automatically saves the captured old provider configuration;
   - replaces the active form's API key with the masked placeholder;
   - refreshes models for the old provider; and
   - controls the shared test-loading state.
   
   This is separate from #733/#737, which owns initial configuration and 
model-list requests but intentionally does not change the save/connection-test 
contract.
   
   ## Deterministic reproduction
   
   1. Load LLM settings with OpenAI selected.
   2. Enter an OpenAI API key and start **Test connection** while holding the 
request response.
   3. Switch to DeepSeek and enter a DeepSeek API key.
   4. Explicitly save the DeepSeek configuration.
   5. Complete the older OpenAI connection test successfully.
   
   Expected:
   
   - The obsolete OpenAI result is ignored after the provider changes.
   - It does not publish a success result or toast.
   - It does not auto-save the captured OpenAI configuration.
   - It does not mask or otherwise change the active DeepSeek API key.
   - The newer explicit DeepSeek save remains the last save operation.
   
   Actual:
   
   - `OpenAI connection succeeded` is rendered after DeepSeek is selected.
   - The active `deepseek-secret-key` input is replaced with `••••••••`.
   - `saveLlmConfig` is called a second time with the obsolete OpenAI 
configuration after the newer DeepSeek save.
   
   The controlled UI regression uses deferred Promises and the real provider 
switch/save interactions. On the unmodified Node 20 baseline, its three 
business assertions failed identically in 5/5 isolated Vitest processes. It 
uses no sleeps, fake network, randomized scheduling, or timing thresholds. 
Existing LLM settings tests remain green (4/4).
   
   ## Impact
   
   This is not only stale presentation state: a late connection test can 
overwrite the server-side LLM configuration that the user just saved for 
another provider. The key-masking callback can also mutate the current form 
based on credentials from the previous provider, making the UI appear to 
represent a saved configuration that is no longer the active operation.
   
   ## Suggested fix
   
   Give LLM mutation operations an ownership generation (including component 
lifecycle and provider changes):
   
   - starting a newer explicit save or connection test invalidates callbacks 
from the prior operation;
   - changing provider or unmounting invalidates in-flight operation callbacks;
   - result/toast, auto-save, key masking, model refresh, error handling, and 
`finally` loading updates execute only for the current owner;
   - the existing successful connection-test auto-save behavior remains 
unchanged when the operation is still current.
   
   Add regression coverage for provider switching and for an older test 
finishing after a newer explicit save.
   
   ## Related work checked
   
   - #733/#737 addresses initial config/model discovery ownership and 
explicitly excludes save/connection-test behavior.
   - #483 introduced the successful-test auto-save path.
   - #536 protects stored API keys and clears credentials on provider change, 
but does not invalidate in-flight callbacks.
   - #651 implements the real LLM gateway/model path and does not serialize 
frontend operations.
   - #726/#729 addresses backend persistence-failure atomicity, not frontend 
late callbacks.
   
   Searches across open and closed issues and open, closed, and merged pull 
requests for `LlmSettings`, provider switching, connection tests, auto-save, 
API key masking, stale responses, `saveLlmConfig`, and `testLlmConnection` 
found no equivalent report or claimed implementation.
   


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