diff --git a/src/IdLE.Core/Private/ConvertTo-IdlePlanExportObject.ps1 b/src/IdLE.Core/Private/ConvertTo-IdlePlanExportObject.ps1 index 9c18cba7..e524ddbe 100644 --- a/src/IdLE.Core/Private/ConvertTo-IdlePlanExportObject.ps1 +++ b/src/IdLE.Core/Private/ConvertTo-IdlePlanExportObject.ps1 @@ -41,6 +41,12 @@ function ConvertTo-IdlePlanExportObject { ) foreach ($name in $Names) { + if ($Object -is [System.Collections.IDictionary]) { + if ($Object.Contains($name)) { + return $Object[$name] + } + continue + } $prop = $Object.PSObject.Properties[$name] if ($null -ne $prop) { return $prop.Value diff --git a/src/IdLE.Core/Private/ConvertTo-IdleWorkflowStepPreconditionSettings.ps1 b/src/IdLE.Core/Private/ConvertTo-IdleWorkflowStepPreconditionSettings.ps1 index f03f8c31..b5d44813 100644 --- a/src/IdLE.Core/Private/ConvertTo-IdleWorkflowStepPreconditionSettings.ps1 +++ b/src/IdLE.Core/Private/ConvertTo-IdleWorkflowStepPreconditionSettings.ps1 @@ -42,7 +42,17 @@ function ConvertTo-IdleWorkflowStepPreconditionSettings { ) } - Assert-IdleConditionPathsResolvable -Condition ([hashtable]$rawPrecondition) -Context $PlanningContext -StepName $StepName -Source 'Precondition' -AllowMissingRequestContextPaths -WarningSink (Get-IdlePropertyValue -Object $PlanningContext.Plan -Name 'Warnings') + $warningSink = $null + $planObj = $PlanningContext.Plan + if ($null -ne $planObj) { + if ($planObj -is [System.Collections.IDictionary]) { + if ($planObj.Contains('Warnings')) { $warningSink = $planObj['Warnings'] } + } else { + $wProp = $planObj.PSObject.Properties['Warnings'] + if ($null -ne $wProp) { $warningSink = $wProp.Value } + } + } + Assert-IdleConditionPathsResolvable -Condition ([hashtable]$rawPrecondition) -Context $PlanningContext -StepName $StepName -Source 'Precondition' -AllowMissingRequestContextPaths -WarningSink $warningSink $normalized.Precondition = Copy-IdleDataObject -Value $rawPrecondition } } diff --git a/src/IdLE.Core/Private/Test-IdleWorkflowSchema.ps1 b/src/IdLE.Core/Private/Test-IdleWorkflowSchema.ps1 index 31cde44b..75671529 100644 --- a/src/IdLE.Core/Private/Test-IdleWorkflowSchema.ps1 +++ b/src/IdLE.Core/Private/Test-IdleWorkflowSchema.ps1 @@ -77,7 +77,7 @@ function Test-IdleWorkflowSchema { $ErrorList.Add("'$StepPath.Precondition' must be a hashtable (condition node).") } else { - foreach ($schemaError in (Test-IdleConditionSchema -Condition ([hashtable]$Step.Precondition) -StepName $StepPath)) { + foreach ($schemaError in (Test-IdleConditionSchema -Condition ([hashtable]$Step.Precondition) -StepName $null)) { $ErrorList.Add("'$StepPath.Precondition' has invalid condition schema: $schemaError") } } diff --git a/tests/Core/Assert-IdleConditionPathsResolvable.Tests.ps1 b/tests/Core/Assert-IdleConditionPathsResolvable.Tests.ps1 index 96551e97..3b78f425 100644 --- a/tests/Core/Assert-IdleConditionPathsResolvable.Tests.ps1 +++ b/tests/Core/Assert-IdleConditionPathsResolvable.Tests.ps1 @@ -17,7 +17,7 @@ Describe 'Assert-IdleConditionPathsResolvable' { $context = @{ Plan = @{ LifecycleEvent = 'Joiner' } - Request = @{ Intent = @{ OffboardingDate = '2026-02-30' }; Context = @{}; IdentityKeys = @{} } + Request = @{ Intent = @{ OffboardingDate = '2026-02-28' }; Context = @{}; IdentityKeys = @{} } } { @@ -35,7 +35,7 @@ Describe 'Assert-IdleConditionPathsResolvable' { $context = @{ Plan = @{ LifecycleEvent = 'Joiner' } - Request = @{ Intent = @{ OffboardingDate = '2026-02-30' }; Context = @{}; IdentityKeys = @{} } + Request = @{ Intent = @{ OffboardingDate = '2026-02-28' }; Context = @{}; IdentityKeys = @{} } } { @@ -53,7 +53,7 @@ Describe 'Assert-IdleConditionPathsResolvable' { $context = @{ Plan = @{ LifecycleEvent = 'Joiner' } - Request = @{ Intent = @{ OffboardingDate = '2026-02-30' }; Context = @{}; IdentityKeys = @{} } + Request = @{ Intent = @{ OffboardingDate = '2026-02-28' }; Context = @{}; IdentityKeys = @{} } } { @@ -71,7 +71,7 @@ Describe 'Assert-IdleConditionPathsResolvable' { $context = @{ Plan = @{ LifecycleEvent = 'Joiner' } - Request = @{ Intent = @{ OffboardingDate = '2026-02-30' }; Context = @{}; IdentityKeys = @{} } + Request = @{ Intent = @{ OffboardingDate = '2026-02-28' }; Context = @{}; IdentityKeys = @{} } } { diff --git a/tests/Core/Export-IdlePlan.Tests.ps1 b/tests/Core/Export-IdlePlan.Tests.ps1 index 3ea6d0d2..8d45f92c 100644 --- a/tests/Core/Export-IdlePlan.Tests.ps1 +++ b/tests/Core/Export-IdlePlan.Tests.ps1 @@ -80,7 +80,7 @@ Describe 'Export-IdlePlan' { } } - + Context 'Planning warnings export' { It 'includes planning warnings in exported plan for CI checks' { $cid = '22222222-2222-2222-2222-222222222222' diff --git a/tests/Core/Test-IdleWorkflowSchema.Tests.ps1 b/tests/Core/Test-IdleWorkflowSchema.Tests.ps1 index 1caf4eb2..37396e44 100644 --- a/tests/Core/Test-IdleWorkflowSchema.Tests.ps1 +++ b/tests/Core/Test-IdleWorkflowSchema.Tests.ps1 @@ -21,7 +21,7 @@ Describe 'Workflow schema validation - Condition/Precondition DSL parity' { } $errors = Test-IdleWorkflowSchema -Workflow $workflow - @($errors | Where-Object { $_ -like "*Steps[0].Condition*invalid condition schema*" }).Count | Should -BeGreaterThan 0 + @($errors | Where-Object { $_ -like "*Steps``[0``].Condition*invalid condition schema*" }).Count | Should -BeGreaterThan 0 } It 'rejects invalid Condition DSL nodes in OnFailureSteps at definition validation time' { @@ -41,7 +41,7 @@ Describe 'Workflow schema validation - Condition/Precondition DSL parity' { } $errors = Test-IdleWorkflowSchema -Workflow $workflow - @($errors | Where-Object { $_ -like "*OnFailureSteps[0].Condition*invalid condition schema*" }).Count | Should -BeGreaterThan 0 + @($errors | Where-Object { $_ -like "*OnFailureSteps``[0``].Condition*invalid condition schema*" }).Count | Should -BeGreaterThan 0 } It 'rejects invalid Precondition DSL node at definition validation time' { @@ -58,7 +58,7 @@ Describe 'Workflow schema validation - Condition/Precondition DSL parity' { } $errors = Test-IdleWorkflowSchema -Workflow $workflow - @($errors | Where-Object { $_ -like "*Steps[0].Precondition*invalid condition schema*" }).Count | Should -BeGreaterThan 0 + @($errors | Where-Object { $_ -like "*Steps``[0``].Precondition*invalid condition schema*" }).Count | Should -BeGreaterThan 0 } It 'accepts valid precondition using the same condition DSL' { @@ -81,7 +81,7 @@ Describe 'Workflow schema validation - Condition/Precondition DSL parity' { } $errors = Test-IdleWorkflowSchema -Workflow $workflow - $errors.Count | Should -Be 0 + @($errors).Count | Should -Be 0 } } }