Skip to content

Commit 4c2955b

Browse files
holytshirtclaude
andcommitted
fix: move inbox attribute addition outside static pipeline cache
The static cache was storing inbox attributes alongside handler attributes, causing cross-contamination between pipeline builders with different inbox configurations. Now the cache only stores the handler's declared attributes, and inbox attributes are applied fresh each time based on the current _inboxConfiguration. This fixes both the original observability test failures (leaked inbox attributes) and the default inbox publish test (inbox added twice on cache miss). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a2b4537 commit 4c2955b

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

src/Paramore.Brighter/PipelineBuilder.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,11 @@ private IHandleRequests<TRequest> BuildPipeline(RequestHandler<TRequest> implici
208208
.Where(attribute => attribute.Timing == HandlerTiming.Before)
209209
.OrderByDescending(attribute => attribute.Step);
210210

211-
AddGlobalInboxAttributes(ref preAttributes, implicitHandler);
212-
213211
s_preAttributesMemento.TryAdd(implicitHandler.Name.ToString(), preAttributes);
214-
215212
}
216213

214+
AddGlobalInboxAttributes(ref preAttributes, implicitHandler);
215+
217216
var firstInPipeline = PushOntoPipeline(preAttributes, implicitHandler, requestContext, instanceScope);
218217

219218

@@ -250,12 +249,11 @@ private IHandleRequestsAsync<TRequest> BuildAsyncPipeline(RequestHandlerAsync<TR
250249
.Where(attribute => attribute.Timing == HandlerTiming.Before)
251250
.OrderByDescending(attribute => attribute.Step);
252251

253-
AddGlobalInboxAttributesAsync(ref preAttributes, implicitHandler);
254-
255252
s_preAttributesMemento.TryAdd(implicitHandler.Name.ToString(), preAttributes);
256-
257253
}
258254

255+
AddGlobalInboxAttributesAsync(ref preAttributes, implicitHandler);
256+
259257
var firstInPipeline = PushOntoAsyncPipeline(preAttributes, implicitHandler, requestContext, instanceScope, continueOnCapturedContext);
260258

261259
if (!s_postAttributesMemento.TryGetValue(implicitHandler.Name.ToString(), out IOrderedEnumerable<RequestHandlerAttribute>? postAttributes))

0 commit comments

Comments
 (0)