fix(author): ApplyChanges wipes stored paths when an update omits them - #97
Open
Ch3fUlrich wants to merge 1 commit into
Open
fix(author): ApplyChanges wipes stored paths when an update omits them#97Ch3fUlrich wants to merge 1 commit into
Ch3fUlrich wants to merge 1 commit into
Conversation
…its them
Author.ApplyChanges assigned Path, AudiobookRootFolderPath and EbookRootFolderPath
unconditionally, so any caller passing an Author without them cleared the stored
values. That is inconsistent with the fields immediately around them, which are all
guarded -- the quality profiles, the metadata profiles and the tags each check before
assigning, with the existing comment noting that "Quality profiles from metadata
sources are always null/0".
Paths reach the same method from the same two directions:
* the API, where a PUT may legitimately omit fields it is not changing, and
* metadata refresh, where the incoming Author is built from remote metadata and
carries no local paths at all.
Both wiped the stored path. Guarding the three assignments the same way the
neighbouring fields are guarded fixes it.
UseDbFieldsFrom is deliberately left alone: it is a full copy from the database, so
assigning unconditionally there is correct.
Tests: AuthorApplyChangesPathPreservationFixture covers preservation when the paths
are omitted, normal overwrite when they are supplied, and independent preservation
when only one of the three changes. Verified red/green -- 2 of the 3 fail without the
production change. Full suite 2855 passed / 0 failed (2852 before, +3 new).
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.
Fixes #88.
What changed and why
Author.ApplyChangesassignedPath,AudiobookRootFolderPathandEbookRootFolderPathunconditionally, so any caller passing anAuthorwithout them cleared the stored values.That is inconsistent with the fields immediately around them, which are all guarded — the quality profiles, the metadata profiles and the tags each check before assigning. The existing comment there already explains why: "Quality profiles from metadata sources are always null/0".
Paths reach the same method from the same two directions:
PUT /api/v1/author/{id}may legitimately omit fields it is not changing, andAuthoris built from remote metadata and carries no local paths at all.Both wiped the stored path. This guards the three assignments the same way the neighbouring fields are guarded.
UseDbFieldsFromis deliberately left alone — it is a full copy from the database, so assigning unconditionally is correct there.Breaking changes
None. The only behaviour change is that an omitted (null) path no longer clears the stored one; supplying a path still overwrites it exactly as before.
Testing performed
AuthorApplyChangesPathPreservationFixturecovers three cases: preservation when paths are omitted, normal overwrite when they are supplied, and independent preservation when only one of the three changes.Verified red/green — 2 of the 3 tests fail without the production change:
Full suite, no regressions:
Built and tested on .NET SDK 10.0.400, rebased on
develop.