refactor: extract project build support service#186
Conversation
PR Review: refactor: extract project build support serviceThis is a well-motivated refactoring that correctly identifies testability as the core benefit of moving helpers out of the private cmdlet scope. Here are my observations: Critical Issues1. Type Safety Regression:
|
| Method | Tested? |
|---|---|
ParseGitHubTagConflictPolicy |
❌ No — the most changed method has zero coverage |
ApplyTagConflictPolicy |
❌ No — especially the "Fail" path |
IsTrue |
❌ No — especially for SwitchParameter input |
ResolveGitHubBaseVersion |
❌ No |
ApplyTemplate |
❌ No |
PrepareStaging |
❌ No |
LoadConfig |
✅ Yes |
ResolveSecret |
✅ Yes |
ValidatePreflight |
✅ Partial |
ParseGitHubTagConflictPolicy is the whole point of making this logic testable — please add tests before merging.
Design Observations
4. Mixed static/instance design is inconsistent
ProjectBuildSupportService has an ILogger _logger field (instance), but about half its methods are public static. This makes the class hard to mock in tests (instance methods call static helpers like ResolveSecret directly). Consider either:
- All-static pure utility class, or
- All-instance with an interface (
IProjectBuildSupportService) for injection
The current hybrid forces callers to juggle both support.InstanceMethod(...) and ProjectBuildSupportService.StaticMethod(...).
5. InternalsVisibleTo grants broad access
Adding [assembly: InternalsVisibleTo("PSPublishModule")] gives PSPublishModule access to all future internal types in PowerForge, not just the two new ones. This is architecturally intentional but worth noting — any new internal type added to PowerForge is automatically accessible from PSPublishModule without further review.
What's Good
- Correct motivation: moving logic into
PowerForgemakes it testable without the PowerShell runtime - Clean separation: cmdlet partial is now focused on PS-specific path resolution and output
- Good XML doc comments on all new members
- The
InternalsVisibleTopattern is used appropriately ProjectBuildConfig→ProjectBuildConfigurationrename is more idiomatic for .NET- No public API breaking changes
Summary of Recommended Fixes Before Merge
- Restore
GitHubTagConflictPolicyenum as return type ofParseGitHubTagConflictPolicy(or define an equivalent inPowerForge) - Handle
"Fail"policy inApplyTagConflictPolicywith defined behavior (throw? return error indicator?) - Add
SwitchParameterbranch back toIsTrue(or add test provingToString()path works correctly) - Add tests for
ParseGitHubTagConflictPolicy,ApplyTagConflictPolicy, andIsTrue
Reviewed by Claude (claude-sonnet-4-6)
Summary
Validation