Skip to content

refactor: Split IPipelineHookContext for Interface Segregation Principle compliance#1463

Merged
thomhurst merged 9 commits into
mainfrom
fix/issue-1454-interface-segregation
Dec 30, 2025
Merged

refactor: Split IPipelineHookContext for Interface Segregation Principle compliance#1463
thomhurst merged 9 commits into
mainfrom
fix/issue-1454-interface-segregation

Conversation

@thomhurst
Copy link
Copy Markdown
Owner

Summary

  • Splits IPipelineHookContext (27+ members) into 6 focused sub-interfaces to comply with the Interface Segregation Principle (ISP)
  • IPipelineHookContext now inherits from all sub-interfaces, maintaining full backwards compatibility
  • Consumers can now depend on only the subset of functionality they need

New Interfaces

Interface Purpose Members
IPipelineServices DI and configuration ServiceProvider, Get<T>(), Configuration, PipelineOptions
IPipelineLogging Logging functionality Logger
IPipelineTools Command execution and tools Command, Powershell, Bash, Http, Downloader, Installer
IPipelineEncoding Serialization and encoding Json, Xml, Yaml, Hex, Base64, Hasher
IPipelineFileSystem File operations FileSystem, Zip, Checksum
IPipelineEnvironment Environment and build detection Environment, BuildSystemDetector

Test plan

  • Build the core ModularPipelines project: dotnet build src/ModularPipelines/ModularPipelines.csproj -c Release
  • Verify existing unit tests pass (CI will run)
  • Confirm backwards compatibility - existing code using IPipelineHookContext continues to work

Fixes #1454

🤖 Generated with Claude Code

thomhurst and others added 9 commits December 29, 2025 18:39
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…compliance

Split the monolithic IPipelineHookContext (27+ members) into focused sub-interfaces
to comply with the Interface Segregation Principle (ISP):

- IPipelineServices: DI and configuration (ServiceProvider, Get<T>, Configuration, PipelineOptions)
- IPipelineLogging: Logging functionality (Logger)
- IPipelineTools: Command execution and tools (Command, Powershell, Bash, Http, Downloader, Installer)
- IPipelineEncoding: Serialization and encoding (Json, Xml, Yaml, Hex, Base64, Hasher)
- IPipelineFileSystem: File operations (FileSystem, Zip, Checksum)
- IPipelineEnvironment: Environment and build detection (Environment, BuildSystemDetector)

IPipelineHookContext now inherits from all sub-interfaces, maintaining full backwards
compatibility while allowing consumers to depend on only the subset of functionality
they need.

Fixes #1454

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

Summary

This PR refactors IPipelineHookContext to comply with the Interface Segregation Principle by splitting it into 6 focused sub-interfaces while maintaining full backwards compatibility.

Critical Issues

None found ✅

Suggestions

Typos in XML Documentation (3 occurrences):

  1. src/ModularPipelines/Context/IPipelineEncoding.cs:20 - "convering" should be "converting"

    /// Gets helpers for convering XML.
  2. src/ModularPipelines/Context/IPipelineEncoding.cs:25 - "convering" should be "converting"

    /// Gets helpers for convering YAML.

These are copy-paste errors from the original interface comments (which also had the same typo). Consider fixing all three occurrences across the new interfaces.

Previous Review Status

No previous comments found.

Verdict

APPROVE - No critical issues

The refactoring is clean and maintains backwards compatibility correctly. The PipelineContext implementation already satisfies all the new interfaces through the existing property implementations, so this is a pure interface reorganization with no breaking changes.

@thomhurst thomhurst merged commit f01ebb4 into main Dec 30, 2025
10 of 12 checks passed
@thomhurst thomhurst deleted the fix/issue-1454-interface-segregation branch December 30, 2025 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HIGH: IPipelineHookContext violates Interface Segregation Principle with 27+ members

1 participant