Write the Alert Dispatched event when an alert value is null #573
All Vouch review confidence checks passed
Residual risk 0.20 = Change Risk (0.50) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.50 · 576 lines diff across 7 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.380
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #573"
general
weight: 0.35
pacmano1
Closes #572.
When an alert fires, its actions go out first. Then
AlertWorker.ActionTaskbuilds the "Alert Dispatched" event by callingtoString()on every value in the alert's context. A null value throws, and the task runs on an executor whoseFuturenobody reads, so the event is never written and nothing is logged.It's not only the server name. A source transformer that throws, or a call to
alerts.sendAlert(...), leavesconnectorTypenull, and those alerts never wrote the event either, server name or not. Measured below.The blank server name case is courtesy of #259, which put
serverNamein the context. Tony spotted the null in review, wrote a nice paragraph about it, and it still collected three approvals, with #47 lined up to fill it in. #47 is still lined up. In fairness, thetoString()loop that actually throws has been sitting there since Mirth.Change
Objects.toString(value, "").AuthorizationControllerdoes the same for audit events, and empty is also what the #259 thread wanted for the template variable.logger.errorthe protocol and email steps in that method already have, so if it breaks again it says so.${serverName}still renders as the literal token, as discussed in #259, and so does${connectorType}on transformer andalerts.sendAlertalerts. Checked on an engine built from this branch.alerts.sendAlert, and any alert on a server with no name, will start writing an "Alert Dispatched" event per action. They never did before. Each one carries the full error text inerroranderrorMessage, same as the events that were already being written.AlertWorkerTestcovers a null server name and connector type, a set server name, and a failing dispatch getting logged. The first and the last fail on main.How to verify
Fresh engine on Derby, no server name set (Settings, Server, Server Name empty).
1. Create a channel "Receiver": Channel Reader source, any destination.
2. Create a channel "Throws": Channel Reader source, JavaScript Writer destination with
throw new Error('boom');.3. Create a channel "Transformer Throws": Channel Reader source with a JavaScript transformer step
throw new Error('transformer boom');, any destination.4. Create an alert on any error for "Throws" and "Transformer Throws", with a Channel action to "Receiver". Enable it and deploy all three channels.
5. Send a message to "Throws".
6. Set a Server Name and save. Send a message to "Transformer Throws".
7. Look in Events for "Alert Dispatched".
Before: "Receiver" gets both alert messages, but neither "Alert Dispatched" event is written, and mirth.log says nothing about it. After: both events are there, with
serverNameblank on the first andconnectorTypeblank on the second.Tested
./gradlew clean build -x signSetupJars: 913 tests, 0 failures, 0 skipped.Live on Derby, one engine built from main (cd802efd1) and one from this branch, one message per row:
| Scenario | Alert action delivered (main / this PR) | Alert Dispatched event (main / this PR) |
|---|---|---|
| No server name, JavaScript Writer throws | yes / yes | missing / written,
serverNameblank || Server name set, JavaScript Writer throws (control) | yes / yes | written / written |
| Server name set, source transformer throws | yes / yes | missing / written,
connectorTypeblank || Server name set,
alerts.sendAlert(...)| yes / yes | missing / written,connectorTypeblank |On main, mirth.log has nothing about the three missing events. On this branch the new error line never shows up, since nothing failed.
Release Note
The "Alert Dispatched" event is no longer skipped when an alert value is missing
When an alert fired, its actions went out, but the "Alert Dispatched" event wasn't written if one of the alert's values was missing, and nothing was logged. That happened for any error alert while Settings, Server, Server Name was blank, and for alerts on source transformer errors or
alerts.sendAlert(...), which carry no connector type. The event is now written with those values as empty attributes, and a failure to write it is logged. (#572, #573)After upgrading, installs with such alerts will see "Alert Dispatched" events they didn't get before. Alert templates are unchanged: with no server name set,
${serverName}still renders as the literal${serverName}.Co-authored with Claude Code.