Skip to content

Support multi-pulse ev44 messages via Sequence-based MessageAdapter#741

Closed
SimonHeybrock wants to merge 1 commit into
mainfrom
worktree-multi-pulse-ev44-v2
Closed

Support multi-pulse ev44 messages via Sequence-based MessageAdapter#741
SimonHeybrock wants to merge 1 commit into
mainfrom
worktree-multi-pulse-ev44-v2

Conversation

@SimonHeybrock
Copy link
Copy Markdown
Member

Summary

Alternative to #728. Closes #708.

  • Restructure the MessageAdapter protocol so adapt() returns Sequence[U], making 1:N message expansion a natural part of the adapter chain
  • Add split_ev44_pulses() utility that slices multi-pulse ev44 messages into individual single-pulse EventData objects
  • Multi-pulse splitting happens at the Kafka boundary (KafkaToEv44Adapter, KafkaToMonitorEventsAdapter); all domain adapters stay semantically unchanged with single-element tuple wrapping
  • ChainedAdapter uses flatmap semantics; AdaptingMessageSource uses extend() instead of append()

The key difference from #728: instead of changing from_ev44() return types, duplicating splitting logic across adapters, and adding isinstance branching in AdaptingMessageSource, all adapters uniformly return sequences and the splitting is localized to the two Kafka-level ev44 adapters.

Test plan

  • New unit tests for split_ev44_pulses() (single-pulse passthrough, empty reference_time, multi-pulse slicing)
  • New tests for multi-pulse KafkaToEv44Adapter and KafkaToMonitorEventsAdapter
  • Chain integration test: multi-pulse ev44 through ChainedAdapter produces multiple DetectorEvents
  • Full test suite passes (2472 passed, 0 failures)

🤖 Generated with Claude Code

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
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.

Support multi-pulse ev44 messages

1 participant