Skip to content

Refactor DirectorySync step to be strictly provider-agnostic#102

Merged
blindzero merged 2 commits intomainfrom
copilot/refactor-steps-to-be-agnostic
Jan 24, 2026
Merged

Refactor DirectorySync step to be strictly provider-agnostic#102
blindzero merged 2 commits intomainfrom
copilot/refactor-steps-to-be-agnostic

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 22, 2026

Summary

Enforces architectural rule Steps → StepTypes → RequiredCapabilities ← Providers by eliminating provider-specific naming and defaults from the DirectorySync step pack.

Motivation

Step packs contained product-specific naming (IdLE.Steps.DirectorySync.EntraConnect) and defaults (AuthSessionName = 'EntraConnect'), violating provider-agnosticism. This prevents adding a second DirectorySync provider without modifying step code.

Type of Change

  • Breaking change
  • Refactoring / internal improvement

Changes

Module structure

  • IdLE.Steps.DirectorySync.EntraConnectIdLE.Steps.DirectorySync
  • Module manifest: "Entra Connect directory sync steps" → "Generic directory sync steps"
  • Removed "EntraConnect" from module tags

Step implementation

  • Help text: "Triggers an Entra Connect directory sync cycle" → "Triggers a directory sync cycle"
  • Example updated to generic naming: AuthSessionName = 'DirectorySync'
  • Code unchanged (already provider-agnostic via contract methods)

Engine integration

  • Added IdLE.Step.TriggerDirectorySync registration to Get-IdleStepRegistry.ps1
  • Updated IdLE.psd1 nested modules reference
  • Updated test helper imports and generation tools

Example:

# Step definition remains generic
@{
    Name = 'Trigger directory sync'
    Type = 'IdLE.Step.TriggerDirectorySync'
    With = @{
        AuthSessionName = 'DirectorySync'  # Host-provided routing key
        PolicyType = 'Delta'
        Provider = 'DirectorySync'          # Host-provided alias
    }
}

# Provider specificity lives in templates and host configuration
# Template can specify: AuthSessionName = 'EntraConnect'
# Host supplies provider instance that implements StartSyncCycle/GetSyncCycleState

Testing

  • Unit tests (all 230 tests pass, including 19 DirectorySync tests)
  • Contract tests (provider contract tests unchanged)

How to test & review

  1. Verify module IdLE.Steps.DirectorySync imports cleanly
  2. Run: ./tools/Invoke-IdlePesterTests.ps1 -TestPath tests/Invoke-IdleStepTriggerDirectorySync.Tests.ps1
  3. Confirm no "EntraConnect" references in step implementation (provider module appropriately retains product naming)

Checklist

  • Code follows STYLEGUIDE.md
  • Tests added or updated
  • Documentation updated
  • No UI/auth logic added to IdLE.Core
  • No breaking changes without discussion (pre-1.0, no backward compatibility required)

Related Issues

Implements architectural strictness for provider-agnostic steps as defined in AGENTS.md § 4.2.

Original prompt

This section details on the original issue you should resolve

<issue_title>Refactor Steps to be strictly provider-agnostic (StepTypes -> Capabilities <- Providers)</issue_title>
<issue_description>## Summary
We want to strictly enforce the architectural rule:

Steps → StepTypes → RequiredCapabilities ← Providers

Steps must be fully provider-agnostic:

  • no product/provider-specific naming in step packs
  • no product-specific defaults inside steps (e.g., AuthSessionName)
  • steps only call provider contract methods via the provider abstraction (no direct cmdlets, no imports, no remote/network at step scope)

A repository review shows one primary violation of this strictness:

  • The TriggerDirectorySync step implementation is provider-agnostic in code, but the step pack and documentation are Entra Connect-specific:
    • Module name: IdLE.Steps.DirectorySync.EntraConnect
    • Help/defaults mention “Entra Connect”
    • Default AuthSessionName is EntraConnect

This issue refactors the DirectorySync step pack to be generic and updates all references accordingly.

Motivation / Rationale

  • Keep Steps reusable across providers that implement the same capability set.
  • Avoid baking provider/product identity into Step packs or defaults.
  • Ensure adding a second provider for the same StepType requires no changes to Steps (only provider implementation + capability declaration).
  • Make documentation consistent with the capability model.

Scope

In scope

  • Refactor the DirectorySync step pack and TriggerDirectorySync step to be strictly generic.
  • Update step registry auto-discovery to map StepType → handler for the new generic module.
  • Update docs/tests/examples that reference the old module name and Entra Connect wording.

Out of scope

  • Capability taxonomy redesign (already uses generic IdLE.DirectorySync.*).
  • Provider-side functionality changes (except renames required by the refactor).
  • Broader module packaging decisions (tracked separately).

Current findings (what violates strict generic Steps)

