fix(notifications): skip dispatch when no template matches #473
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/PMS-701-drop-context-dump-fallback"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The dispatcher fell back to a synthetic subject and a body built from the whole dispatch JSON whenever a rule had no
template_idor the template row was missing. Those contexts carry recipient addresses, user ids and ticket content, so the fallback mailed internal identifiers and a debug string to a real recipient under a subject that read as an internal event name.A rule with no usable template is now treated as a misconfiguration:
dispatchlogs a warn naming the tenant, event type, rule id/name and template id, skips the rule, and writes nonotificationsrow, so the returned fanout count reflects the skip. With the template guaranteed present, the subject and body render straight off the template row; a template with no subject leaves the column NULL rather than inventing one.The write path is closed too:
template_idis now#[validate(required)]onUpsertNotificationRuleRequest, andcreate_rule/update_rulere-check it throughrequire_template_idso non-HTTP callers get the same 422. A unit test scanssrc/,tests/andcrates/for the two removed literals so the fallback cannot come back, and an integration test proves a legacy NULL-template rule dispatches nothing and that a template-less rule POST is rejected without persisting a row.#PMS-701