unbridled-41 commented on PR #4892:
URL: 
https://github.com/apache/rocketmq-dashboard/pull/4892#issuecomment-5773775358

   ### Independent verification (isolated checkout of `4b96e42b` + test commit 
`790a1602`)
   
   Every citation re-read against this branch and every test claim re-executed 
from a clean checkout. The audit also found one coverage gap, now closed by the 
follow-up commit `790a1602` (no source change).
   
   **Code citations — re-verified**
   
   - `handleRestoreHistory` replaces the selection before the prompt: range, 
`localStorage.setItem(PROFILE_STORAGE_KEY, …)` + `setProfileId(…)` for a 
profile entry, `setCustomPromql(entry.promql)` for a custom one, then calls 
`restoreProtectedDataSource(…)`, which only records the replay and opens the 
modal — it issues no query.
   - On this branch the checkpoint is captured before those writes 
(`RestoreCheckpoint` at `:353`, built in `handleRestoreHistory` and attached to 
the replay at `:1079`/`:1111`/`:1133`), and `handleAuthCancel` (`:831`) puts 
the profile, range, custom expression and persisted profile back before 
dropping the pending source.
   - `handleAuthSubmit` is untouched: it still replays `replay.profile` / 
`replay.range` / `replay.customPromql` against the newly authenticated source, 
so a confirmed prompt behaves exactly as before.
   
   **Coverage gap found and closed**
   
   The cancel path restores four values, but only three of them were asserted: 
a *custom* entry also overwrites the query box before the prompt, and nothing 
pinned that a draft survives. Added in `790a1602`:
   
   ```
   × keeps the custom expression draft when a protected custom restore is 
cancelled   (pre-fix, source reverted)
   Error: expect(element).toHaveValue(sum(rocketmq_topic_number) + 1)
   Received:
     sum(rocketmq_topic_number)
   ```
   
   i.e. the history entry's expression had replaced the operator's unsaved 
draft, and declining the prompt kept the replacement.
   
   **Test claims — re-executed**
   
   ```
   npx vitest run src/components/__tests__/MetricsExplorer.test.tsx -> Test 
Files 1 passed (1) | Tests 31 passed (31)
   npx vitest run src/components                                    -> Test 
Files 8 passed (8) | Tests 89 passed (89)
   npx tsc --noEmit -p tsconfig.json                                -> clean
   npx eslint src/components/MetricsExplorer.tsx \
              src/components/__tests__/MetricsExplorer.test.tsx    -> clean
   ```
   
   The two new regressions cover the profile-entry and custom-entry halves of 
the rollback; the neighbouring paths stay green (`keeps the current data source 
when cancelling a protected history restore`, `requires credentials again when 
restoring a protected data source history item`, `restores profile, range, and 
source from query history`). The description was updated to reflect the second 
test.
   


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