Skip to content

Skip With template resolution and WithSchema validation for condition-skipped steps during plan building#270

Merged
blindzero merged 5 commits intomainfrom
copilot/skip-template-resolution-validation
Mar 20, 2026
Merged

Skip With template resolution and WithSchema validation for condition-skipped steps during plan building#270
blindzero merged 5 commits intomainfrom
copilot/skip-template-resolution-validation

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 15, 2026

  • Fix ConvertTo-IdleWorkflowSteps.ps1: skip With template resolution and WithSchema validation for NotApplicable steps
  • Fix ConvertTo-IdleWorkflowSteps.ps1: pass -ExcludeExistsOperatorPaths to Assert-IdleConditionPathsResolvable for step Conditions, so Exists on an absent path no longer throws before the condition can evaluate
  • Add 5 unit tests covering condition-skip behaviour (both branches, including Exists-on-absent-path)
  • Add fixture condition-exists-absent.psd1 for the Exists-on-absent-context-path scenario
  • Document condition guard behaviour and Exists operator semantics in conditions.md
  • Move all test workflow definitions from inline Here-Strings to fixture files
  • Restore and pluralise the ## Conditions DSL heading in conditions.md
  • All tests pass
  • PSSA: no findings
Original prompt

This section details on the original issue you should resolve

<issue_title>Skip With-template resolution and WithSchema validation for condition-skipped steps during plan building</issue_title>
<issue_description>## Problem Statement

During plan building, a workflow step can already be determined as not applicable because its Condition evaluates to false against the current request and context.

However, the current planning flow still continues with later plan-time processing for that same step, including With template resolution and WithSchema validation. This can produce false-positive planning failures for steps that would never be executed.

Typical examples are steps guarded by a condition such as checking whether a required identity attribute exists. If the attribute is missing, the condition correctly makes the step not applicable. But plan-time With processing may still fail afterwards because the same missing data is referenced in With, even though the step should already have been skipped.

This is especially relevant now that WithSchema validation is enforced more strictly during planning.

Proposed Solution

Adjust the plan-building flow so that once a step is determined to be NotApplicable due to its Condition, all later plan-time processing that assumes the step is still eligible is skipped for that step.

Expected behavior:

  • Evaluate Condition before any plan-time With validation that depends on the step being applicable.
  • If the condition evaluates to false:
    • mark the step as NotApplicable
    • retain the condition evaluation result in the plan output as today
    • skip subsequent With template substitution for that step
    • skip WithSchema validation for that step
    • skip any further plan-time checks that only make sense for executable steps
  • Ensure this behavior is consistent for all steps, regardless of provider or step type.
  • Cover the behavior with focused unit tests.
  • Document the planning behavior clearly so users understand that conditions can guard steps from downstream plan-time validation.

Alternatives Considered

Alternative A: Keep current behavior and require all condition-guarded steps to still pass full plan-time validation

This was rejected because it creates false-positive failures for steps that are intentionally skipped by design. It also makes conditions less useful as guardrails.

Alternative B: Add a special opt-out switch for specific validations

This was rejected because it pushes engine behavior complexity into workflow authoring and makes the planning model harder to understand.

Alternative C: Evaluate conditions only after all With validation

This was rejected because it defeats the purpose of using conditions as an early applicability guard.

Impact

  • Does this affect existing workflows?

    • Yes, but in a positive way. Workflows that currently fail planning for steps that are already condition-skipped would start planning successfully.
    • Workflows with applicable steps should continue to fail fast exactly as today when With data is invalid.
  • Any backward compatibility concerns?

    • This changes plan-time behavior and could therefore be considered behaviorally breaking for anyone relying on current false-positive failures.
    • The new behavior is still the more correct and deterministic model because non-applicable steps should not block plan creation.

Additional Context

Suggested acceptance criteria:

  1. A step whose condition evaluates to false is represented in the plan as NotApplicable.
  2. With template resolution is not executed for that step after the condition result is known.
  3. WithSchema validation is not executed for that step after the condition result is known.
  4. Applicable steps still undergo full template resolution and schema validation.
  5. Unit tests cover both branches:
    • condition false => no false-positive validation failure
    • condition true => current strict validation behavior remains
  6. User-facing documentation explains the interaction between conditions and planning.

Suggested examples to cover in tests/docs:

  • Guarding a step with an existence check for IdentityKey
  • Guarding a step whose With block references optional context data
  • Confirming that skipped steps do not fail planning when the referenced data is absent
    </issue_description>

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

…ition-skipped steps

Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
Copilot AI changed the title [WIP] Skip With-template resolution and WithSchema validation for condition-skipped steps Skip With template resolution and WithSchema validation for condition-skipped steps during plan building Mar 15, 2026
Copilot AI requested a review from blindzero March 15, 2026 20:53
Comment thread docs/use/workflows/conditions.md
Comment thread tests/Core/New-IdlePlan.Tests.ps1
…nditions DSL heading

Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
Copilot AI requested a review from blindzero March 19, 2026 20:38
@blindzero blindzero marked this pull request as ready for review March 19, 2026 20:44
Copilot AI review requested due to automatic review settings March 19, 2026 20:44
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 PR updates IdLE’s plan-building pipeline so that steps deemed NotApplicable by a Condition do not trigger downstream plan-time failures from With template resolution or WithSchema validation, aligning planning behavior with the fact that such steps will never execute.

Changes:

  • Skip With template resolution and WithSchema validation for NotApplicable steps during ConvertTo-IdleWorkflowSteps.
  • Add 4 Pester tests covering both condition-false (skipped) and condition-true (enforced) branches, including OnFailureSteps.
  • Document the “conditions guard plan-time validation” behavior and move new test workflows into fixture PSD1 files.

Reviewed changes

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

Show a summary per file
File Description
src/IdLE.Core/Private/ConvertTo-IdleWorkflowSteps.ps1 Bypasses With template resolution and WithSchema validation when Status is NotApplicable.
tests/Core/New-IdlePlan.Tests.ps1 Adds unit tests ensuring skipped steps don’t fail planning, while applicable steps still validate/throw.
tests/fixtures/workflows/condition-skip-template.psd1 Fixture workflow where a condition-false step has a With template referencing missing data.
tests/fixtures/workflows/condition-skip-schema.psd1 Fixture workflow where a condition-false step would otherwise fail required WithSchema keys.
tests/fixtures/workflows/condition-skip-onfailure.psd1 Fixture workflow validating the same behavior for OnFailureSteps.
tests/fixtures/workflows/condition-applicable-schema.psd1 Fixture workflow verifying condition-true steps still enforce WithSchema (throw on missing required key).
docs/use/workflows/conditions.md Documents that condition-skipped steps bypass remaining plan-time With processing and schema validation.

Comment thread src/IdLE.Core/Private/ConvertTo-IdleWorkflowSteps.ps1 Outdated
Comment thread docs/use/workflows/conditions.md Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 96ebc22fe8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Repository owner deleted a comment from chatgpt-codex-connector Bot Mar 20, 2026
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Comment thread src/IdLE.Core/Private/ConvertTo-IdleWorkflowSteps.ps1
@github-actions
Copy link
Copy Markdown

Code Coverage Report

Overall Project 74.68% 🍏

There is no coverage information present for the Files changed

…ing plan building

Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
Copilot AI requested a review from blindzero March 20, 2026 08:13
@blindzero blindzero merged commit 1b2049c into main Mar 20, 2026
8 checks passed
@blindzero blindzero deleted the copilot/skip-template-resolution-validation branch March 22, 2026 16:23
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.

Skip With-template resolution and WithSchema validation for condition-skipped steps during plan building

3 participants