< Summary

Information
Class: Orchestrator.Commands.Observability.Experiments.RunCommunityToDateCommand
Assembly: Orchestrator
File(s): /home/runner/work/KicktippAi/KicktippAi/src/Orchestrator/Commands/Observability/Experiments/RunCommunityToDateCommand.cs
Line coverage
85%
Covered lines: 24
Uncovered lines: 4
Coverable lines: 28
Total lines: 54
Line coverage: 85.7%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
ExecuteAsync()100%1177.78%

File(s)

/home/runner/work/KicktippAi/KicktippAi/src/Orchestrator/Commands/Observability/Experiments/RunCommunityToDateCommand.cs

#LineLine coverage
 1using System.Text.Json;
 2using Microsoft.Extensions.Logging;
 3using Orchestrator.Infrastructure.Factories;
 4using Orchestrator.Infrastructure.Langfuse;
 5using Spectre.Console;
 6using Spectre.Console.Cli;
 7
 8namespace Orchestrator.Commands.Observability.Experiments;
 9
 10public sealed class RunCommunityToDateCommand : AsyncCommand<RunCommunityToDateSettings>
 11{
 12    private readonly IAnsiConsole _console;
 13    private readonly PreparedExperimentRunExecutor _executor;
 14    private readonly ILogger<RunCommunityToDateCommand> _logger;
 15
 116    public RunCommunityToDateCommand(
 117        IAnsiConsole console,
 118        IFirebaseServiceFactory firebaseServiceFactory,
 119        IOpenAiServiceFactory openAiServiceFactory,
 120        ILangfusePublicApiClient langfuseClient,
 121        ILogger<RunCommunityToDateCommand> logger)
 22    {
 123        _console = console;
 124        _executor = new PreparedExperimentRunExecutor(firebaseServiceFactory, openAiServiceFactory, langfuseClient);
 125        _logger = logger;
 126    }
 27
 28    protected override async Task<int> ExecuteAsync(CommandContext context, RunCommunityToDateSettings settings, Cancell
 29    {
 30        try
 31        {
 132            var summary = await _executor.ExecuteCommunityToDateAsync(
 133                new PreparedExperimentCommunityRunRequest(
 134                    settings.ManifestPath,
 135                    settings.RunFamilyName,
 136                    settings.RunDescription,
 137                    settings.DatasetName,
 138                    settings.ReplaceRuns,
 139                    settings.BatchSize,
 140                    settings.ParticipantLimit,
 141                    settings.GetParticipantIdFilter()),
 142                cancellationToken);
 43
 144            _console.WriteLine(JsonSerializer.Serialize(summary, PreparedExperimentCommandSupport.JsonOptions));
 145            return 0;
 46        }
 047        catch (Exception ex)
 48        {
 049            _logger.LogError(ex, "Error executing run-community-to-date command");
 050            _console.MarkupLine($"[red]Error:[/] {Markup.Escape(ex.Message)}");
 051            return 1;
 52        }
 153    }
 54}