Support multi-pulse ev44 messages via Sequence-based MessageAdapter#741
Closed
SimonHeybrock wants to merge 1 commit into
Closed
Support multi-pulse ev44 messages via Sequence-based MessageAdapter#741SimonHeybrock wants to merge 1 commit into
SimonHeybrock wants to merge 1 commit into
Conversation
The ev44 FlatBuffer schema packs events from multiple neutron pulses into a single message via reference_time and reference_time_index. Previously this raised NotImplementedError. Change the MessageAdapter protocol so adapt() returns Sequence[U], making 1:N message expansion a natural part of the adapter chain. The splitting happens at the Kafka boundary (KafkaToEv44Adapter and KafkaToMonitorEventsAdapter); all domain adapters stay semantically unchanged with single-element tuple wrapping. Key changes: - Add split_ev44_pulses() utility replacing _require_single_pulse() - MessageAdapter.adapt() returns Sequence[U] instead of U - ChainedAdapter uses flatmap semantics - AdaptingMessageSource uses extend() instead of append() - All 1:1 adapters wrap returns in tuples - KafkaToEv44Adapter and KafkaToMonitorEventsAdapter split multi-pulse messages into separate single-pulse messages Closes #708 Prompt: Implement the plan for multi-pulse ev44 support via Sequence-based MessageAdapter
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.
Summary
Alternative to #728. Closes #708.
MessageAdapterprotocol soadapt()returnsSequence[U], making 1:N message expansion a natural part of the adapter chainsplit_ev44_pulses()utility that slices multi-pulse ev44 messages into individual single-pulseEventDataobjectsKafkaToEv44Adapter,KafkaToMonitorEventsAdapter); all domain adapters stay semantically unchanged with single-element tuple wrappingChainedAdapteruses flatmap semantics;AdaptingMessageSourceusesextend()instead ofappend()The key difference from #728: instead of changing
from_ev44()return types, duplicating splitting logic across adapters, and addingisinstancebranching inAdaptingMessageSource, all adapters uniformly return sequences and the splitting is localized to the two Kafka-level ev44 adapters.Test plan
split_ev44_pulses()(single-pulse passthrough, empty reference_time, multi-pulse slicing)KafkaToEv44AdapterandKafkaToMonitorEventsAdapterChainedAdapterproduces multipleDetectorEvents🤖 Generated with Claude Code