Skip to content

Fix invalid test dates and redundant step-name prefix in precondition schema errors - #240

Merged
blindzero merged 4 commits into
codex/review-preconditions-dsl-for-duplicatesfrom
copilot/sub-pr-239
Feb 26, 2026
Merged

blindzero merged 4 commits into
codex/review-preconditions-dsl-for-duplicatesfrom
copilot/sub-pr-239

Conversation

Copilot AI commented Feb 26, 2026 •

Copy link
Copy Markdown
Contributor
  • Fix invalid dates (2026-02-30 → 2026-02-28) in test file (lines 20, 38, 56, 74)
  • Fix redundant step-name prefix in Test-IdleWorkflowSchema.ps1 line 80 (pass $null instead of $StepPath)
  • Fix Export-IdlePlan.Tests.ps1 container parse error: add Context 'Planning warnings export' wrapper around orphaned It block
  • Fix planning warnings not generated: ConvertTo-IdleWorkflowStepPreconditionSettings.ps1 — avoid PowerShell pipeline unrolling of empty ArrayList by accessing property directly via PSObject/IDictionary instead of through Get-IdlePropertyValue
  • Fix warning export: Get-FirstPropertyValue in ConvertTo-IdlePlanExportObject.ps1 now handles IDictionary objects (ordered hashtables) in addition to PSCustomObjects
  • Fix 4 failing Test-IdleWorkflowSchema.Tests.ps1 tests:
    • Escape brackets in -like patterns: [0] → `[0`] (PowerShell treats [n] as character class in -like, so *Steps[0].Condition* was never matching the literal Steps[0].Condition)
    • Wrap return value with @() for .Count check: @($errors).Count instead of $errors.Count (empty result is $null when pipeline-enumerated; $null.Count throws with Set-StrictMode -Version Latest)

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…ma errors

Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix precondition handling and valid date usage in PR #239 Fix invalid test dates and redundant step-name prefix in precondition schema errors Feb 26, 2026
@blindzero
blindzero marked this pull request as ready for review February 26, 2026 09:32
@blindzero
blindzero requested a review from Copilot February 26, 2026 09:52
@github-actions

github-actions Bot commented Feb 26, 2026 •

Copy link
Copy Markdown

Code Coverage Report

Overall Project 73.86% 🍏

There is no coverage information present for the Files changed

@blindzero blindzero left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot please fix bad tests

Container failed: 1
  - /home/runner/work/IdentityLifecycleEngine/IdentityLifecycleEngine/tests/Core/Export-IdlePlan.Tests.ps1

…s generation

Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>

Copilot AI commented Feb 26, 2026

Copy link
Copy Markdown
Contributor Author

@copilot please fix bad tests

Container failed: 1...

Fixed in 34f5ff4. Three root causes addressed:

  1. Container parse error — Export-IdlePlan.Tests.ps1 had an orphaned It 'includes planning warnings...' block sitting outside any Context, causing a brace mismatch. Added Context 'Planning warnings export' wrapper around it.

  2. Planning warnings not generated — ConvertTo-IdleWorkflowStepPreconditionSettings.ps1 was passing (Get-IdlePropertyValue ... 'Warnings') as -WarningSink, but PowerShell's pipeline silently collapses empty collections (the initial empty ArrayList) to $null. Fixed by accessing the property directly via PSObject.Properties/IDictionary assignment (no pipeline traversal).

  3. Warning fields null in JSON export — Get-FirstPropertyValue in ConvertTo-IdlePlanExportObject.ps1 only checked PSObject.Properties, which doesn't work for OrderedDictionary keys. Added IDictionary.Contains() handling so ordered hashtable warning items serialize correctly.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@blindzero blindzero left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot
please fix the failing 4 pester tests

Running tests from '/home/runner/work/IdentityLifecycleEngine/IdentityLifecycleEngine/tests/Core/Test-IdleWorkflowSchema.Tests.ps1'
Describing Workflow schema validation - Condition/Precondition DSL parity
Error: [-] rejects invalid Condition DSL nodes at definition validation time 10ms (8ms|1ms)
Message
Error: [-] rejects invalid Condition DSL nodes in OnFailureSteps at definition validation time 17ms (16ms|1ms)
Message
Error: [-] rejects invalid Precondition DSL node at definition validation time 5ms (4ms|1ms)
Message
Error: [-] accepts valid precondition using the same condition DSL 4ms (3ms|1ms)
Message

…atterns

Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>

Copilot AI commented Feb 26, 2026

Copy link
Copy Markdown
Contributor Author

@copilot
please fix the failing 4 pester tests

Fixed in 30b19a0. Two root causes:

  1. Bracket escaping in -like patterns (tests 1–3): PowerShell's -like treats [n] as a character class (matching a single char), so *Steps[0].Condition* was never matching the literal string Steps[0].Condition. Fixed by backtick-escaping: *Steps`[0`].Condition*.

  2. Null-safe .Count check (test 4): Test-IdleWorkflowSchema returns a List[string] that gets enumerated through the output pipeline — an empty list yields $null at the caller. With Set-StrictMode -Version Latest, $null.Count throws PropertyNotFoundException. Fixed by using @($errors).Count instead.

@blindzero
blindzero merged commit 683a35d into codex/review-preconditions-dsl-for-duplicates Feb 26, 2026
5 checks passed
@blindzero
blindzero deleted the copilot/sub-pr-239 branch February 27, 2026 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants