Conversation
Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Implements a provider-resolution fallback so plan execution can default to Plan.Providers when Invoke-IdlePlan / Invoke-IdlePlanObject is called without an explicit -Providers, improving the common “plan then execute” workflow in IdLE.
Changes:
- Added effective-provider resolution and early “providers required” failure in
Invoke-IdlePlanObject. - Added new Pester coverage for fallback/override/error paths and updated existing ExecutionOptions validation tests to supply providers.
- Updated cmdlet help, docs, and demo script examples to reflect the simplified execution flow.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Core/Invoke-IdlePlan.ProviderFallback.Tests.ps1 | New tests covering fallback to Plan.Providers, override via -Providers, missing-provider error, security validation, and output redaction. |
| tests/Core/Invoke-IdlePlan.ExecutionOptions.Tests.ps1 | Updates existing tests to build plans with providers so ExecutionOptions validation paths remain reachable. |
| src/IdLE/Public/Invoke-IdlePlan.ps1 | Updates comment-based help to document provider resolution behavior and examples. |
| src/IdLE.Core/Public/Invoke-IdlePlanObject.ps1 | Core implementation: resolves effective providers, validates, and uses them consistently (step registry, context, auth broker checks, redaction). |
| examples/Invoke-IdleDemo.ps1 | Demo updated to execute without re-supplying providers. |
| docs/use/quickstart.md | Quickstart reorganized to select providers first and execute without re-supplying them. |
| docs/use/providers.md | Adds “Provider Resolution” section and clarifies override/export scenarios. |
| docs/use/plan-export.md | Updates example to build plans with providers and clarifies exported plan execution expectations. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 383117c43b
ℹ️ 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".
Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
Implementation Plan: Invoke-IdlePlan Providers Fallback
Invoke-IdlePlanObject.ps1-Providersif supplied, otherwise fall back toPlan.Providersproviders.mdwith provider resolution section and simplified examplesquickstart.mdto show simplified workflowplan-export.mdto clarify exported plan provider handlingInvoke-IdlePlan.ps1andInvoke-IdlePlanObject.ps1Invoke-IdleDemo.ps1to use simplified workflowImport-IdlePlanfunctionSummary
Successfully implemented provider fallback functionality with support for both hashtable and PSCustomObject provider registries, simplified validation logic, documentation corrections, and improved test clarity.
Original prompt
This section details on the original issue you should resolve
<issue_title>Invoke-IdlePlan should default to Plan.Providers when -Providers is not supplied</issue_title>
<issue_description>## Problem Statement
Today, executing a plan requires passing the provider registry twice:
New-IdlePlan -Providers $providersInvoke-IdlePlan -Plan $plan -Providers $providersIf
-Providersis omitted duringInvoke-IdlePlan, steps can fail with errors like:Context.Providers must be a hashtable.This is confusing and adds unnecessary boilerplate for the most common workflow:
The expectation for a typical user is that a plan built with providers can be executed without re-supplying the same providers, unless the caller explicitly wants to override them.
Proposed Solution
Implement a deterministic fallback in the execution path:
Invoke-IdlePlan/Invoke-IdlePlanObjectis called without-Providers(i.e.,$null)Providersproperty that is a dictionary/hashtablePlan.Providersas the effective provider registry.Override rules:
-Providersis supplied toInvoke-IdlePlan/Invoke-IdlePlanObject, it must take precedence overPlan.Providers.Validation / error message rules:
-ProvidersnorPlan.Providersare present/valid, execution must fail early with a clear message, e.g.:Providers are required. Provide -Providers to Invoke-IdlePlan or build the plan with Providers.Security rules:
Assert-IdleNoScriptBlock).AuthSessionBrokerwhen steps require it.Implementation detail (explicit, agent-safe):
Suggested code location:
src/IdLE.Core/Public/Invoke-IdlePlanObject.ps1Before any provider validation or use (before
Assert-IdleNoScriptBlock -InputObject $Providers, beforeGet-IdleStepRegistry -Providers $Providers), resolve:$effectiveProviders = $Providers$effectiveProviders -eq $null:$Planhas propertyProvidersand it is anIDictionary/hashtable: set$effectiveProviders = $Plan.Providers$effectiveProvidersthroughout the function instead of$Providers.Ensure the public entrypoint
src/IdLE/Public/Invoke-IdlePlan.ps1continues to pass through-Providersas-is; no behavior changes needed there if core is fixed, but update comment-based help accordingly.Alternatives Considered
Keep current behavior (status quo)
Context.Providers must be a hashtable.).Remove
-ProvidersfromNew-IdlePlanAlways ignore
Plan.Providersand require explicitInvoke -ProvidersThe proposed fallback keeps the best parts of (status quo) and preserves override + export scenarios.
Impact
-ProviderstoInvoke-IdlePlanare unaffected (explicit override remains).-Providerswill now work if the plan containsProviders. This is a positive compatibility improvement.Invoke -Providers(unchanged).Additional Context
Documentation updates (required)
Update documentation to reflect the new default behavior and override behavior:
intro-use.md)Invoke-IdlePlanusesPlan.Providerswhen-Providersis omitted.-ProviderstoInvoke-IdlePlanreplacesPlan.Providers.💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.