Skip to content

ReactorBaggage's append method overwrites new baggage with existing entries on key conflictΒ #1060

@amitsinha11

Description

@amitsinha11

🐞 Bug: Context append(...) method overwrites new baggage with existing entries on key conflict

Affected Component

append(...) method in the ReactorBaggage class handling context baggage merging


❗ Problem Description

When using the append(Context context, Map<String, String> baggage) method to add new baggage values to an existing reactor Context, the current logic unintentionally overwrites any conflicting keys with the existing baggage values, not the newly provided ones.

This leads to unexpected behavior when multiple filters or services attempt to enrich the context and expect their new values to take precedence.


πŸ” Current Implementation

see here

In this logic:

  • The new baggage is put into the map first.
  • Then, the existing baggage is added on top, overwriting any keys that are already present.
  • As a result, existing baggage wins in the case of a key conflict.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA general bug

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions