Skip to content

refactor(resilience): make IBreakerRegistry injectable (WS4.2 PR0)#373

Merged
RicherTunes merged 9 commits intomainfrom
feat/breaker-registry-seam
Jan 17, 2026
Merged

refactor(resilience): make IBreakerRegistry injectable (WS4.2 PR0)#373
RicherTunes merged 9 commits intomainfrom
feat/breaker-registry-seam

Conversation

@RicherTunes
Copy link
Owner

Rebased PR0 seam onto main after merging characterization tests. Introduces injectable \IBreakerRegistry\ wiring; no behavior changes, WS4.1 characterization suite remains unchanged.

Create DI seam for IBreakerRegistry to enable WS4.2 Common migration:

- Add optional IBreakerRegistry ctor param to BrainarrOrchestrator
  (defaults to new BreakerRegistry() for backwards compatibility)
- Register IBreakerRegistry in BrainarrOrchestratorFactory DI
- Pass registry to orchestrator via DI instead of static Lazy<>
- Add BreakerRegistryInjectionTests proving DI wiring works

This is a no-behavior-change refactor. WS4.1 characterization tests
pass unchanged, confirming the seam is safe.

WS4.2 PR sequence:
- PR0 (this): seam
- PR1: AdvancedCircuitBreaker in Common
- PR2: CommonBreakerRegistry adapter in Brainarr
- PR3: Delete old breaker implementation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
RicherTunes and others added 8 commits January 16, 2026 18:54
Extract PassThroughCircuitBreaker into shared helper to consolidate
duplicate implementations across test files. Fix IBreakerRegistry
injection in BrainarrOrchestratorEndToEndLiteTests which was missing
the breakerRegistry parameter (causing Release build test failures).

- Add Brainarr.Tests/Helpers/PassThroughBreakerRegistry.cs with:
  - PassThroughCircuitBreaker: no-op circuit breaker for tests
  - PassThroughBreakerRegistry.CreateMock(): factory for mock registry
- Update 4 test files to use the shared helper
- Remove ~160 lines of duplicate PassThroughCircuitBreaker code

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Complete the debt payoff by ensuring all 19 BrainarrOrchestrator
direct-constructor call sites pass breakerRegistry:. This prevents
Release mode CI failures where the #if DEBUG fallback doesn't apply.

Updated 12 test files to:
- Add `using Brainarr.Tests.Helpers;` where missing
- Pass `breakerRegistry: PassThroughBreakerRegistry.CreateMock().Object`

Verified: grep finds 19 `breakerRegistry:` matches across 16 files,
matching all 19 `new BrainarrOrchestrator(` call sites.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Root cause: Pre-test cleanup was deleting bin/obj directories, forcing
dotnet test to rebuild. This caused parallel MSBuild file locking on
Common submodule's .deps.json files.

Fix:
- Remove `rm -rf Brainarr.Tests/bin Brainarr.Tests/obj` from pre-test cleanup
- Add `--no-build` to all dotnet test commands (Linux unit, Linux provider-contract, Windows unit)

This ensures tests use pre-built binaries from the Build step, eliminating
rebuild-induced file contention.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The backslash followed by trailing spaces on line 136 caused bash to
pass extra arguments to MSBuild, triggering MSB1008 "Only one project
can be specified" error.

Also cleaned up excessive spacing in other test commands.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@RicherTunes RicherTunes merged commit 3d62239 into main Jan 17, 2026
24 of 25 checks passed
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.

1 participant