refactor: extract project version workflows#196
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d42bf148a1
ℹ️ 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 content = File.ReadAllText(manifestFile); | ||
| var match = Regex.Match(content, "ModuleVersion\\s*=\\s*['\\\"]?([\\d\\.]+)['\\\"]?", RegexOptions.IgnoreCase); | ||
| if (!match.Success) |
There was a problem hiding this comment.
Read only top-level ModuleVersion from manifests
Using a plain regex here captures the first textual ModuleVersion assignment anywhere in the file, not specifically the manifest's top-level key. In manifests where RequiredModules (or another nested hashtable) appears before the top-level ModuleVersion, discovery can return a dependency version instead of the module's own version, which then makes Set-ProjectVersion -VersionType ... compute and apply an incorrect target version.
Useful? React with 👍 / 👎.
Code Review: PR 196 - refactor: extract project version workflowsOverall this is a well-structured refactor. Separating discovery/update logic into Bug 1 - Dead code in UpdateVersionNumber (Revision case) The method pads Bug 2 - IsExcludedPath substring match causes false positives
var segments = path.Split(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
return segments.Any(seg => seg.Equals(fragment, StringComparison.OrdinalIgnoreCase));Performance 1 - Update() traverses the file system twice
Performance 2 - Each .ps1 file is read twice
Code Quality 1 - ApplyVersionUpdate hardcodes ModuleVersion alignment Hardcodes 8 spaces and single quotes regardless of the original file formatting. Capturing original whitespace in the regex and back-referencing it avoids silent formatting changes on every update. Code Quality 2 - Bare catch {} in EnumerateFiles
Test Coverage Gaps Several scenarios have no coverage:
Summary: The architectural direction is clean and testability improves significantly. The two bugs (unreachable Revision branch, false-positives in |
Summary
Validation