audit notes work completed, test fixes work (95% done), new sprints, new data sources setup and configuration

This commit is contained in:
master
2026-01-14 10:48:00 +02:00
parent d7be6ba34b
commit 95d5898650
379 changed files with 40695 additions and 19041 deletions

View File

@@ -1,4 +1,5 @@
using System.CommandLine;
using System.CommandLine.Invocation;
using System.CommandLine.Parsing;
using System.Collections.Immutable;
using System.Text;
@@ -11,7 +12,7 @@ namespace StellaOps.Tools.GoldenPairs;
public static class GoldenPairsApp
{
public static Task<int> RunAsync(string[] args)
public static int RunAsync(string[] args)
{
var repoRootOption = new Option<DirectoryInfo?>("--repo-root")
{
@@ -24,21 +25,22 @@ public static class GoldenPairsApp
};
var root = new RootCommand("Golden pairs corpus tooling.");
root.AddGlobalOption(repoRootOption);
root.AddGlobalOption(datasetRootOption);
root.Add(repoRootOption);
root.Add(datasetRootOption);
root.AddCommand(BuildMirrorCommand(repoRootOption, datasetRootOption));
root.AddCommand(BuildDiffCommand(repoRootOption, datasetRootOption));
root.AddCommand(BuildValidateCommand(repoRootOption, datasetRootOption));
root.Add(BuildMirrorCommand(repoRootOption, datasetRootOption));
root.Add(BuildDiffCommand(repoRootOption, datasetRootOption));
root.Add(BuildValidateCommand(repoRootOption, datasetRootOption));
return root.InvokeAsync(args);
var parseResult = root.Parse(args);
return parseResult.Invoke();
}
private static Command BuildMirrorCommand(Option<DirectoryInfo?> repoRootOption, Option<DirectoryInfo?> datasetRootOption)
{
var cveArgument = new Argument<string>("cve", "CVE identifier to mirror.");
var cveArgument = new Argument<string>("cve") { Description = "CVE identifier to mirror." };
var command = new Command("mirror", "Fetch artifacts for a golden pair.");
command.AddArgument(cveArgument);
command.Add(cveArgument);
command.SetAction(async (parseResult, cancellationToken) =>
{
@@ -95,16 +97,16 @@ public static class GoldenPairsApp
private static Command BuildDiffCommand(Option<DirectoryInfo?> repoRootOption, Option<DirectoryInfo?> datasetRootOption)
{
var cveArgument = new Argument<string>("cve", "CVE identifier to diff.");
var cveArgument = new Argument<string>("cve") { Description = "CVE identifier to diff." };
var command = new Command("diff", "Run diff analysis on a golden pair.");
command.AddArgument(cveArgument);
command.Add(cveArgument);
var outputOption = new Option<string>("--output")
{
Description = "Output format: json or table.",
DefaultValueFactory = _ => "json"
};
command.AddOption(outputOption);
command.Add(outputOption);
command.SetAction(async (parseResult, cancellationToken) =>
{
@@ -166,7 +168,7 @@ public static class GoldenPairsApp
{
Description = "Stop at first failure."
};
command.AddOption(failFastOption);
command.Add(failFastOption);
command.SetAction(async (parseResult, cancellationToken) =>
{

View File

@@ -1,3 +1,3 @@
using StellaOps.Tools.GoldenPairs;
return await GoldenPairsApp.RunAsync(args);
return GoldenPairsApp.RunAsync(args);

View File

@@ -219,7 +219,7 @@ public sealed class AptPackageMirrorService : IPackageMirrorService
using var debArchive = ArchiveFactory.Open(debPath);
var dataEntry = debArchive.Entries
.FirstOrDefault(entry => entry.Key.StartsWith("data.tar", StringComparison.OrdinalIgnoreCase));
.FirstOrDefault(entry => entry.Key != null && entry.Key.StartsWith("data.tar", StringComparison.OrdinalIgnoreCase));
if (dataEntry is null)
{
throw new InvalidOperationException("Deb archive missing data.tar payload.");
@@ -228,14 +228,14 @@ public sealed class AptPackageMirrorService : IPackageMirrorService
using var dataStream = dataEntry.OpenEntryStream();
using var dataArchive = ArchiveFactory.Open(dataStream);
var fileEntry = dataArchive.Entries
.FirstOrDefault(entry => string.Equals(NormalizeArchivePath(entry.Key), normalizedPath, StringComparison.Ordinal));
.FirstOrDefault(entry => entry.Key != null && string.Equals(NormalizeArchivePath(entry.Key!), normalizedPath, StringComparison.Ordinal));
if (fileEntry is null)
{
throw new FileNotFoundException($"Path '{pathInPackage}' not found inside deb archive.");
}
var outputPath = Path.Combine(destination, Path.GetFileName(normalizedPath));
var outputPath = Path.Combine(destination, Path.GetFileName(normalizedPath)!);
fileEntry.WriteToFile(outputPath, new ExtractionOptions
{
ExtractFullPath = false,