Strengthen workflow automation diagnostics

This commit is contained in:
2026-05-27 12:55:19 +02:00
parent b114071957
commit 2422236ef7
8 changed files with 629 additions and 6 deletions
+18
View File
@@ -199,6 +199,22 @@ static async Task<IResult> MergeSpeakerIdentitiesAsync(
: profileOptions.SpeakerIdentification.MergeRecentIdentityAge;
return Results.Ok(await mergeService.MergeRecentIdentitiesAsync(recentAge, cancellationToken));
}
app.MapPost("/diagnostics/workflow/reload", (IConfiguration configuration) =>
Results.Ok(ReloadWorkflowConfiguration(configuration)));
static WorkflowConfigurationReloadResponse ReloadWorkflowConfiguration(IConfiguration configuration)
{
if (configuration is not IConfigurationRoot root)
{
throw new InvalidOperationException("Application configuration does not support reload.");
}
root.Reload();
var options = new MeetingAssistantOptions();
configuration.GetSection("MeetingAssistant").Bind(options);
return new WorkflowConfigurationReloadResponse(options.Automation.RulesPath);
}
app.MapPost("/recording/toggle", async (MeetingRecordingCoordinator coordinator, CancellationToken cancellationToken) =>
Results.Ok(await coordinator.ToggleAsync(cancellationToken)));
app.MapPost("/profiles/{launchProfile}/recording/toggle", async (
@@ -456,3 +472,5 @@ public sealed record AsrDiagnosticRequest(string Path, int? NumSpeakers = null);
public sealed record SummaryRetryRequest(string SummaryPath);
public sealed record SpeakerIdentityMergeDiagnosticRequest(double? RecentDays = null);
public sealed record WorkflowConfigurationReloadResponse(string? RulesPath);
@@ -230,11 +230,11 @@ public sealed class MeetingWorkflowEngine : IMeetingWorkflowEngine
switch (step.Uses.Trim().ToLowerInvariant())
{
case "add_attendee":
return AddUnique(meeting.Frontmatter.Attendees, value);
return AddUnique(meeting.Frontmatter.Attendees, value, MeetingAttendeeNames.NormalizeDisplayName);
case "remove_attendee":
return RemoveValue(meeting.Frontmatter.Attendees, value);
case "add_project":
return AddUnique(meeting.Frontmatter.Projects, value);
return AddUnique(meeting.Frontmatter.Projects, value, static project => project.Trim());
case "set_property":
return SetProperty(meeting, step.Property ?? step.Name, value);
case "add_context":
@@ -283,11 +283,17 @@ public sealed class MeetingWorkflowEngine : IMeetingWorkflowEngine
throw new InvalidOperationException($"Unsupported meeting workflow property '{property}'.");
}
private static bool AddUnique(List<string> values, string value)
private static bool AddUnique(
List<string> values,
string value,
Func<string, string> normalize)
{
var normalized = MeetingAttendeeNames.NormalizeDisplayName(value);
var normalized = normalize(value);
if (string.IsNullOrWhiteSpace(normalized) ||
values.Any(existing => string.Equals(existing, normalized, StringComparison.OrdinalIgnoreCase)))
values.Any(existing => string.Equals(
normalize(existing),
normalized,
StringComparison.OrdinalIgnoreCase)))
{
return false;
}