1) Provider-specific step pack naming

  • src/IdLE.Steps.DirectorySync.EntraConnect/* is provider/product-specific by name.

2) Provider-specific wording and defaults inside the step

Invoke-IdleStepTriggerDirectorySync:

  • Help/description mentions “Entra Connect directory sync cycle”.
  • Defaults include:
    • Name = 'Trigger Entra Connect sync'
    • AuthSessionName = 'EntraConnect'

3) Documentation inherits provider specificity

docs/reference/steps.md describes TriggerDirectorySync as “Triggers an Entra Connect directory sync cycle …”.

Target state (definition)

Step pack & step implementation

  • A generic step pack exists:
    • Module name: IdLE.Steps.DirectorySync
  • The step remains provider-agnostic and references only capabilities/contract methods:
    • StepType: IdLE.Step.TriggerDirectorySync
    • RequiredCapabilities: IdLE.DirectorySync.Trigger, IdLE.DirectorySync.Status
    • Provider contract methods (example):
      • StartSyncCycle(PolicyType, AuthSession)
      • GetSyncCycleState(AuthSession)
  • No provider-specific defaults:
    • Default AuthSessionName should be generic (e.g., DirectorySync) or omitted (null) so workflows/templates set it explicitly.
    • Default Name should be provider-neutral (e.g., “Trigger directory sync”).

Templates remain provider-specific (allowed)

  • Provider-specific workflows (e.g., Entra Connect) can live in templates and specify:
    • provider alias (e.g., DirectorySync)
    • auth session name/options (e.g., EntraConnect)
    • provider module to import
      This provider specificity must not leak into Step packs.

Acceptance criteria

Strict provider-agnostic steps

  • IdLE.Steps.DirectorySync contains Invoke-IdleStepTriggerDirectorySync (same StepType, generic wording).
  • No step code in any step pack:
    • imports product modules
    • calls product-specific cmdlets directly
    • requires RSAT/ADSync/Graph/etc.
    • performs network/remote operations directly
  • Any product/provider-specific behavior is confined to provider modules and templates.

Engine discovery / StepRegistry

  • Get-IdleStepRegistry auto-registers IdLE.Step.TriggerDirectorySync when IdLE.Steps.DirectorySync is loaded:
    • resolves handler via module-qualified invocation (same pattern as IdLE.Steps.Common).

Tests

  • Update existing Pester tests to import the new module name and pass.
  • Invoke-IdleStepTriggerDirectorySync.Tests.ps1 references IdLE.Steps.DirectorySync (not EntraConnect).
  • Tests remain fully mockable (no real systems required).

Documentation

  • docs/reference/steps.md updates TriggerDirectorySync description to provider-neutral wording.
  • Any references to IdLE.Steps.DirectorySync.EntraConnect are removed or replaced with:
    • generic steps pack name, and
    • provider-specific references only in template sections.

Compatibility

  • Pro...

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

- Create new IdLE.Steps.DirectorySync module (generic naming)
- Move and update Invoke-IdleStepTriggerDirectorySync with provider-neutral help and defaults
- Update StepRegistry to register IdLE.Step.TriggerDirectorySync with new module
- Update all test references to use new module name
- Update documentation to use provider-neutral language
- Update meta-module and test helpers to reference new module
- Remove old IdLE.Steps.DirectorySync.EntraConnect module

Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor steps to enforce provider-agnostic architecture Refactor DirectorySync step to be strictly provider-agnostic Jan 22, 2026
Copilot AI requested a review from blindzero January 22, 2026 21:38
@blindzero blindzero marked this pull request as ready for review January 24, 2026 08:11
Copilot AI review requested due to automatic review settings January 24, 2026 08:11
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

Refactors the DirectorySync step pack to be provider-agnostic by removing Entra Connect-specific module naming and documentation, and wiring the generic step pack into the engine and tooling.

Changes:

  • Renamed the step pack module from IdLE.Steps.DirectorySync.EntraConnect to IdLE.Steps.DirectorySync and updated manifests/tags accordingly.
  • Updated TriggerDirectorySync step help text and docs to be provider-neutral.
  • Updated engine step registry, tooling, and tests to reference the new module name.

Reviewed changes

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

Show a summary per file
File Description
tools/Generate-IdleStepReference.ps1 Updates default scanned step modules to include the new generic DirectorySync pack.
tests/_testHelpers.ps1 Updates test module import path to the new DirectorySync step pack manifest.
tests/Invoke-IdleStepTriggerDirectorySync.Tests.ps1 Updates module-qualified handler strings to the new step pack name.
src/IdLE/IdLE.psd1 Updates nested module reference to load the new DirectorySync step pack.
src/IdLE.Steps.DirectorySync/Public/Invoke-IdleStepTriggerDirectorySync.ps1 Updates comment-based help text/examples to be provider-agnostic.
src/IdLE.Steps.DirectorySync/IdLE.Steps.DirectorySync.psm1 Adds the new module entry point for loading/exporting the step implementation.
src/IdLE.Steps.DirectorySync/IdLE.Steps.DirectorySync.psd1 Updates RootModule/Description/Tags to reflect the generic DirectorySync step pack.
src/IdLE.Core/Private/Get-IdleStepRegistry.ps1 Registers IdLE.Step.TriggerDirectorySync handler from the new DirectorySync module.
docs/reference/steps.md Updates generated step reference synopsis to provider-neutral wording.

@blindzero blindzero merged commit 4eff1e3 into main Jan 24, 2026
11 checks passed
@blindzero blindzero deleted the copilot/refactor-steps-to-be-agnostic branch January 24, 2026 23:06
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.

Refactor Steps to be strictly provider-agnostic (StepTypes -> Capabilities <- Providers)

3 participants