fix(backend): repair NewProducerMessage signature + self-loop tagging (unblocks component-tests) - #165
Merged
Merged
Conversation
The "extract shared MQ handler" refactor dropped the producerMessageKey argument from the exported adapters/backend/v1.NewProducerMessage and hardcoded the synchronizer server key. That silently broke external consumers of this exported helper -- notably armosec/event-ingester-service, whose synchronizer_producer passes its own "eventIngesterProducer" key -- so the integration `tests` module (which compiles that consumer against local synchronizer via a replace directive) failed to build, and every component-test in CI errored before running. Restore the producerMessageKey parameter and pass messaging.SynchronizerServerProducerKey from the synchronizer's own two callers. Behavior is unchanged; the public signature external producers depend on is preserved. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Matthias Bertschy <matthias.bertschy@gmail.com>
📝 WalkthroughWalkthrough
ChangesPulsar message key handling
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Summary:
|
The MQ refactor added a self-loop guard: the reader skips messages where IsSelfProducedMessage is true, and BuildProducerProperties unconditionally stamps the x-producer-source=synchronizer-server header on every message it builds. Because NewProducerMessage is also used by external producers (event-ingester-service via adapters/backend/v1), their backend->cluster messages were tagged as self-produced and silently dropped by the server -- so objects never landed in the cluster and every backend-direction component-test failed at runtime (e.g. TC01: configmaps "test" not found). Only stamp the self-produced source when the caller is the synchronizer server itself (identified by SynchronizerServerProducerKey); strip it for any other producer key. Add a unit test covering both directions. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Matthias Bertschy <matthias.bertschy@gmail.com>
|
Summary:
|
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.
Overview
The
component-testsmatrix had been failing on every PR (including #163). There were two distinct regressions, both introduced by the MQ-extraction refactor (3d79f17), which this PR fixes. All 17 component-tests now pass.1. Compile break (build failed)
3d79f17changed the signature of the exported helperadapters/backend/v1.NewProducerMessage, dropping the leadingproducerMessageKeyargument. That helper is consumed outside this repo bygithub.com/armosec/event-ingester-service(synchronizer_producer), which the integrationtestsmodule builds against local synchronizer viareplace. The argument mismatch made the wholetestsmodule fail to compile, so every component-test died at the Run test step before executing:Fix: restore the
producerMessageKeyparameter; synchronizer's own two callers passmessaging.SynchronizerServerProducerKey.2. Self-loop filter dropped external producers' messages (runtime failure)
Once compilation was restored, the tests ran but backend->cluster cases still failed (e.g. TC01:
configmaps "test" not found). The refactor also added a self-loop guard — the reader skips messages wheremessaging.IsSelfProducedMessageis true — andBuildProducerPropertiesunconditionally stampsx-producer-source: synchronizer-serveron every message it builds. SinceNewProducerMessageis also used by external producers (event-ingester), their messages were tagged as self-produced and silently dropped by the server, so objects never landed in the cluster.Fix: only stamp the self-produced source header when the caller is the synchronizer server itself (identified by
SynchronizerServerProducerKey); strip it for any other producer key. Added a unit test covering both directions.Verification
go build ./...,go test ./adapters/backend/v1/,go test ./messaging/— all pass locally.TestNewProducerMessage_SelfLoopTaggingasserts external-producer messages are not tagged self-produced and are not filtered.component-testspass on this branch (previously all failing).Once merged to
main, other open PRs (e.g. #163) will passcomponent-testsafter a rebase.Generated with Claude Code