Skip to content

Fix EnvelopeMapper swapped filter predicates breaking single-direction property overrides (#2551)#2573

Merged
jeremydmiller merged 1 commit intomainfrom
bugfix/2551-envelope-mapper-property-overrides
Apr 23, 2026
Merged

Fix EnvelopeMapper swapped filter predicates breaking single-direction property overrides (#2551)#2573
jeremydmiller merged 1 commit intomainfrom
bugfix/2551-envelope-mapper-property-overrides

Conversation

@jeremydmiller
Copy link
Copy Markdown
Member

Fixes #2551.

The bug

EnvelopeMapper<TIncoming, TOutgoing> had its compile-time filter predicates swapped:

  • compileIncoming skipped the default header read whenever a custom outgoing mapping existed, so MapOutgoingProperty(x => x.Foo, ...) silently deleted the incoming "foo" header read.
  • compileOutgoing did the symmetric wrong thing — MapIncomingProperty(x => x.Foo, ...) silently deleted the outgoing "foo" header write.

The reporter observed it on Kafka:

mapper.MapIncomingProperty(x => x.Id, ...);
// outgoing messages no longer carry the "id" header at all

Each filter now correctly checks its own direction's dictionary, so MapIncomingProperty / MapOutgoingProperty truly affect only the direction their name implies.

Verification

  • 4 new regression tests in MapIncomingPropertyTests cover both directions + sanity checks that the customization itself still wins on the direction it targets. They fail on main and pass with this change.
  • Full CoreTests net9.0 run: 1350/1350 pass.
  • Full Wolverine.Kafka.Tests net9.0 run: 142/142 pass (2 pre-existing flaky skips). Kafka exercises this codegen end-to-end on a live broker.

Test plan

  • Reproducer tests fail on unfixed code
  • Reproducer tests pass after the fix
  • Full CoreTests pass (no regression in shared mapper codegen)
  • Full Kafka tests pass (live transport exercising the mapper)

🤖 Generated with Claude Code

…leOutgoing (GH-2551)

The default header read/write loops in EnvelopeMapper had their filter
predicates pointing at the wrong dictionary:

- compileIncoming was skipping the default header read whenever a custom
  *outgoing* mapping existed, so MapOutgoingProperty(x => x.Foo, ...)
  silently deleted the incoming "foo" header read.
- compileOutgoing did the symmetric wrong thing — MapIncomingProperty
  silently deleted the outgoing header write.

Each loop now skips the default only when its own direction has been
customized, so MapIncomingProperty / MapOutgoingProperty truly affect
only the direction their name implies.

Adds four regression tests in MapIncomingPropertyTests covering both
directions plus sanity checks that the customization itself still wins
on the direction it targets.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

EnvelopeMapper: MapIncomingProperty/MapOutgoingProperty incorrectly removes the opposite direction's header mapping

1 participant