-
Notifications
You must be signed in to change notification settings - Fork 0
Implement metadata-driven step capabilities (breaking change) #94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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>
- Added New-IdleTestStepMetadata helper function to _testHelpers.ps1 - Updated Export-IdlePlan.Tests.ps1 to add metadata for 'EnsureMailbox' - Updated Invoke-IdlePlan.Retry.Tests.ps1 to add metadata for 'IdLE.Step.Transient' and 'IdLE.Step.NonTransient' - Updated Invoke-IdlePlan.Tests.ps1 to add metadata for multiple step types - Updated ModuleSurface.Tests.ps1 to add metadata for 'IdLE.Step.Primary' and 'IdLE.Step.Containment' - Updated New-IdlePlan.Tests.ps1 to add metadata for step types in OnFailureSteps tests - Fixed instances where New-IdlePlan was called without -Providers parameter All affected tests now pass.
Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
blindzero
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot please check in all Pester tests occurances of Set-Content if these should be put into tests/fixtures.
Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
Fixed in commit 86e5f72. Created tests/fixtures/workflows/ directory and moved all 9 workflow definitions from New-IdlePlan.Capabilities.Tests.ps1 to fixture files. Tests now reference fixture files instead of using inline Set-Content. |
|
@copilot make sure all Pester + PSSA are green and examples are all running |
All checks passing: ✅ Pester Tests: 196/196 passed (0 failed)
|
There was a problem hiding this 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: 86e5f72c57
ℹ️ 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".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Implements metadata-driven required capability derivation for workflow steps, removing RequiresCapabilities from workflow definitions and shifting requirements into a trusted step metadata catalog.
Changes:
- Added a built-in + host-overridable StepMetadata catalog and merged resolver to derive
RequiresCapabilitiesduring planning. - Updated workflow schema validation to treat
RequiresCapabilitiesas an unknown step key. - Refactored tests to use workflow fixtures and updated test providers to supply
StepMetadata.
Reviewed changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/fixtures/workflows/joiner-scriptblock.psd1 | New workflow fixture used for metadata ScriptBlock rejection coverage. |
| tests/fixtures/workflows/joiner-override.psd1 | New fixture to validate host metadata override behavior. |
| tests/fixtures/workflows/joiner-onfailure.psd1 | New fixture to validate OnFailureSteps capability derivation. |
| tests/fixtures/workflows/joiner-no-metadata.psd1 | New fixture to validate fail-fast behavior for missing step metadata. |
| tests/fixtures/workflows/joiner-missing-caps.psd1 | New fixture to validate fail-fast behavior for missing provider capabilities. |
| tests/fixtures/workflows/joiner-invalid.psd1 | New fixture used for invalid metadata shape tests. |
| tests/fixtures/workflows/joiner-invalid-cap.psd1 | New fixture used for invalid capability identifier tests. |
| tests/fixtures/workflows/joiner-entitlements.psd1 | New fixture to validate entitlement capability derivation. |
| tests/fixtures/workflows/joiner-builtin.psd1 | New fixture to validate built-in metadata derivation. |
| tests/_testHelpers.ps1 | Added helper to generate StepMetadata for test step types. |
| tests/New-IdlePlan.Tests.ps1 | Updated tests to provide StepRegistry + StepMetadata where needed. |
| tests/New-IdlePlan.Capabilities.Tests.ps1 | Reworked capability tests to derive requirements from step metadata + fixtures. |
| tests/ModuleSurface.Tests.ps1 | Updated plan-building test to provide StepMetadata for custom steps. |
| tests/Invoke-IdlePlan.Tests.ps1 | Updated execution tests to provide StepMetadata alongside StepRegistry. |
| tests/Invoke-IdlePlan.Retry.Tests.ps1 | Updated retry tests to import helpers and provide StepMetadata. |
| tests/Export-IdlePlan.Tests.ps1 | Updated export tests to provide StepMetadata for custom step types. |
| src/IdLE.Steps.Common/Public/Get-IdleStepMetadataCatalog.ps1 | New built-in metadata catalog for first-party step types. |
| src/IdLE.Steps.Common/IdLE.Steps.Common.psm1 | Exported the new Get-IdleStepMetadataCatalog function. |
| src/IdLE.Steps.Common/IdLE.Steps.Common.psd1 | Added Get-IdleStepMetadataCatalog to exported functions list. |
| src/IdLE.Core/Public/New-IdlePlanObject.ps1 | Planning now resolves StepMetadata catalog and derives RequiresCapabilities from it. |
| src/IdLE.Core/Private/Test-IdleWorkflowSchema.ps1 | Removed RequiresCapabilities from allowed step keys (now unknown key). |
| src/IdLE.Core/Private/Resolve-IdleStepMetadataCatalog.ps1 | New resolver that merges built-in and host metadata with validation. |
| examples/workflows/joiner-with-onfailure.psd1 | Removed RequiresCapabilities from example workflow steps. |
| examples/workflows/joiner-ensureentitlement.psd1 | Removed RequiresCapabilities from example workflow steps. |
| examples/workflows/ad-mover-department-change.psd1 | Removed RequiresCapabilities from example workflow steps. |
| examples/workflows/ad-leaver-offboarding.psd1 | Removed RequiresCapabilities from example workflow steps. |
| examples/workflows/ad-joiner-complete.psd1 | Removed RequiresCapabilities from example workflow steps. |
Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
Summary
Step types now declare required capabilities via metadata catalogs instead of workflow configuration.
RequiresCapabilitiesis no longer supported in workflows and is treated as an unknown key.Motivation
Eliminates duplication between step implementations and workflow declarations. Step handlers already know which provider capabilities they require—declaring this in both places creates drift risk and workflow author burden.
Type of Change
Changes
Schema & Validation:
Test-IdleWorkflowSchema:RequiresCapabilitiestreated as unknown key (no special validation needed - pre-1.0)Test-IdleWorkflowStepKeyshelper function to eliminate duplicate validation logicStep Metadata System:
Get-IdleStepMetadataCatalog(IdLE.Steps.Common): Returns metadata for 8 built-in step typesResolve-IdleStepMetadataCatalog(IdLE.Core): Merges built-in + host-provided metadata with reduced nesting (2-3 levels vs. original 5-6)Test-IdleCapabilityIdentifier,Test-IdleRequiredCapabilities,Get-IdleHostStepMetadata,Test-IdleMetadataForScriptBlocksProviders.StepMetadatahashtablePlan Building:
New-IdlePlanObject: DerivesRequiresCapabilitiesfrom metadata during planningTest Infrastructure:
tests/fixtures/workflows/directory structureSet-Contentto dedicated fixture filesBreaking Changes:
RequiresCapabilitiesfrom step definitions (treated as unknown key)StepRegistryandStepMetadataCode Quality Improvements:
Resolve-IdleStepMetadataCatalogfrom 5-6 levels to 2-3 levelsIdLE.Identity.Readfrom DisableIdentity/EnableIdentity (not required by step contracts)Known Limitations:
Example migration:
Testing
How to test & review
RequiresCapabilitiesas unknown keytests/fixtures/workflows/./tools/Invoke-IdlePesterTests.ps1to verify all tests pass./tools/Invoke-IdleScriptAnalyzer.ps1to verify code qualityTest-IdleWorkflowChecklist
Original prompt
This section details on the original issue you should resolve
<issue_title>Step types should declare their own required capabilities (metadata-driven validation)</issue_title>
<issue_description>## Goal
Remove
RequiresCapabilitiesfrom workflow definitions.From now on, each Step.Type is the single source of truth for required provider capabilities. Planning derives required capabilities from a step metadata catalog (trusted extension point provided by step packs / host), not from workflow configuration.
This is a breaking change (pre-1.0). Existing workflows, examples, and tests must be updated.
Motivation
Proposed design
1) Workflow schema change (remove
RequiresCapabilities)RequiresCapabilitiesfrom the list of allowed step keys in workflow schema validation.RequiresCapabilitiesmust fail validation with an actionable message.2) Add a trusted Step Metadata Catalog
Introduce a new trusted extension point (similar to StepRegistry) that maps Step.Type to metadata.
Input location (host-controlled):
Providers.StepMetadata(hashtable), orProviders['StepMetadata'](hashtable), analogous toProviders.StepRegistry.Shape:
Validation rules (fail fast):
RequiredCapabilities(if present) must be:$null(treated as empty)3) Built-in step packs provide their metadata
Each first-party step pack (e.g.
IdLE.Steps.Common) must expose a function that returns its metadata, for example:Get-IdleStepMetadataCatalogreturning a hashtable keyed by Step.Type.IdLE.Coreadds a helperGet-IdleStepMetadataCatalog -Providers $Providersthat:Get-IdleStepRegistry)Providers.StepMetadata4) Planning changes (how required capabilities are derived)
New-IdlePlan/New-IdlePlanObject):Step.TypeRequiredCapabilitiesand attach it to the plan step asRequiresCapabilitiesRequiresCapabilities.Fail-fast behavior:
Providers.StepMetadata['<StepType>'] = @{ RequiredCapabilities = ... }5) Compatibility and contracts
Step.Type -> handler function name(string). No ScriptBlocks.Breaking changes
RequiresCapabilitiesbecome invalid.Implementation tasks
Core
RequiresCapabilities.Get-IdleStepMetadataCatalog(new private helper) mirroring the style and validation approach ofGet-IdleStepRegistry.RequiresCapabilitiesfrom workflow stepsRequiresCapabilitiesso downstream validation and plan export remain transparent.Docs
RequiresCapabilitiesin workflows.RequiredCapabilitiesas a normative field.RequiresCapabilities.Tests
RequiresCapabilities.RequiresCapabilitiesfails schema validation💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.