Skip to content

fix(streaming): fail fast when a stream backend's feature is disabled - #25

Merged
CodingAnarchy merged 1 commit into
masterfrom
fix/streaming-placeholders
Oct 8, 2026
Merged

CodingAnarchy merged 1 commit into
masterfrom
fix/streaming-placeholders

Conversation

@CodingAnarchy

Copy link
Copy Markdown
Owner

Closes #23

Stacked on #24 (base is fix/feature-matrix, because #24 was still open and both touch ci.yml). Retarget to master after #24 merges.

Problem

Without the kafka / kinesis / google-pubsub feature, placeholder processors were compiled. The Kafka one faked successful delivery (sleep from batch.delay.ms, random failures from test.error.rate, simulated health check), which is silent data loss. The Kinesis and Pub/Sub ones only failed per event at send time.

Change

  • Each disabled backend's new() returns HammerworkError::Streaming (e.g. "Kafka support requires the kafka feature of hammerwork"), so StreamManager::add_stream / from_config reject the stream immediately.
  • The placeholder types are now uninhabited (struct KafkaProcessor(Infallible)) with a StreamProcessor impl that cannot run. All simulation and rand use in this path is gone. rand stays a dependency: retry.rs and the encryption modules still use it.
  • add_stream is split into create_processor plus a private add_stream_with_processor.
  • CI: postgres,streaming added back to the feature-combinations matrix.
  • CHANGELOG notes the behaviour change.

Tests

  • New fail-fast tests per backend under not(feature = ...), asserting the error from new() and from add_stream, and that no stream is registered.
  • Tests that build real processors (creation, config usage, stats, health) are now gated on their feature; the old placeholder-only assertions are removed. Real-backend tests are unchanged.
  • Tests that need a working stream without a broker (streaming.rs manager tests, integration_tests.rs) use StreamManager::add_stream_for_test (cfg(test)). It uses the real processor when the backend is compiled in, else a small in-memory StreamProcessor.

Verification

clippy -D warnings clean for postgres plus each of streaming, kafka, kinesis, google-pubsub, and for the workspace with --all-features. cargo test -p hammerwork --lib passes for each of those feature sets and --all-features. cargo fmt --check clean.

🤖 Generated with Claude Code

@CodingAnarchy
CodingAnarchy changed the base branch from fix/feature-matrix to master October 8, 2026 08:36
Without the kafka, kinesis or google-pubsub feature the placeholder
processors now return a Streaming error from new(), so add_stream and
from_config reject such streams at configuration time instead of faking
delivery (Kafka) or failing per event (Kinesis, Pub/Sub). Remove the
batch.delay.ms / test.error.rate simulation and make the placeholders
uninhabited. Tests use a cfg(test) in-memory processor where they need a
working stream without a broker. Re-enable postgres,streaming in the CI
feature matrix.

Closes #23

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@CodingAnarchy
CodingAnarchy force-pushed the fix/streaming-placeholders branch from 39810a5 to f9ee93d Compare October 8, 2026 08:37
@CodingAnarchy
CodingAnarchy merged commit 32be42e into master Oct 8, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Streaming: placeholder processors fake Kafka delivery when the backend feature is off

1 participant