tju-yxq opened a new pull request, #6195:
URL: https://github.com/apache/rocketmq-dashboard/pull/6195

   ### Which Issue(s) This PR Fixes
   
   - Fixes #6193
   
   ### Brief Description
   
   Bounds `GET /api/system-alerts` by reusing the paginated query instead of 
reading the whole table:
   
   - **`AlertService.listAlerts(level, domain, instanceId, transition)`** now 
delegates to the existing paginated overload with `page=1, 
pageSize=LIST_ALERTS_MAX` (the same 100 ceiling `validateAlertPagination` 
enforces) and returns its items. Every filter (`level`, `domain`, 
`instance_id`, `transition`) now runs in SQL with the existing `ORDER BY time 
DESC, id DESC`; the response stays a plain list, bounded to the newest 100 
matching alerts. `GET /api/system-alerts/page` remains the complete view.
   - The now-unused single-arg `listAlerts(String level)` and the unbounded 
repository read `AlertRepository.findAlerts(String level)` (a `selectList` with 
no limit) are removed, so the unbounded path cannot be reintroduced by accident.
   - Their unique coverage — stored `" WARNING "` normalization and the 
Turkish-locale level normalization — migrates to the paginated query's tests 
(`findAlertsPage` uses the same `normalizeLevel` / `toAlertVO` pipeline).
   
   No API shape changes: the listing endpoint keeps its `List<SystemAlertVO>` 
response; the console's alert page and CSV export already use the paginated 
endpoint and are untouched.
   
   ### How Did You Test This Change?
   
   ```
   cd server && mvn test 
-Dtest='AlertServiceTest,MybatisPlusAlertRepositoryTest,SystemAlertControllerTest'
    AlertServiceTest                  :: Tests run: 84,  Failures: 0, Errors: 0 
  # includes the new
                                                                                
    # listAlertsShouldDelegateToTheBoundedPageQueryTest
                                                                                
    # (captures the SystemAlertQuery: filters forwarded,
                                                                                
    # page=1, pageSize=100)
    MybatisPlusAlertRepositoryTest    :: Tests run: 18,  Failures: 0, Errors: 0 
  # normalization coverage
                                                                                
    # migrated to findAlertsPage
    SystemAlertControllerTest         :: Tests run: 12,  Failures: 0, Errors: 0 
  # the endpoint contract is unchanged
   
   cd server && mvn checkstyle:check
   (no output — exit 0)
   ```
   
   ### Checklist
   
   - [x] One coherent change; unrelated modifications are not bundled in (one 
concern — the listing endpoint must not read unbounded — service delegation, 
dead-path removal, and the test migration that keeps the removed path's 
coverage)
   - [x] Commit subject follows Conventional Commits
   - [x] Tests added or updated for non-trivial changes, test methods named 
`...Test` (new delegation test asserting the forwarded filters and the 100-row 
cap; normalization tests migrated to the paginated query)
   - [x] New UI text has both Chinese and English entries under `web/src/i18n/` 
(no UI text — server-only change)
   - [x] Architecture constraints stay green (controller/service/repository 
layering preserved; no ArchUnit-relevant changes)
   - [x] New source files carry the ASF license header (no new source files)
   - [ ] Documentation touched where behaviour changed (the listing is now 
bounded to the newest 100; the paginated endpoint was already the console's 
complete view)
   


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