Complete batch 012 (golden set diff) and 013 (advisory chat), fix build errors
Sprints completed: - SPRINT_20260110_012_* (golden set diff layer - 10 sprints) - SPRINT_20260110_013_* (advisory chat - 4 sprints) Build fixes applied: - Fix namespace conflicts with Microsoft.Extensions.Options.Options.Create - Fix VexDecisionReachabilityIntegrationTests API drift (major rewrite) - Fix VexSchemaValidationTests FluentAssertions method name - Fix FixChainGateIntegrationTests ambiguous type references - Fix AdvisoryAI test files required properties and namespace aliases - Add stub types for CveMappingController (ICveSymbolMappingService) - Fix VerdictBuilderService static context issue Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,89 @@
|
||||
// Licensed under AGPL-3.0-or-later. Copyright (C) 2026 StellaOps Contributors.
|
||||
// Sprint: SPRINT_20260110_012_008_POLICY
|
||||
// Task: FCG-003 - Policy Engine Integration
|
||||
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
using StellaOps.Policy.Gates;
|
||||
|
||||
namespace StellaOps.Policy.Predicates.FixChain;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for registering FixChain gate services.
|
||||
/// </summary>
|
||||
public static class FixChainGateExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Adds FixChain gate predicate services to the service collection.
|
||||
/// </summary>
|
||||
/// <param name="services">Service collection.</param>
|
||||
/// <param name="configuration">Configuration section for options.</param>
|
||||
/// <returns>Service collection for chaining.</returns>
|
||||
public static IServiceCollection AddFixChainGate(
|
||||
this IServiceCollection services,
|
||||
IConfiguration? configuration = null)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(services);
|
||||
|
||||
// Register options
|
||||
if (configuration is not null)
|
||||
{
|
||||
services.AddOptions<FixChainGateOptions>()
|
||||
.Bind(configuration.GetSection("Policy:Predicates:FixChainGate"))
|
||||
.ValidateDataAnnotations()
|
||||
.ValidateOnStart();
|
||||
}
|
||||
else
|
||||
{
|
||||
services.TryAddSingleton(new FixChainGateOptions());
|
||||
}
|
||||
|
||||
// Register core services
|
||||
services.TryAddSingleton<IFixChainGatePredicate, FixChainGatePredicate>();
|
||||
services.TryAddSingleton<IFixChainGateBatchService, FixChainGateBatchService>();
|
||||
|
||||
// Register adapter for policy gate registry
|
||||
services.TryAddSingleton<FixChainGateAdapter>();
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds FixChain gate predicate services with custom options.
|
||||
/// </summary>
|
||||
/// <param name="services">Service collection.</param>
|
||||
/// <param name="configureOptions">Options configuration delegate.</param>
|
||||
/// <returns>Service collection for chaining.</returns>
|
||||
public static IServiceCollection AddFixChainGate(
|
||||
this IServiceCollection services,
|
||||
Action<FixChainGateOptions> configureOptions)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(services);
|
||||
ArgumentNullException.ThrowIfNull(configureOptions);
|
||||
|
||||
services.Configure(configureOptions);
|
||||
|
||||
// Register core services
|
||||
services.TryAddSingleton<IFixChainGatePredicate, FixChainGatePredicate>();
|
||||
services.TryAddSingleton<IFixChainGateBatchService, FixChainGateBatchService>();
|
||||
|
||||
// Register adapter for policy gate registry
|
||||
services.TryAddSingleton<FixChainGateAdapter>();
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers the FixChain gate with the policy gate registry.
|
||||
/// </summary>
|
||||
/// <param name="registry">Policy gate registry.</param>
|
||||
/// <returns>Registry for chaining.</returns>
|
||||
public static IPolicyGateRegistry RegisterFixChainGate(this IPolicyGateRegistry registry)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(registry);
|
||||
|
||||
registry.Register<FixChainGateAdapter>("fixChainRequired");
|
||||
return registry;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user