fix(claude-do): merge Worker log: stop writing SignalR hub invocation arguments (P

ClaudeDo-Task: ae4e878c-e275-4c4f-94b5-ecb9b9602fd5
This commit is contained in:
mika kuns
2026-10-01 13:33:19 +02:00
3 changed files with 56 additions and 0 deletions
@@ -0,0 +1,39 @@
using ClaudeDo.Worker.Logging;
using Serilog.Events;
using Serilog.Parsing;
namespace ClaudeDo.Worker.Tests.Logging;
public class HubLogFilterTests
{
private const string Dispatcher = "Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher";
private static LogEvent Evt(string source, int eventId, string eventName, string message) => new(
DateTimeOffset.UtcNow, LogEventLevel.Debug, null, new MessageTemplateParser().Parse(message),
[
new LogEventProperty("SourceContext", new ScalarValue(source)),
new LogEventProperty("EventId", new StructureValue(
[new LogEventProperty("Id", new ScalarValue(eventId)), new LogEventProperty("Name", new ScalarValue(eventName))])),
]);
[Fact]
public void Received_invocation_with_arguments_is_excluded()
{
var e = Evt(Dispatcher, 1, "ReceivedHubInvocation", "Received hub invocation: Target: SetAzureDevOpsToken, Arguments: [ secret ]");
Assert.True(HubLogFilter.IsInvocationWithArguments(e));
}
[Fact]
public void Binding_failure_from_same_source_passes()
{
var e = Evt(Dispatcher, 3, "InvalidHubParameters", "Parameters to hub method 'X' are incorrect.");
Assert.False(HubLogFilter.IsInvocationWithArguments(e));
}
[Fact]
public void Same_event_name_from_other_source_passes()
{
var e = Evt("Other.Source", 1, "ReceivedHubInvocation", "x");
Assert.False(HubLogFilter.IsInvocationWithArguments(e));
}
}