refactor(arr): extract AbstractArrClient (F2a, dedup, no behavior change)#16
Merged
Conversation
…ts (F2a) Pull the near-identical constructor, buildHeaders(), GET/POST/PUT/DELETE cURL methods, and per-status-code error mapping out of RadarrClient/SonarrClient/ ProwlarrClient/BazarrClient into a shared abstract AbstractArrClient. Subclasses keep only endpoint-specific methods plus a protected vendorName() used in error messages. No behavior change: still blocking cURL, identical public class names/methods, identical thrown exceptions and messages. Properties are protected (not private) so the existing reflection-based constructor tests pass unchanged. This is the structural enabler for F2b's injected async transport — the single private request() in the base is the one place F2b will swap. Findings: CQ2, CQ5 (enabler for B1). Internal refactor; no consumer impact. Gate: composer test (349 OK, 2838 assertions), stan (L9 no baseline, OK), cs (PSR-12 clean), psalm (no errors). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #16 +/- ##
=============================================
+ Coverage 58.81% 75.38% +16.57%
+ Complexity 424 345 -79
=============================================
Files 38 39 +1
Lines 1265 967 -298
=============================================
- Hits 744 729 -15
+ Misses 521 238 -283
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| Comprehensibility | 1 minor |
| CodeStyle | 1 minor |
| Complexity | 4 medium |
🟢 Metrics -75 complexity · -20 duplication
Metric Results Complexity -75 Duplication -20
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
This was referenced Jun 28, 2026
detain
added a commit
that referenced
this pull request
Jun 28, 2026
Bump Version::VERSION to 0.11.0 and promote the [Unreleased] CHANGELOG section to [0.11.0] - 2026-06-28, rolling up the four changes merged since v0.10.1: - #14 S1: harden RelayHttpRequest with path/method gate + forbidden-header helpers (isForbiddenHeader/withoutForbiddenHeaders/assertSafe) - #15 JwtClaims: strict-aud variant (fromPayloadStrict) + verification/ round-trip docs (S4+B4) - #16 refactor(arr): extract AbstractArrClient to dedup the four *arr clients (F2a) - #17 feat(arr): inject async HTTP transport via ArrTransportInterface (F2b/B1/P1) composer.json carries no hardcoded version field (tags drive version), so it is left unchanged. The git tag is applied by the coordinator after merge. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.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 free
to 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.
Step F2a — Extract
AbstractArrClientFindings: CQ2, CQ5 (enabler for B1/F2b). From
findings/plan_phlix-shared.mdPhase 2.What
The four near-identical *arr clients (
RadarrClient,SonarrClient,ProwlarrClient,BazarrClient) now extend a newabstract class AbstractArrClientthat owns:baseUrl/apiKey/logger/timeout),buildHeaders(),request()),Each subclass keeps only its endpoint-specific methods plus
protected function vendorName(): stringused in error messages ("Radarr API error: HTTP 500", etc.).No behavior change
request()in the base is now the one place it changes.Visibility note
The shared
baseUrl/apiKey/timeout/loggerproperties areprotected(notprivate) because the existing constructor tests reflect on the concrete subclass viaReflectionClass($client)->getProperty('baseUrl'), which does not report a parent's private properties.protectedkeeps reflection working with zero test edits.How verified (actual output)
composer test→ OK (349 tests, 2838 assertions) — same count, no test files changedcomposer stan→ [OK] No errors (PHPStan L9, no baseline)composer cs→ clean (PSR-12), exit 0composer psalm→ No errors found!Consumer impact
None — internal refactor, public surface preserved. No version bump;
CHANGELOG [Unreleased] ### Changednote added.Coupling
This is the enabler for F2b (async transport via injected
ArrTransportInterface). Do not merge ahead of coordination if F2b is staged to build on this branch.🤖 Generated with Claude Code