fix: preserve existing AniList fields when optional flags are omitted#38
Open
aaravmaloo wants to merge 6 commits intoCosmicPredator:mainfrom
Open
fix: preserve existing AniList fields when optional flags are omitted#38aaravmaloo wants to merge 6 commits intoCosmicPredator:mainfrom
aaravmaloo wants to merge 6 commits intoCosmicPredator:mainfrom
Conversation
… user didnt pass --status, "none" got mapped to CURRENT, so update requests unintentionally sent a status change. concerns CosmicPredator#37
…tion(params)`, params) instead of using a static mutation constant. concerns CosmicPredator#37
`TestMediaEntryUpdateMutation_OmitsUnsetOptionalFields` `TestMediaEntryUpdateMutation_IncludesProvidedDates` (these mutations) concerns CosmicPredator#37
…der function `mediaEntryUpdateMutation(params map[string]any)` string. concerns CosmicPredator#37 (note: also added `hasallkeys` helper)
concerns the issue CosmicPredator#37
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.
Description
Fixes a data-loss bug in
chibi updatewhere omitted fields (likeDate started,Notes, and potentially others) were being cleared on AniList.Root cause:
startedAt,completedAt,notes,status) even when those flags were not provided by the user.What changed:
statusis now sent only when--statusis explicitly provided.notesis now sent only when non-empty notes are explicitly provided.--statusdefault changed from"none"to""so omitted status is truly omitted.Fixes #37
Type of change
Tested Environments
Checklist
Screenshots (if applicable)
N/A (CLI/internal mutation behavior change).
Additional context
Validated with:
gofmt -w cmd/cmd_update.go internal/api/anilist.go internal/api/mutations.go internal/viewmodel/media_update_handler.go internal/api/mutations_test.gogo test ./...Key behavioral guarantee after this PR:
chibi update <id> --progress <n>updates progress only, without wiping unrelated AniList entry fields.