< Summary

Information
Class: Orchestrator.Commands.Observability.PrepareSlice.PrepareSliceSettings
Assembly: Orchestrator
File(s): /home/runner/work/KicktippAi/KicktippAi/src/Orchestrator/Commands/Observability/PrepareSlice/PrepareSliceSettings.cs
Line coverage
73%
Covered lines: 19
Uncovered lines: 7
Coverable lines: 26
Total lines: 111
Line coverage: 73%
Branch coverage
62%
Covered branches: 15
Total branches: 24
Branch coverage: 62.5%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor()100%11100%
Validate()62.5%432468.18%

File(s)

/home/runner/work/KicktippAi/KicktippAi/src/Orchestrator/Commands/Observability/PrepareSlice/PrepareSliceSettings.cs

#LineLine coverage
 1using System.ComponentModel;
 2using Spectre.Console;
 3using Spectre.Console.Cli;
 4
 5namespace Orchestrator.Commands.Observability.PrepareSlice;
 6
 7public sealed class PrepareSliceSettings : CommandSettings
 8{
 9    [CommandOption("--community-context")]
 10    [Description("Community context used to scope persisted historical match outcomes")]
 111    public string CommunityContext { get; set; } = string.Empty;
 12
 13    [CommandOption("--matchdays")]
 14    [Description("Optional comma-separated list of matchdays to sample from. Defaults to all Bundesliga matchdays.")]
 15    public string? Matchdays { get; set; }
 16
 17    [CommandOption("--sample-size")]
 18    [Description("Number of dataset items to sample")]
 19    [DefaultValue(10)]
 120    public int SampleSize { get; set; } = 10;
 21
 22    [CommandOption("--sample-seed")]
 23    [Description("Optional deterministic seed for random slice selection. Defaults to the current UTC date in yyyyMMdd f
 24    public int? SampleSeed { get; set; }
 25
 26    [CommandOption("--starts-after")]
 27    [Description("Optional match start cutoff in NodaTime invariant ZonedDateTime 'G' format. Only matches strictly afte
 28    public string? StartsAfter { get; set; }
 29
 30    [CommandOption("--slice-key")]
 31    [Description("Optional slice key override. Defaults to random-<sample-size>-seed-<sample-seed>")]
 32    public string? SliceKey { get; set; }
 33
 34    [CommandOption("--slice-kind")]
 35    [Description("Logical slice kind metadata tag")]
 36    [DefaultValue("random-sample")]
 137    public string SliceKind { get; set; } = "random-sample";
 38
 39    [CommandOption("--sample-method")]
 40    [Description("Logical sample selection method metadata tag")]
 41    [DefaultValue("random-sample")]
 142    public string SampleMethod { get; set; } = "random-sample";
 43
 44    [CommandOption("--source-pool-key")]
 45    [Description("Optional source pool identifier used in dataset names and output paths. Defaults to all-matchdays")]
 46    public string? SourcePoolKey { get; set; }
 47
 48    [CommandOption("--dataset-name")]
 49    [Description("Optional hosted dataset name override for the prepared slice")]
 50    public string? DatasetName { get; set; }
 51
 52    [CommandOption("--output-directory")]
 53    [Description("Optional output directory override. Defaults to artifacts/langfuse-experiments/slices/<community>/<sou
 54    public string? OutputDirectory { get; set; }
 55
 56    public override ValidationResult Validate()
 57    {
 158        if (string.IsNullOrWhiteSpace(CommunityContext))
 59        {
 060            return ValidationResult.Error("--community-context is required");
 61        }
 62
 163        if (SampleSize < 1)
 64        {
 065            return ValidationResult.Error("--sample-size must be at least 1");
 66        }
 67
 168        if (string.IsNullOrWhiteSpace(SliceKind))
 69        {
 070            return ValidationResult.Error("--slice-kind must be a non-empty string");
 71        }
 72
 173        if (string.IsNullOrWhiteSpace(SampleMethod))
 74        {
 075            return ValidationResult.Error("--sample-method must be a non-empty string");
 76        }
 77
 178        if (!string.IsNullOrWhiteSpace(StartsAfter))
 79        {
 80            try
 81            {
 182                _ = EvaluationTimeParser.Parse(StartsAfter);
 183            }
 84            catch (ArgumentException ex)
 85            {
 186                return ValidationResult.Error(ex.Message);
 87            }
 88        }
 89
 190        if (string.IsNullOrWhiteSpace(Matchdays))
 91        {
 092            return ValidationResult.Success();
 93        }
 94
 195        var segments = Matchdays.Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
 196        if (segments.Length == 0)
 97        {
 098            return ValidationResult.Error("--matchdays must contain at least one matchday number when provided");
 99        }
 100
 1101        foreach (var segment in segments)
 102        {
 1103            if (!int.TryParse(segment, out var matchday) || matchday is < 1 or > 34)
 104            {
 0105                return ValidationResult.Error($"Invalid matchday '{segment}'. Expected an integer between 1 and 34.");
 106            }
 107        }
 108
 1109        return ValidationResult.Success();
 1110    }
 111}

Methods/Properties

.ctor()
Validate()