Duansg opened a new pull request, #4364:
URL: https://github.com/apache/hertzbeat/pull/4364

   ## What's changed?
   
   `NtfyAlertNotifyHandlerImpl` declares `type() == 15`, but 
`resources/templates/` has no `15-*` file. `NoticeConfigServiceImpl` builds 
`PRESET_TEMPLATE` by scanning that directory, so 
`getDefaultNoticeTemplateByType((byte) 15)` returns null and 
`AlertNoticeDispatch#sendNoticeMsg` throws `NullPointerException` for every 
ntfy receiver that is not bound to a custom template — the notification is 
dropped. The "send test message" button fails the same way, since it also 
passes a null template.
   
   Regression from #4132, which added the channel without its preset template.
   
   - Add `15-NtfyTemplate.txt`, identical to the other markdown channels (the 
handler already sends `Markdown: yes`).
   - Add `PresetNoticeTemplateCoverageTest` asserting the general invariant: 
every `@Component` `AlertNotifyHandler` other than SMS (which 
`AlertNoticeDispatch` exempts) has a preset template. It lives in 
`hertzbeat-manager` because that is the only module where both the template 
resources and the handler classes are on the same classpath. Verified it fails 
with `[NtfyAlertNotifyHandlerImpl(type=15)]` when the new template is removed.
   
   `WeChatAlertNotifyHandlerImpl` (type 3) also has no template, but it carries 
no `@Component` and is never registered, so it is out of scope here and 
excluded by the test.
   
   ## Checklist
   
   - [x]  I have read the [Contributing 
Guide](https://hertzbeat.apache.org/docs/community/code_style_and_quality_guide)
   - [x]  I have written the necessary doc or comment.
   - [x]  I have added the necessary unit tests and all cases have passed.
   
   ## Add or update API
   
   - [ ] I have added the necessary [e2e 
tests](https://github.com/apache/hertzbeat/tree/master/e2e) and all cases have 
passed.
   


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to