refactor: thin Invoke-DotNetRepositoryRelease#189
Conversation
PR Review: refactor: thin Invoke-DotNetRepositoryReleaseGood overall direction — extracting preparation and workflow concerns out of the cmdlet makes the logic testable and the cmdlet easier to reason about. The tests are a welcome addition. A few issues worth addressing before merge: Bugs / Behavioral Changes1. The original code called // PreparationService.cs
throw new ArgumentException("ExpectedVersionMap entries must include both project name and version.", nameof(entries));This will surface as an unhandled .NET exception in the PowerShell host rather than a structured 2.
context.Spec.WhatIf = true;
var plan = _executeRelease(context.Spec);
if (!executeBuild) return plan;
context.Spec.WhatIf = false; // side-effect on caller's object
return _executeRelease(context.Spec);After 3. Both 4. The cmdlet maps the store enum before creating the request: CertificateStore = CertificateStore == CertificateStoreLocation.LocalMachine
? PowerForge.CertificateStoreLocation.LocalMachine
: PowerForge.CertificateStoreLocation.CurrentUser,Then var mappedStore = request.CertificateStore == CertificateStoreLocation.LocalMachine
? PowerForge.CertificateStoreLocation.LocalMachine
: PowerForge.CertificateStoreLocation.CurrentUser;Since Test Gaps5. ErrorMessage = spec.WhatIf ? "plan" : "release"Using var whatIfValues = new List<bool>();
executeRelease: spec => { whatIfValues.Add(spec.WhatIf); return new DotNetRepositoryReleaseResult { Success = true }; }
// assert: whatIfValues == [true, false]6. No test for inline
7. The test sets Minor8. Previously 9. The old Summary
The structure is clean and the direction is right. Items 1 and 2 are the most worth addressing before this lands. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5f3caa7373
ℹ️ 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".
| var rootPath = string.IsNullOrWhiteSpace(request.RootPath) | ||
| ? request.CurrentPath | ||
| : ProjectBuildSupportService.ResolveOptionalPath(request.RootPath, request.CurrentPath)!; |
There was a problem hiding this comment.
Preserve PowerShell path expansion for release root
This refactor changed root resolution from PowerShell's GetUnresolvedProviderPathFromPSPath to ResolveOptionalPath (System.IO.Path semantics), so valid cmdlet inputs like -Path ~ or other PSDrive-style paths are now interpreted as literal/relative filesystem text instead of expanded PowerShell paths. In those scenarios the cmdlet can target the wrong directory (or fail with missing path) even though the same input worked before, which is a behavior regression for interactive users and scripts.
Useful? React with 👍 / 👎.
Summary
Validation