X-LightYear opened a new issue, #7080:
URL: https://github.com/apache/rocketmq-dashboard/issues/7080

   ### Description
   
   In Mock data mode, the maintenance-window creation path accepts a time range 
whose end is before its start. The real REST service rejects the same request 
with HTTP 400, so the demo UI reports a successful maintenance window that the 
deployed service could never create.
   
   ### Reproduction
   
   Current `rocketmq-studio` commit: `97f668006bb0b8d6bb8e1f6a6fc661b961ad28b2`.
   
   1. Enable the frontend Mock data source.
   2. Open System Alerts and open Maintenance Windows.
   3. Enter `2026-10-20 12:00` as Start time and `2026-10-20 11:00` as End 
time. The `datetime-local` fields do not enforce their ordering.
   4. Submit the form.
   
   The same behavior is reproduced by the service contract probe:
   
   ```ts
   await createAlertSilence({
     domain: 'BUSINESS',
     startsAt: '2026-10-20T12:00:00Z',
     endsAt: '2026-10-20T11:00:00Z',
     recurrence: 'ONCE',
     reason: 'invalid-order-probe',
   });
   ```
   
   ### Actual behavior
   
   `web/src/services/opsService.ts:createAlertSilence` resolves a new silence 
and adds it to the Mock inventory even though `endsAt` precedes `startsAt`.
   
   Deterministic probe against `97f668006bb0b8d6bb8e1f6a6fc661b961ad28b2`:
   
   ```text
   npm.cmd test -- --run 
src/services/mockAlertSilenceValidation.discovery.test.ts
   Test Files 1 failed (1)
   Tests 1 failed (1)
   AssertionError: promise resolved { ... startsAt: 12:00Z, endsAt: 11:00Z ... 
} instead of rejecting
   ```
   
   ### Expected behavior
   
   Mock mode should reject the request and leave the inventory unchanged, 
matching the REST contract.
   
   ### Root cause
   
   `systemAlerts.tsx:createSilence` converts the form values and calls 
`opsService.createAlertSilence`. The form validates presence and format but not 
the temporal relationship. The Mock branch only assigns an id and stores the 
object. In contrast, `AlertSilenceService.create` checks 
`endsAt.toInstant().isAfter(startsAt.toInstant())` and throws 
`BusinessException(400, "Silence end time must be after start time")` before 
persistence.
   
   ### Impact
   
   Demo-mode users can create and see an impossible maintenance window. Testing 
an alert suppression workflow in Mock mode therefore gives a false success and 
diverges from the REST-backed behavior.
   
   ### Scope
   
   The suspected fix is limited to the Mock maintenance-window creation 
contract and deterministic frontend service coverage. No backend behavior is 
implicated.
   
   ### Duplicate review
   
   - #6766 covers ending/deleting a missing Mock maintenance window, not 
invalid creation input.
   - #6743 covers returning the maintenance-window dialog to an obsolete page 
after deletion, not creation validation.
   - #4285 covered surfacing a backend silence validation reason, not the Mock 
branch accepting invalid ranges.
   - #3068/#3070 introduced recurring silence support; this report concerns the 
basic start/end invariant for all windows.
   
   AI assistance was used for investigation and drafting; the reproduction is 
deterministic and local.
   
   


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