refactor: BackgroundAgents DIP Phase 1 - Extract IProviderFactory and CertificationRecordMapper to Application (P1.2) - #526
Open
IanFrelinger wants to merge 3 commits into
Conversation
…pplication layer (DIP P1.2) - Move IProviderFactory from Infrastructure.Execution to Application.Execution.Ports - Move ModelUnavailableException to Application.Execution.Ports - Move CertificationRecordMapper from Infrastructure.Certification to Application.Certification - Update BackgroundAgents to use Application ports instead of Infrastructure - Add backward-compat deprecated aliases in Infrastructure for existing consumers - Document remaining Infrastructure dependencies in BackgroundAgents Part of Architecture Guardian P1.2: BackgroundAgents DIP remainder. Remaining Infrastructure usages documented as composition/hosting concerns: - ServiceCollectionExtensions: DI registration of concrete types (acceptable) - ObservationPipelineService: Infrastructure glue service (future refactor) - AutonomyLoopService: Complex infrastructure component dependency (future interface extraction) See INFRASTRUCTURE_DEPENDENCY_ANALYSIS.md for full analysis and future work. Co-authored-by: IanFrelinger <IanFrelinger@users.noreply.github.com>
- Document Phase 1 accomplishments - Provide metrics on dependency reduction - Explain remaining Infrastructure dependencies - Define clear roadmap for Phase 2 work Co-authored-by: IanFrelinger <IanFrelinger@users.noreply.github.com>
… to Application version Add backward-compatible deprecated wrapper that delegates to the new Application layer implementation. Co-authored-by: IanFrelinger <IanFrelinger@users.noreply.github.com>
cursorBot
pushed a commit
that referenced
this pull request
Sep 6, 2026
…cution.Ports Per Project Manager decision: ModelUnavailableException is an execution-domain exception and belongs in Application ports, not Abstractions. Changes: - Move ModelUnavailableException: Abstractions.Exceptions → Core.Application.Execution.Ports - Update all usings across Orchestration, Infrastructure, BackgroundAgents, and test assemblies - Aligns with PR #526 convention - Keeps Abstractions free of execution-domain types DIP unchanged: Orchestration already depends on Core.Application. Infrastructure ProjectReference still removed (P1.1 intact). Co-authored-by: IanFrelinger <IanFrelinger@users.noreply.github.com>
12 tasks
cursorBot
pushed a commit
that referenced
this pull request
Sep 6, 2026
) Add three new layer boundary checks to catch Architecture Guardian findings: - Ashlar.Orchestration → Ashlar.Infrastructure (peer-adapter coupling) - Ashlar.BackgroundAgents → Ashlar.Orchestration (peer coupling) - Ashlar.Infrastructure → Ashlar.Tools.* (dependency cycle risk) These violations currently exist on master, so they are enforced as WARNINGS with clear TODO comments indicating they will be upgraded to ERRORS once remediation PRs (#521, #524, #525, #526) land. This ensures regressions of peer-adapter coupling will fail CI after the remediation work is complete, preventing future architecture violations. Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: IanFrelinger <IanFrelinger@users.noreply.github.com>
IanFrelinger added a commit
that referenced
this pull request
Sep 6, 2026
…ediation (P0.1 + P1.1) (#521) * fix(arch): P0.1 DIP - Orchestration no longer depends on concrete Infrastructure resilience types - Add ICircuitBreaker port in Core.Application/Resilience/Ports - Implement ICircuitBreaker in Orchestration.Resilience.CircuitBreaker - Remove Infrastructure.Resilience using from Orchestrator.cs - Change Orchestrator to inject IResilientExecutor and ICircuitBreaker - Wire up bindings in Orchestration ServiceCollectionExtensions - Update test helper methods to provide required dependencies Resolves Architecture Guardian finding P0.1 (DIP/layering violation). Orchestration now depends only on ports from Core.Application, not concrete Infrastructure types. Co-authored-by: IanFrelinger <IanFrelinger@users.noreply.github.com> * fix(arch): P1.1 - Remove Infrastructure ProjectReference from Orchestration Complete DIP/layering remediation: - Move ModelUnavailableException from Infrastructure.Execution to Abstractions.Exceptions (shared exception) - Remove Infrastructure ProjectReference from Ashlar.Orchestration.csproj - Remove Infrastructure.Resilience using from Orchestration ServiceCollectionExtensions - Remove ResilientExecutor registration (already registered by Hosting layer) - Update all references to ModelUnavailableException to use new Abstractions namespace Orchestration now depends only on: Core.Domain, Core.Application, and Abstractions. Infrastructure resilience implementations are wired in the Hosting composition root. Co-authored-by: IanFrelinger <IanFrelinger@users.noreply.github.com> * fix(arch): Relocate ModelUnavailableException to Core.Application.Execution.Ports Per Project Manager decision: ModelUnavailableException is an execution-domain exception and belongs in Application ports, not Abstractions. Changes: - Move ModelUnavailableException: Abstractions.Exceptions → Core.Application.Execution.Ports - Update all usings across Orchestration, Infrastructure, BackgroundAgents, and test assemblies - Aligns with PR #526 convention - Keeps Abstractions free of execution-domain types DIP unchanged: Orchestration already depends on Core.Application. Infrastructure ProjectReference still removed (P1.1 intact). Co-authored-by: IanFrelinger <IanFrelinger@users.noreply.github.com> * Fix compile errors after master sync - Add missing Microsoft.Extensions.Configuration.Binder using directive in ConfigurationValidator - Remove duplicate using directive in ProviderFactory Fixes CS1061: IConfiguration.GetValue extension method resolution Fixes CS0105: Duplicate using directive error Co-authored-by: IanFrelinger <IanFrelinger@users.noreply.github.com> * Add Microsoft.Extensions.Configuration.Binder package reference Previous commit added the using directive but missed the actual package. GetValue<T>() extension method requires the Binder package. Fixes CS0234: The type or namespace name 'Binder' does not exist Co-authored-by: IanFrelinger <IanFrelinger@users.noreply.github.com> * Remove invalid using directive for Configuration.Binder namespace CS0234: Namespace Microsoft.Extensions.Configuration.Binder does not exist. GetValue<T>() extension is in Microsoft.Extensions.Configuration namespace, provided by the Configuration.Binder package (already referenced). Keeps PackageReference Microsoft.Extensions.Configuration.Binder in csproj. Co-authored-by: IanFrelinger <IanFrelinger@users.noreply.github.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: IanFrelinger <IanFrelinger@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Architecture Follow-up: BackgroundAgents DIP Phase 1 (P1.2 Remainder)
Summary
Extracts
IProviderFactoryandCertificationRecordMapperfrom Infrastructure to Application layer, advancing the BackgroundAgents Dependency Inversion Principle (DIP) refactoring started in PR #525.Architecture Guardian P1.2: This PR moves BackgroundAgents closer to depending only on Application ports, reducing coupling to Infrastructure concrete implementations.
Changes
✅ Extracted to Application Layer
IProviderFactory→Ashlar.Core.Application.Execution.Ports.IProviderFactorySanitizingProviderFactoryandToolCallingAgentModelUnavailableException→Ashlar.Core.Application.Execution.Ports.ModelUnavailableExceptionCertificationRecordMapper→Ashlar.Core.Application.Certification.CertificationRecordMapperSelfProducedBrickCertificationPolicy🔧 Updated BackgroundAgents
Trust/SanitizingProviderFactory.cs: Now imports fromApplication.Execution.PortsAgents/ToolCallingAgent.cs: Now imports fromApplication.Execution.PortsSecurity/SelfProducedBrickCertificationPolicy.cs: Now imports fromApplication.CertificationInfrastructure ProjectReference remains in
Ashlar.BackgroundAgents.csprojfor these documented reasons:DI/Hosting Composition (
ServiceCollectionExtensions.cs):LiteDbPatternStore,ResilientExecutor, etc.)Ashlar.Hosting.BackgroundAgentsprojectInfrastructure Glue Services (
ObservationPipelineService.cs):PatternDetector,FileSystemEventSource,ProcessEventSourceComplex Infrastructure Components (
AutonomyLoopService.cs):AutonomousIterationHarness(500+ line certification/hot-swap logic)IAutonomousIterationHarnessinterface to ApplicationSee
INFRASTRUCTURE_DEPENDENCY_ANALYSIS.mdfor full analysis and future extraction plan.Before/After Dependency Graph
Before (Master)
After (This PR)
Dependency Reduction
Testing
Constraints Met
✅ Do NOT weaken cert-gate, layer-boundary, dependency-boundary, or perf-gate
✅ Do NOT touch LiveExtender / perf-gate CI
✅ Do NOT touch sealed adapters / Tools cycle / #521–#525 branches
✅ Keep Forge isolated in BackgroundAgents
✅ Ship largest clean slice if full removal too large
Future Work (Separate PRs)
IAutonomousIterationHarness→ Application.Autonomy.PortsAshlar.Hosting.BackgroundAgentsfor DI compositionRelated