Conversation
…4054) Brighter's JSON serialization camelCases header bag keys, so a "SessionId" key returns as "sessionId" after an Outbox round-trip. The publisher's exact-match lookup missed it (session never set) and the case-sensitive reserved-header filter let it leak into ApplicationProperties. Both lookups are now OrdinalIgnoreCase. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Our agent can fix these. Install it.
Gates Passed
4 Quality Gates Passed
Quality Gate Profile: Clean Code Collective
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.
|
@Jonny-Freemarket Any thoughts? |
Code Review — PR #4205: case-insensitive SessionId & reserved-header handling (ASB)Reviewed the diff against the surrounding code and traced the serialization path. Overall: correct, well-scoped fix with an accurate root-cause diagnosis. I verified the claim independently — Correctness ✅
Suggestions (non-blocking)
Conventions ✅
Nice fix — the one thing I'd genuinely push on before merge is adding the reserved-header-leak assertions (suggestion #1) so the second half of the change is actually covered by a test. 🤖 Generated with Claude Code |
What
Fixes #4054 — the ASB
SessionIdset from a Brighter outbox was silently dropped.Root cause
Brighter's JSON serialization uses
JsonNamingPolicy.CamelCase(seeJsonSerialisationOptions), so a header bag key written as"SessionId"returns as"sessionId"after a serialization round-trip — e.g. when a message is stored in and read back from an Outbox.In
AzureServiceBusMessagePublisher:Bag.TryGetValue("SessionId", …)is an exact match, so it missed the camelCased"sessionId"key and the session was never set on the outgoing message.ReservedHeaders.Contains(h.Key)is also case-sensitive, so the camelCased reserved keys (sessionId,messageType,handledCount,replyTo) leaked intoApplicationProperties.Fix
Both lookups now use
OrdinalIgnoreCase:Tests
Added
When_Converting_A_Message_With_A_Session_Id.cs— a[Theory]proving both"SessionId"and"sessionId"setServiceBusMessage.SessionIdand are kept out ofApplicationProperties.Notes
The diagnosis was confirmed by tracing the camelCase serialization policy before fixing (the original suggested fix only partially addressed the reserved-header leak). That "confirm the theory first" step is the basis of the lightweight bug workflow proposed in #4204.
🤖 Generated with Claude Code