mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #3049] [Issue]: Character group avatar can never be set — the PATCH route's Zod schema strips avatarPath, making the storage write branch dead #1618
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#1618
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 @kolacheee on GitHub (Jun 29, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3049
Originally assigned to: @SpicyMarinara on GitHub.
What's wrong
characterGroupshas anavatarPathcolumn and the UI renders a group avatar from it, but a character group's avatar can never actually be set through any reachable path, so it always falls back to the placeholder. The only write path, PATCH /characters/groups/:id, validates the body withupdateGroupSchema.parse(...).updateGroupSchema = createGroupSchema.partial(), andcreateGroupSchemaonly defines name/description/characterIds and is not.passthrough(), so Zod silently stripsavatarPathout of the parsed input before it ever reaches storage. The storage layer'savatarPathwrite branch is therefore dead code, and the displayed group-avatar feature is effectively non-functional.How to reproduce (try it yourself)
{ avatarPath: "/api/avatars/file/x.png" }.You'll see:
avatarPathis still null; the value was dropped byupdateGroupSchema.parsebefore reaching storage, and the group avatar renders the first-letter placeholder.Expected: the avatar persists and the group picker shows the stored image.
Where it is
packages/server/src/routes/characters.routes.ts:1154-1157— PATCH handler:const input = updateGroupSchema.parse(req.body); return storage.updateGroup(req.params.id, input);.packages/shared/src/schemas/character.schema.ts:106-112—createGroupSchema(no avatarPath, not passthrough) andupdateGroupSchema = createGroupSchema.partial().packages/server/src/services/storage/characters.storage.ts:638— the unreachable...(updates.avatarPath !== undefined && { avatarPath: updates.avatarPath })branch.packages/server/src/db/schema/characters.ts:96(avatarPath: text("avatar_path"), nullable).packages/client/src/components/chat/ChatSettingsDrawer.tsx:3894-3905.What's happening
Zod's default object parsing discards unknown keys, and
updateGroupSchemainheritscreateGroupSchema, which omitsavatarPathand isn't passthrough. SoavatarPathnever survives validation to reachupdateGroup. The storage and DB column support it; only the route contract doesn't. There is no group-avatar upload route either (the backup/marinara importers only touch prompt groups).Suggested fix
Add
avatarPathtocreateGroupSchema(whichupdateGroupSchemainherits) as a nullable+optional string so the avatar can be both set AND cleared:This lets
avatarPathsurvive validation in the PATCH handler and reach the existing storage write branch (which writes the nullable column), so the UI shows the stored avatar..nullable().optional()(vs a plain.string().optional()) is preferred because the column is nullable and the storage guard already passes null through to.set({ avatarPath: null }), so a client can clear a previously-set group avatar back to the placeholder. Regression notes: the only consumers are POST /groups (which destructures only name/description/characterIds, ignoring the extra field harmlessly) and PATCH /groups/:id (which guards every field with!== undefined, so name-only/description-only/characterIds-only updates are unchanged). Adding an optional field is backward-compatible; the unrelated prompt-presetcreateGroup/updateGroupuse a different schema and are untouched.AI-investigated against v2.0.6; cited lines read and confirmed. Please verify before fixing.
@SpicyMarinara commented on GitHub (Jun 29, 2026):
Claiming this for the current staging sweep in draft PR #3053 (branch
codex/issue-sweep-3033-3052).@SpicyMarinara commented on GitHub (Jun 29, 2026):
Fixed in PR #3053 on branch
codex/issue-sweep-3033-3052(commitbfb1bc76). Closing this issue as addressed; the PR remains open for staging review/merge.