Skip to content

Fix New-IdleAuthSession: Export New-IdleAuthSessionBroker from IdLE.Core#126

Merged
blindzero merged 3 commits intomainfrom
copilot/fix-new-idleauthsession-error
Jan 30, 2026
Merged

Fix New-IdleAuthSession: Export New-IdleAuthSessionBroker from IdLE.Core#126
blindzero merged 3 commits intomainfrom
copilot/fix-new-idleauthsession-error

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 30, 2026

Summary

New-IdleAuthSession fails at runtime with "term 'IdLE.Core\New-IdleAuthSessionBroker' is not recognized" because the underlying Core function isn't exported from the module.

Motivation

PowerShell module manifests (psd1) take precedence over Export-ModuleMember directives. New-IdleAuthSessionBroker was exported in the psm1 but missing from FunctionsToExport in the psd1, making it inaccessible to the wrapper function.

Type of Change

  • Bug fix

Changes

  • Added 'New-IdleAuthSessionBroker' to FunctionsToExport in src/IdLE.Core/IdLE.Core.psd1
  • Added tests/Core/New-IdleAuthSession.Tests.ps1 - 9 tests covering cmdlet functionality
  • Added tests/Core/ModuleExports.Tests.ps1 - 6 tests validating psm1/psd1 export consistency with proper environment variable cleanup

Testing

  • Unit tests
  • Contract tests
  • Manual testing

How to test & review

Import-Module ./src/IdLE/IdLE.psd1 -Force

# This now works (previously failed)
$cred = Get-Credential
$broker = New-IdleAuthSession -SessionMap @{
    @{ Role = 'AD' } = $cred
} -DefaultCredential $cred

Run tests:

./tools/Invoke-IdlePesterTests.ps1

Checklist

  • Code follows STYLEGUIDE.md
  • Tests added or updated
  • Documentation updated
  • No UI/auth logic added to IdLE.Core
  • No breaking changes without discussion

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

…xports and add comprehensive tests

Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix New-IdleAuthSession not recognized error Fix New-IdleAuthSession: Export New-IdleAuthSessionBroker from IdLE.Core Jan 30, 2026
Copilot AI requested a review from blindzero January 30, 2026 18:17
@blindzero blindzero marked this pull request as ready for review January 30, 2026 20:41
Copilot AI review requested due to automatic review settings January 30, 2026 20:41
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

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 fixes a runtime failure where New-IdleAuthSession could not invoke IdLE.Core\New-IdleAuthSessionBroker because the underlying Core function was not exported from the IdLE.Core module manifest, and adds tests to catch similar issues in the future.

Changes:

  • Added New-IdleAuthSessionBroker to FunctionsToExport in src/IdLE.Core/IdLE.Core.psd1 so the Core broker function is available to the New-IdleAuthSession wrapper.
  • Introduced tests/Core/New-IdleAuthSession.Tests.ps1 to validate New-IdleAuthSession behavior and its delegation to IdLE.Core\New-IdleAuthSessionBroker.
  • Added tests/Core/ModuleExports.Tests.ps1 to verify export consistency between .psm1 Export-ModuleMember definitions and .psd1 FunctionsToExport for both IdLE.Core and the top-level IdLE module.

Reviewed changes

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

File Description
src/IdLE.Core/IdLE.Core.psd1 Ensures New-IdleAuthSessionBroker is exported in the Core module manifest so the wrapper New-IdleAuthSession can call it via module qualification.
tests/Core/New-IdleAuthSession.Tests.ps1 Adds Pester tests covering creation and usage of the auth session broker via New-IdleAuthSession, including session mapping, default credentials, and error behavior.
tests/Core/ModuleExports.Tests.ps1 Adds Pester tests that check IdLE.Core and IdLE module export sets and ensure consistency between Export-ModuleMember in .psm1 files and FunctionsToExport in .psd1 manifests.

…estore IDLE_ALLOW_INTERNAL_IMPORT

Co-authored-by: blindzero <13959569+blindzero@users.noreply.github.com>
@blindzero blindzero merged commit 7fd721c into main Jan 30, 2026
7 checks passed
@blindzero blindzero deleted the copilot/fix-new-idleauthsession-error branch January 31, 2026 22:53
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.

New-IdleAuthSession not working - term IdLE.Core\New-IdleAuthSessionBroker is not recognized

3 participants