fix(sabnzbd): fail closed when an action response carries no status flag - #97
Open
ndandan wants to merge 2 commits into
Open
fix(sabnzbd): fail closed when an action response carries no status flag#97ndandan wants to merge 2 commits into
ndandan wants to merge 2 commits into
Conversation
action() defaulted an absent `status` key to true, so any unrecognised 200 (proxy, different SABnzbd version) was reported as a successful pause/resume/delete/speed-limit/add. Pure actions always carry status; its absence is now treated as failure and logged, matching NzbgetClient's existing `=== true` strictness. call() promoted private -> protected (minimal seam for the test double). SabnzbdClient already holds a LoggerInterface, so the anomaly is logged via the existing $this->logger rather than adding a new dependency. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <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.
SabnzbdClient::action()(pause / resume / delete / speed-limit / add) determined success withreturn ($data['status'] ?? true) !== false;. Because an absentstatuskey defaulted totrue, any unrecognised HTTP 200 — from a reverse proxy, an auth portal, or a different SABnzbd version — was reported to the user as a successful action even though nothing happened.Pure SABnzbd actions always carry a
statusflag. Its absence is now treated as failure and logged (via the client's existingLoggerInterface), matchingNzbgetClient's existing=== truestrictness.call()was promotedprivate→protectedas a minimal seam for the test double.Covered by a new
SabnzbdActionResultTest(status true/false/absent).