Repository navigation
fix: real delivery for streams, webhook templates, email alerts, Pub/Sub health (#41) - #43
Merged
Merged
Conversation
lettre 0.11 (no default features; builder, smtp-transport, tokio1-rustls-tls, hostname) backs SMTP email alerts under the `alerting` feature. gcloud-gax (already in the tree via gcloud-pubsub) is needed by the `google-pubsub` health check for its retry settings and status codes. h2, http and bytes are dev-dependencies for a fake Pub/Sub gRPC endpoint in tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
StreamManager::process_event_batch recorded every batch as delivered without calling the processor, so Kafka, Kinesis and Pub/Sub streams dropped all events while reporting success. Batches are now sent with StreamProcessor::send_batch. Failed events (or events without a delivery result) are retried per StreamRetryPolicy with capped exponential backoff and optional jitter; retries stop once shutdown begins, including during the backoff sleep. Stats are updated from the per-event results and gain `last_error`. Also: Kinesis and Pub/Sub now send the stream's serialized bytes instead of always re-encoding JSON, and the Pub/Sub health check fetches the topic instead of returning true. Part of #41. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Webhook payload_template was ignored. It is now a JSON template with
{{event.*}} placeholders, rendered on the parsed tree so event data
cannot inject JSON, and validated in add_webhook/update_webhook and
HammerworkConfig::from_file.
Email alert targets only logged. They now send through SMTP (lettre,
rustls) using per-target SmtpConfig; a target without SMTP settings is a
configuration error. Alert delivery failures are returned instead of
logged and swallowed, and the cooldown only starts once a target was
reached.
Part of #41.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CodingAnarchy
force-pushed
the
fix/real-delivery
branch
from
October 8, 2026 14:16
b1d90df to
98f002c
Compare
This was referenced Oct 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #41: the library items. The CLI and web dashboard items are handled separately.
Each of these features reported success but did nothing. They now either deliver, or fail visibly.
Done
src/streaming.rs)StreamProcessor::send_batch.StreamRetryPolicy. An event also counts as failed whensend_batcherrors or returns no result for it.max_attemptsis the total number of attempts.initial * multiplier^(n-1), capped atmax_delay_secs. Optional jitter draws from[d/2, d].shutdown(grace)begins: a send already in progress finishes, the backoff sleep is interrupted, and the remaining events are counted as failed with a "shut down"last_error.success_rate, average delivery time, timestamps, and the newlast_error.Arc, so the map lock isn't held during network I/O.payload_template(src/webhooks.rs){{event.*}}placeholders, handled by the new publicPayloadTemplate.add_webhook, inupdate_webhook(before the old webhook is removed) and inHammerworkConfig::from_file. Unknown paths, invalid JSON, an unterminated{{and placeholders in object keys are rejected withHammerworkError::Config.src/alerting.rs)lettrewith tokio and rustls, behindalerting.AlertTarget::Email { recipient, smtp: Option<SmtpConfig> }.SmtpConfighas host, port, from, username, a password given asSecretSource::Environment/Static(redacted inDebug), TLS mode (StartTlsis the default and is required; alsoImplicitandNone) and a timeout.AlertingConfig::validate,AlertManager::try_newandHammerworkConfig::from_file.warn!and the call returnedOk. The cooldown only starts once some target received the alert.health_checktopic.exists(), bounded byhealth.check.timeout.ms.PERMISSION_DENIED.API and behaviour changes
AlertTarget::Emailhas a newsmtpfield, which is breaking for code that constructs or exhaustively matches the variant.AlertingConfig::email()is deprecated in favour ofemail_via_smtp().StreamStatshas a newlast_errorfield, which is breaking for struct literals.check_thresholds,check_queue_depth,check_worker_starvationandsend_custom_alertnow returnErrwhen a target fails. The worker already logs that error.HammerworkConfig::from_filerejects email targets without SMTP settings and invalid webhook templates.New dependencies
lettre0.11: optional,alertingfeature. MSRV 1.85; rustls with the ring provider is selected explicitly.gcloud-gax1.4: optional,google-pubsubfeature. It was already in the tree.h2,http,bytes: dev-only, for a fake Pub/Sub gRPC endpoint. All were already in the lockfile.cargo auditis clean.Tests
InMemoryProcessor, which now records what it received and can be scripted to fail:add_webhook/update_webhookrejection, and an end-to-end delivery that sends the rendered body.from_filerejects undeliverable targets.Verified locally
cargo fmt --all --checkcargo clippy --workspace --all-targets --all-features --locked -D warningspostgres,alerting,postgres,kafkaandpostgres,google-pubsubcargo test --workspace --all-features --libcargo +1.91.1 check --workspace --all-features --all-targets --lockedcargo audit🤖 Generated with Claude Code