fix: clear stale prerelease during manifest refresh#304
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Code ReviewSummaryThis is a focused, correct bug fix for a real problem: a stale prerelease value persisting in-memory when a manifest segment omits Fix Analysis (
|
|
Addressed the CI failure and the review suggestion on the current head:
Local validation:
|
|
PR Review: fix: clear stale prerelease during manifest refresh The fix is correct and well-targeted. The one-line change in ModulePipelineRunner.Plan.cs closes the stale-prerelease bug cleanly, and the regression test covers the exact failure path described in the PR. Code Quality The new line is clear and idiomatic. The null-forgiving operator is safe because the IsNullOrWhiteSpace guard already rules out null/empty on the right-hand branch. Consistency observation (non-blocking): The surrounding fields (Author, CompanyName, Description, etc.) still use the old guard pattern. That means those fields can never be cleared from the baseline either. Whether that is intentional or a future follow-up is outside the scope of this PR. Test Coverage The new test Run_RefreshPSD1Only_ClearsStalePrereleaseWhenManifestSegmentOmitsIt is well-structured. It seeds a real .psd1 with a stale prerelease value, runs the pipeline with a manifest segment that omits Prerelease, then asserts both that plan.PreRelease is null (in-memory) AND that the written .psd1 contains no Prerelease key at either the top-level or PSData level (on-disk). That two-layer assertion is exactly right for this class of bug. Optional addition: A parallel RefreshPSD1Only variant of Run_WritesPrereleaseToPsDataAndRemovesTopLevelPrerelease (segment with Prerelease set + RefreshPSD1Only = true) would lock in the positive/non-regression side for the refresh-only path. Not a blocker - the full-build path is already covered in ModulePipelineManifestRefreshTests.cs. Potential Issues None identified. The change is narrow and does not affect any other fields. The .Trim() call is a minor bonus that normalises accidental whitespace in the prerelease string. Verdict: The fix is correct, minimal, and well-tested. Good to merge. |
Summary
PrereleaseRefreshPSD1Onlyrebuild pathWhy
When a module manifest already contained a prerelease value such as
Preview1, removingPrereleasefrom the build configuration did not actually clear it during a rebuild.ModulePipelineRunner.Planseededplan.PreReleasefrom the existing psd1 and only overwrote it when the new manifest configuration supplied a non-empty prerelease value.That meant:
-Preview1Validation
dotnet test PowerForge.Tests/PowerForge.Tests.csproj --filter "FullyQualifiedName~Run_RefreshPSD1Only_ClearsStalePrereleaseWhenManifestSegmentOmitsIt|FullyQualifiedName~Run_WritesPrereleaseToPsDataAndRemovesTopLevelPrerelease|FullyQualifiedName~Run_RefreshesManifestMetadataAndClearsStaleValues"Notes
A broader manifest-refresh test slice on current
mainstill has one unrelated pre-existing failure inRun_RemovesInboxAndDuplicatedExternalDependenciesFromManifest, so I validated this change with the prerelease-focused regression slice above.