Conversation
…ctions
handleUpdateConfig decoded the request body into a zero config.Config, so any
top-level key missing from the request (e.g. no "debrids") was silently
replaced with its zero value and Save erased the section from disk. A caller
that posted only the field it wanted to change destroyed every other
configured section, including debrid providers and their api keys.
The handler now merges on missing: Config.PreserveMissingSections copies every
top-level section whose JSON key is absent from the posted body out of the live
config. Presence still wins wholesale, so an explicitly posted empty value
("debrids": []) clears exactly as before, and full-config POSTs (the web UI
path) are byte-identical in behavior.
Tests cover partial / explicit-empty / full POSTs at both the merge layer and
the HTTP handler (asserting on-disk state).
Davixk
marked this pull request as draft
July 26, 2026 14:07
Author
|
Marking this draft — the fix is right but the verb is wrong, and I'd rather correct that than have you review it as-is. Making |
Davixk
added a commit
to Davixk/decypharr
that referenced
this pull request
Jul 26, 2026
Two corrections. The "deliberately fork-only" section was mostly me deciding on the maintainer's behalf what they would not want. That is not our call. The repair model, the deletion cap and the read-deadline are queued to be offered; only genuinely incident-specific tooling stays fork-only. Adds a branch map, since "which branch is real" was ambiguous enough to have already cost a wrong analysis: integration/v2 is canonical and is what CI builds from, fixup/* are the handles upstream PRs get cherry- picked from, and a fix/* branch backing an open PR is based on upstream/beta and must never be merged back. Also records that sirrobot01#363 proposes the wrong shape — making POST merge is PATCH semantics under the wrong verb — and is superseded by a proper PATCH/PUT split. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Davixk
force-pushed
the
fix/config-api-partial-post-preserves-sections
branch
from
July 27, 2026 00:23
8a7f489 to
af29c72
Compare
This branch has not been deployed
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.
What breaks: a
POST /api/configbody that omits a top-level section deletes that section from disk. Posting only{"log_level":"debug"}wipesdebrids— configured providers and their api keys included — along with every other key the caller didn't mention.Why:
handleUpdateConfiginpkg/server/api.godecodes the body into a zeroconfig.Config, so any absent top-level key ends up as its zero value, and the subsequentnewConfig.Save()writes that zero value out.The fix: merge on missing.
Config.PreserveMissingSectionscopies every top-level section whose JSON key is absent from the posted body out of the live config before validation and save. Presence still wins wholesale, so an explicitly posted empty value ("debrids": []) clears exactly as before, and full-config POSTs (the web UI path) decode identically with and without the merge — there's a test asserting that.Evidence: running in production on a ~47,000-entry library. Tests cover partial / explicit-empty / full POSTs at both the merge layer and the HTTP handler (asserting on-disk state); the partial-POST tests fail on
betawithout the change.Split out of a second config-API fix (explicit
download_uncached: falsenot persisting) so each is reviewable on its own; the two are independent.