Skip to content

Extract workflow step precondition handling, improve schema validation, and add tests#239

Merged
blindzero merged 14 commits intomainfrom
codex/review-preconditions-dsl-for-duplicates
Feb 26, 2026
Merged

Extract workflow step precondition handling, improve schema validation, and add tests#239
blindzero merged 14 commits intomainfrom
codex/review-preconditions-dsl-for-duplicates

Conversation

@blindzero
Copy link
Copy Markdown
Owner

Motivation

  • Centralize and reuse validation/normalization of step precondition settings and ensure condition DSL parity between Condition and Preconditions validation.
  • Reduce code duplication in step conversion and harden workflow schema validation for both Steps and OnFailureSteps collections.

Description

  • Add ConvertTo-IdleWorkflowStepPreconditionSettings to validate, normalize, and deep-copy Preconditions, OnPreconditionFalse, and PreconditionEvent into a stable shape.
  • Update ConvertTo-IdleWorkflowSteps to call ConvertTo-IdleWorkflowStepPreconditionSettings and assign Preconditions, OnPreconditionFalse, and PreconditionEvent from the returned object.
  • Refactor Test-IdleWorkflowSchema by introducing Test-IdleWorkflowStepCondition and Test-IdleWorkflowStepCollection, improve Preconditions schema error reporting, and centralize collection validation and duplicate-name checks.
  • Add Pester unit tests under tests/Core: ConvertTo-IdleWorkflowStepPreconditionSettings.Tests.ps1 for the new converter and Test-IdleWorkflowSchema.Tests.ps1 to verify Condition/Precondition DSL parity and related validation rules.

Testing

  • Ran the module unit tests via Invoke-Pester against the tests/Core suite which includes the newly added tests for precondition conversion and schema validation, and they passed.
  • The new tests include cases for missing precondition settings, normalization and deep-copy behavior, invalid OnPreconditionFalse values, and invalid/valid condition/precondition DSL nodes.
  • No test failures were observed in the modified test suite.

Codex Task

Copilot AI review requested due to automatic review settings February 25, 2026 13:37
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 25, 2026

Code Coverage Report

Overall Project 73.86% 🍏

There is no coverage information present for the Files changed

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request extracts and centralizes workflow step precondition handling logic, improves schema validation to ensure Condition/Precondition DSL parity, and adds comprehensive unit tests.

Changes:

  • Extracted precondition validation logic into a dedicated private function ConvertTo-IdleWorkflowStepPreconditionSettings for reusability
  • Enhanced Test-IdleWorkflowSchema by adding Test-IdleConditionSchema validation for both Condition and Preconditions fields, ensuring DSL parity
  • Refactored step collection validation into Test-IdleWorkflowStepCollection helper to reduce duplication between Steps and OnFailureSteps validation

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/IdLE.Core/Private/ConvertTo-IdleWorkflowStepPreconditionSettings.ps1 New function that validates, normalizes, and deep-copies step precondition settings (Preconditions, OnPreconditionFalse, PreconditionEvent)
src/IdLE.Core/Private/ConvertTo-IdleWorkflowSteps.ps1 Refactored to delegate precondition handling to the new converter function, reducing ~90 lines of duplicated validation logic
src/IdLE.Core/Private/Test-IdleWorkflowSchema.ps1 Added Test-IdleWorkflowStepCondition and Test-IdleWorkflowStepCollection helpers; enhanced Preconditions validation to use Test-IdleConditionSchema for DSL parity
tests/Core/ConvertTo-IdleWorkflowStepPreconditionSettings.Tests.ps1 New unit tests covering precondition normalization, deep-copy behavior, and invalid value handling
tests/Core/Test-IdleWorkflowSchema.Tests.ps1 New unit tests verifying Condition/Precondition DSL parity and schema validation for both Steps and OnFailureSteps

Comment thread tests/Core/Test-IdleWorkflowSchema.Tests.ps1 Outdated
Copilot AI review requested due to automatic review settings February 25, 2026 16:10
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.

Comment thread src/IdLE.Core/Private/ConvertTo-IdleWorkflowStepPreconditionSettings.ps1 Outdated
Comment thread src/IdLE.Core/Private/Test-IdleWorkflowSchema.ps1 Outdated
Comment thread src/IdLE.Core/Private/Test-IdleWorkflowSchema.ps1 Outdated
Comment thread src/IdLE.Core/Private/Test-IdleWorkflowSchema.ps1
Comment thread src/IdLE.Core/Private/Test-IdleWorkflowSchema.ps1 Outdated
Comment thread src/IdLE.Core/Private/ConvertTo-IdleWorkflowStepPreconditionSettings.ps1 Outdated
Copilot AI review requested due to automatic review settings February 25, 2026 16:27
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 27 out of 27 changed files in this pull request and generated 4 comments.

Comment thread tests/Core/Assert-IdleConditionPathsResolvable.Tests.ps1 Outdated
Comment thread tests/Core/Assert-IdleConditionPathsResolvable.Tests.ps1 Outdated
Comment thread src/IdLE.Core/Private/Assert-IdleConditionPathsResolvable.ps1 Outdated
Comment thread tests/Core/Assert-IdleConditionPathsResolvable.Tests.ps1 Outdated
Copilot AI review requested due to automatic review settings February 25, 2026 17:36
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 31 out of 31 changed files in this pull request and generated 2 comments.

Comment thread tests/Core/Assert-IdleConditionPathsResolvable.Tests.ps1 Outdated
Comment thread tests/Core/Export-IdlePlan.Tests.ps1
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 25, 2026 20:13
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 31 out of 31 changed files in this pull request and generated no new comments.

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 26, 2026

@blindzero I've opened a new pull request, #240, to work on those changes. Once the pull request is ready, I'll request review from you.

…ma errors

Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
Copilot AI and others added 3 commits February 26, 2026 11:09
…s generation

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

Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
Fix invalid test dates and redundant step-name prefix in precondition schema errors
@blindzero blindzero self-assigned this Feb 26, 2026
@blindzero blindzero merged commit 7c9daa4 into main Feb 26, 2026
8 checks passed
@blindzero blindzero deleted the codex/review-preconditions-dsl-for-duplicates 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants