unbridled-41 opened a new issue, #5466:
URL: https://github.com/apache/rocketmq-dashboard/issues/5466
### Studio Version
branch: `rocketmq-studio` @ `6a68042f` (the revision verified; the branch is
based on it)
deployed as: built from source (unit test)
### Runtime Environment
Not environment-specific: frontend payload against the existing DTO.
### Connected RocketMQ Cluster
Not cluster-specific; any instance with a native metric rule created from
the console.
### Describe the Bug
The create payload is built from the form values, and the create dialog has
no `enabled` control. `AlertRuleRequestDTO` models `enabled` as a primitive
boolean, so an absent field deserialises to `false` and the repository writes
`enabled = 0` — the column's `DEFAULT 1` is never reached. The dialog shows no
switch, the toast only says the rule was created, and the rule never evaluates.
The surrounding code points the other way: `db/schema.sql` defaults the
column to 1, the mock service returns `enabled: true`, and the import path
preserves the file's value.
### Steps to Reproduce
1. Open Ops → Alerts, create a rule (name, instance, metric, threshold,
duration, channel).
2. Note the success toast, then the status switch in the refreshed row.
3. Observe the rule is off and no alert is ever produced by it.
### What Did You Expect to See?
A rule created from the console is evaluating, or the dialog makes the
disabled state an explicit choice.
### What Did You See Instead?
It is created disabled and nothing says so.
### Evidence
- `web/src/pages/ops/alerts.tsx` (create payload and the dialog's fields),
`ops/alert/AlertRuleRequestDTO.java` (`private boolean enabled;`),
`ops/alert/MybatisPlusAlertRepository.java`
(`entity.setEnabled(rule.isEnabled())`), `db/schema.sql` (column default).
- `cd web && npx vitest run src/pages/ops/__tests__/AlertsPage.test.tsx` —
the added case drives the full create dialog (`Lag guard`, instance, metric,
operator, threshold, duration, channel) and fails before the change with
`expected "vi.fn()" to be called with arguments: [ ObjectContaining{…},
'BUSINESS' ]` (no `enabled`), passing after with `{ name: 'Lag guard', enabled:
true }` (`Tests 30 passed`).
### Impact
A monitoring rule is created dead with no signal, on the alerting page's
primary workflow.
### Acceptance Criteria
- The created rule is enabled (or the dialog exposes the choice), pinned by
a regression test.
**Corresponding PR:** #5434
--
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]