mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #3858] [Issue]: Partial character PATCH silently overwrites nested extensions and lorebook data #2085
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#2085
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Xelvanis on GitHub (Jul 20, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3858
Originally assigned to: @SpicyMarinara on GitHub.
Summary
A partial
PATCH /api/characters/:idcan silently erase nested character data. The update schema is only shallow-partial: whenextensionsorcharacter_bookis supplied incompletely, their nested schemas materialize defaults, and the route/storage path persists those generated values as replacements.Expected behavior
A PATCH request should either:
It should not silently turn omitted fields into defaults and persist them over existing data.
Actual behavior
updateCharacterSchemausescharacterDataSchema.partial(), which makes only the immediatedataproperties optional. The nested schemas retain their defaults.For example, this request:
is parsed into an
extensionsobject that also contains defaulttalkativeness,world,depth_prompt,backstory, andappearancevalues. The general character PATCH route passesmergeExtensions: false, so storage replaces the existing extensions object and drops omitted passthrough or third-party fields.Similarly:
is accepted and default-filled with
entries: [], empty extensions, and default scanning settings. Storage's top-level merge then replaces the existing character book, including its entries.Steps to reproduce
character_bookwith entries.PATCH /api/characters/:idwith{ "data": { "extensions": { "fav": true } } }.character_book.nameand observe that omitted book fields, includingentries, are replaced by defaults.Environment
Logs, screenshots, or video
A direct schema parse produced:
Relevant code:
packages/shared/src/schemas/character.schema.ts: shallowcharacterDataSchema.partial()plus nested defaults.packages/server/src/routes/characters.routes.ts: the general PATCH route setsmergeExtensions: false.packages/server/src/services/storage/characters.storage.ts: shallow top-level merge and optional extension replacement.Additional context
The built-in character editor generally sends the complete character, so its normal save path is less exposed. Version snapshots also usually provide recovery, although the route accepts
skipVersionSnapshot: truefrom callers.This needs an explicit compatibility decision. A true partial-update design requires both a deep-partial update schema and nested merge semantics; changing only the schema is insufficient. If the editor needs full replacement semantics so deleted keys stay deleted, consider a separate explicit replacement operation (for example PUT or a dedicated mode) while keeping PATCH merge-based. The alternative is to require and validate complete nested replacements instead of accepting partial objects.
Template check
Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:
@SpicyMarinara commented on GitHub (Jul 20, 2026):
SpicyMarinara is taking this issue in the current assigned-issue sweep. I’m tracing the reported boundary, adding focused regression coverage, and will link the draft PR here as soon as the proof commit is pushed.
@SpicyMarinara commented on GitHub (Jul 20, 2026):
Implementation is now tracked in draft PR #3862 against
staging.@SpicyMarinara commented on GitHub (Jul 20, 2026):
Addressed in #3862 and merged to staging as
ca6d0c15be.