namespace StellaOps.AdvisoryAI.Remediation; /// /// Authority level of the remediation plan. /// public enum RemediationAuthority { /// /// Verified: build passed, tests passed, delta verified. /// Verified, /// /// Suggestion: requires human review (build/tests failed or not run). /// Suggestion, /// /// Draft: initial plan not yet verified. /// Draft } /// /// Risk level of the remediation. /// public enum RemediationRisk { /// /// Low risk: patch version bump. /// Low, /// /// Medium risk: minor version bump. /// Medium, /// /// High risk: major version bump or breaking changes. /// High, /// /// Unknown risk: unable to determine. /// Unknown } /// /// A single step in a remediation plan. /// public sealed record RemediationStep { /// /// Step number (1-based). /// public required int Order { get; init; } /// /// Type of action (update_package, update_lockfile, update_config, run_command, etc.). /// public required string ActionType { get; init; } /// /// File path affected. /// public required string FilePath { get; init; } /// /// Description of the change. /// public required string Description { get; init; } /// /// Previous value (for diff). /// public string? PreviousValue { get; init; } /// /// New value (for diff). /// public string? NewValue { get; init; } /// /// Whether this step is optional. /// public bool Optional { get; init; } /// /// Risk assessment for this step. /// public RemediationRisk Risk { get; init; } = RemediationRisk.Low; } /// /// Expected SBOM delta after remediation. /// public sealed record ExpectedSbomDelta { /// /// Components to be added. /// public required IReadOnlyList Added { get; init; } /// /// Components to be removed. /// public required IReadOnlyList Removed { get; init; } /// /// Components to be upgraded (old_purl → new_purl). /// public required IReadOnlyDictionary Upgraded { get; init; } /// /// Net vulnerability change (negative = improvement). /// public required int NetVulnerabilityChange { get; init; } } /// /// Test requirements for verifying remediation. /// public sealed record RemediationTestRequirements { /// /// Required test suites to run. /// public required IReadOnlyList TestSuites { get; init; } /// /// Minimum coverage required. /// public double MinCoverage { get; init; } /// /// Whether all tests must pass. /// public bool RequireAllPass { get; init; } = true; /// /// Timeout for test execution. /// public TimeSpan Timeout { get; init; } = TimeSpan.FromMinutes(30); } /// /// A complete remediation plan. /// Sprint: SPRINT_20251226_016_AI_remedy_autopilot /// Task: REMEDY-05 /// public sealed record RemediationPlan { /// /// Unique plan ID. /// public required string PlanId { get; init; } /// /// Original request. /// public required RemediationPlanRequest Request { get; init; } /// /// Remediation steps to apply. /// public required IReadOnlyList Steps { get; init; } /// /// Expected SBOM delta. /// public required ExpectedSbomDelta ExpectedDelta { get; init; } /// /// Overall risk assessment. /// public required RemediationRisk RiskAssessment { get; init; } /// /// Test requirements. /// public required RemediationTestRequirements TestRequirements { get; init; } /// /// Authority classification. /// public required RemediationAuthority Authority { get; init; } /// /// PR-ready flag (true if plan can be applied automatically). /// public required bool PrReady { get; init; } /// /// Reason if not PR-ready. /// public string? NotReadyReason { get; init; } /// /// Confidence score (0.0-1.0). /// public required double ConfidenceScore { get; init; } /// /// Model ID used for generation. /// public required string ModelId { get; init; } /// /// Generated timestamp (UTC ISO-8601). /// public required string GeneratedAt { get; init; } /// /// Input hashes for replay. /// public required IReadOnlyList InputHashes { get; init; } /// /// Evidence refs used in planning. /// public required IReadOnlyList EvidenceRefs { get; init; } }