Detect reserved PSGallery module versions#215
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Code ReviewOverall, this is a well-structured solution to a real PSGallery limitation. The logic is sound and the implementation is consistent with the existing codebase patterns. Here are my observations: Correctness / LogicProbe starting point when feed returns a cross-range version Guard in Performance ConcernMinimum 4 HTTP round-trips added to every non-prerelease PSGallery version step The probe loop's early-exit condition when no hits have been found yet is For the very common scenario where no reserved versions exist, these 4 probes are wasted. Consider whether the threshold could be lowered (e.g., // ModuleVersionStepper.cs:180-181
const int maxConsecutiveMissesAfterHit = 3;
const int maxConsecutiveMissesBeforeHit = 4; // 4 HTTP requests minimum for every stepMissing Logging on Timeout / No-Hit
// PowerShellGalleryVersionFeedClient.cs:102-104
catch (TaskCanceledException)
{
// Consider: _logger.Verbose($"Timeout checking reserved version {version} for '{packageId}'.");
return false;
}Similarly, when the probe loop completes and Test Coverage Gaps
Minor
SummaryThe core feature is correct and the test for the primary scenario is solid. The main concern is the minimum 4 extra HTTP requests per version-step even when no reserved versions exist — worth evaluating against the expected frequency of this code path and whether the |
Summary
Validation
dotnet test .\PowerForge.Tests\PowerForge.Tests.csproj -c Release -f net10.0 --filter "FullyQualifiedName~ModuleVersionStepperTests" --no-restoredotnet build .\PowerForge\PowerForge.csproj -c Release -f net472 --nologopwsh -NoProfile -Command "Import-Module .\PSPublishModule\bin\Release\net8.0\PSPublishModule.dll -Force; Step-Version -ExpectedVersion '3.0.X' -Module 'PSPublishModule' -Advanced | ConvertTo-Json -Compress -Depth 5"powershell.exe -NoProfile -Command "Import-Module .\PSPublishModule\bin\Release\net472\PSPublishModule.dll -Force; Step-Version -ExpectedVersion '3.0.X' -Module 'PSPublishModule' -Advanced | ConvertTo-Json -Compress -Depth 5"Notes
200forhttps://www.powershellgallery.com/api/v2/Packages(Id='PSPublishModule',Version='3.0.0')and for theapi/v2/packagedownload URL, whileFindPackagesById()omits3.0.0Module/Build/Build-Module.ps1, but it is intentionally not part of this commit