refactor: rename Azure DevOps connection cache#1864
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughRenames the Azure DevOps session cache field to ChangesAzureDevOps Connection Cache Rename
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Up to standards ✅🟢 Issues
|
Deploying maester with
|
| Latest commit: |
1d6c629
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://516d43d9.maester.pages.dev |
| Branch Preview URL: | https://codex-rename-ado-connection.maester.pages.dev |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
build/Build-MaesterModule.ps1 (1)
470-483:⚠️ Potential issue | 🟠 Major | ⚡ Quick winKeep build-generated session schema aligned with source initializer.
The preamble used to generate
Maester.psm1omitsSpoCache, whilepowershell/Maester.psm1initializes it. This creates a source/build contract mismatch and can surface null/missing-key behavior on SharePoint cache paths before a reset routine runs.Proposed fix
$__MtSession = @{ GraphCache = @{} GraphBaseUri = $null TestResultDetail = @{} Connections = @() DnsCache = @() ExoCache = @{} OrcaCache = @{} AIAgentInfo = $null AzureDevOpsConnectionCache = $null DataverseApiBase = $null # Resolved Dataverse OData API base URL (e.g. https://org123.api.crm.dynamics.com/api/data/v9.2) DataverseResourceUrl = $null # Dataverse resource URL for token acquisition (e.g. https://org123.crm.dynamics.com) DataverseEnvironmentId = $null # Environment identifier for display (e.g. org123.crm.dynamics.com) + SpoCache = @{} # Cache for SharePoint Online tenant settings retrieved via PnP }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@build/Build-MaesterModule.ps1` around lines 470 - 483, The $__MtSession hashtable is missing the SpoCache initialization that exists in the source file powershell/Maester.psm1. Add SpoCache = @{} to the $__MtSession hashtable definition to ensure the build-generated session schema matches the source initializer and prevent null/missing-key errors when SharePoint cache operations are executed.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@build/Build-MaesterModule.ps1`:
- Around line 470-483: The $__MtSession hashtable is missing the SpoCache
initialization that exists in the source file powershell/Maester.psm1. Add
SpoCache = @{} to the $__MtSession hashtable definition to ensure the
build-generated session schema matches the source initializer and prevent
null/missing-key errors when SharePoint cache operations are executed.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 0d8da1a4-5803-4b4f-bba5-05661ff73dee
📒 Files selected for processing (5)
build/Build-MaesterModule.ps1powershell/Maester.psm1powershell/internal/Clear-ModuleVariable.ps1powershell/public/core/Test-MtConnection.ps1powershell/tests/functions/Test-MtConnection.Tests.ps1
|
@copilot resolve the merge conflicts in this pull request |
Resolved by merging |
There was a problem hiding this comment.
Pull request overview
Renames Maester’s internal Azure DevOps connection probe cache session key to AzureDevOpsConnectionCache (clarifying it stores only the cached probe result from Test-MtConnection), and adds tests around Azure DevOps probe caching behavior.
Changes:
- Renamed the Azure DevOps probe cache key throughout
Test-MtConnection, module session initialization, and module-variable reset. - Updated the build template session initialization to match the new cache key.
- Added focused Pester tests covering successful probe caching, negative-result caching, cache reuse, and cache clearing.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| powershell/tests/functions/Test-MtConnection.Tests.ps1 | Updates existing tests for the new cache key and adds new Azure DevOps cache behavior tests. |
| powershell/public/core/Test-MtConnection.ps1 | Switches Azure DevOps probe caching to the new AzureDevOpsConnectionCache session key. |
| powershell/Maester.psm1 | Initializes the new Azure DevOps cache key in the module session state. |
| powershell/internal/Clear-ModuleVariable.ps1 | Clears the new Azure DevOps cache key during module-variable reset. |
| build/Build-MaesterModule.ps1 | Updates the module build template to initialize the new cache key. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This comment was marked as duplicate.
This comment was marked as duplicate.
|
Looks good to me. Ready for final review and approval by someone other than me because I made the last push. |
|
Thanks for the review and updates @SamErde |
Summary
Renames the internal Azure DevOps connection probe cache from
AzureDevOpsConnectiontoAzureDevOpsConnectionCache.This makes the lifecycle clearer: the value is not the source Azure DevOps auth/session state, it is only Maester's cached result from probing
Get-ADOPSConnectioninsideTest-MtConnection.Changes
Test-MtConnectionandClear-ModuleVariable.Validation
Invoke-Pester powershell/tests/functions/Test-MtConnection.Tests.ps1,powershell/tests/functions/Test-MtCaAzureDevOps.Tests.ps1 -Output NormalSummary by CodeRabbit
Bug Fixes
Tests