You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "zmuxuny (via GitHub)" <gi...@apache.org> on 2026/10/19 20:38:53 UTC

[PR] fix(alerts): validate inserted notification template length [rocketmq-dashboard]

zmuxuny opened a new pull request, #7176:
URL: https://github.com/apache/rocketmq-dashboard/pull/7176

   ### Which Issue(s) This PR Fixes
   
   Fixes #7175.
   
   ### Brief Description
   
   Variable insertion uses `form.setFieldValue`, so it can exceed the notification textarea's 4000-character limit. For example, 3995 ordinary characters followed by the `${ruleName}` button become 4006. The preview warns, but Save and Test Run currently permit a payload that the existing DTO rejects.
   
   Add a localized field validator and validate that field after variable insertion. Keep the full text for correction; do not truncate a placeholder or change the server contract. Count UTF-16 code units to match the textarea and Java `@Size`: the installed validator's ordinary string `max` rule counts supplementary characters differently.
   
   Seven real-AntD regressions cover English/Chinese feedback, ASCII and supplementary-Unicode overflow, both edit-save/test calls, exact-limit selection replacement, and recovery after correction.
   
   AI assistance was used for investigation, implementation, and validation.
   
   ### How Did You Test This Change?
   
   From `web`, Node.js 24.19.0:
   
   ```sh
   node node_modules/vitest/vitest.mjs run \
     src/pages/ops/__tests__/AlertsPage.test.tsx \
     src/pages/ops/__tests__/AlertsTestResultResidue.test.tsx \
     src/pages/ops/__tests__/alertRulePayload.test.ts \
     src/pages/ops/__tests__/alerts.test.ts \
     src/utils/alertTemplatePreview.test.ts \
     src/services/opsService.test.ts src/api/ops.test.ts src/i18n --maxWorkers=1
   ```
   
   119 tests across 10 files passed, including all 45 AlertsPage cases.
   
   The same seven new cases against unchanged production code: 5 expected failures and 2 passing exact-limit controls. With the fix: 7/7 passed.
   
   ```sh
   node node_modules/typescript/bin/tsc -b --force
   node node_modules/eslint/bin/eslint.js src/pages/ops/alerts.tsx src/pages/ops/__tests__/AlertsPage.test.tsx src/i18n/translations.ts
   node node_modules/prettier/bin/prettier.cjs --check src/pages/ops/alerts.tsx src/pages/ops/__tests__/AlertsPage.test.tsx src/i18n/translations.ts
   git diff --check
   ```
   
   All passed; ESLint reports five existing warnings on unchanged lines. Independent source/test review found no blocker.
   
   The new regressions exercise an existing CLUSTER rule. New-rule and BUSINESS forms share the validator, but are not separately exercised by the new cases. The full frontend suite, production bundle, backend tests, and live-cluster integration were not run.
   
   ### Checklist
   
   - [x] One coherent change; unrelated modifications are not bundled in
   - [x] Commit subject follows Conventional Commits
   - [x] Tests added for the regression, names end in `Test`
   - [x] New UI text has Chinese and English translations
   - [ ] Architecture constraints verified (backend untouched; not run)
   - [ ] New source files carry ASF headers (no new source files)
   - [ ] Documentation updated (existing limit is unchanged)
   


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(alerts): validate inserted notification template length [rocketmq-dashboard]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #7176: fix(alerts): validate inserted notification template length
URL: https://github.com/apache/rocketmq-dashboard/pull/7176


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(alerts): validate inserted notification template length [rocketmq-dashboard]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #7176:
URL: https://github.com/apache/rocketmq-dashboard/pull/7176#issuecomment-6430467166

   This pull request has been automatically closed because there has been no activity for 7 days. If you would like to continue working on this, please reopen the PR with updated changes.


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org