mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #2993] [Issue]: A base sprite file (e.g. sad.png) is permanently unreachable when 2+ underscore variants exist; resolveExpression random-picks a variant #1566
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#1566
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/2993
Originally assigned to: @SpicyMarinara on GitHub.
What's wrong
When a character's sprite folder has a bare expression file plus two or more underscore variants sharing its name (e.g. sad.png, sad_01.png, sad_02.png), the bare file becomes impossible to ever display. The model is only ever shown the group key
sad, and when it pickssadthe resolver runs the prefix-variant random pick BEFORE the exact-match check, so it returns a random variant (sad_01 or sad_02) and never the bare sad.png. The chosen expression also flickers between variants on every retry/swipe.How to reproduce (try it yourself)
sad.You'll see: the displayed sprite is sad_01 or sad_02 (random), never sad.png; the variant changes randomly on each swipe.
Expected: the bare sad.png is reachable, and an explicit exact match is honored.
Where it is
packages/server/src/routes/generate/expression-agent-utils.ts:196-219(resolveExpression; the prefix branch at 202-204 runs before the exact-match check at 206),getExpressionPrefixVariantlines 152-156,pickRandomExpressionlines 131-134, called fromvalidateSpriteExpressionEntriesat line 352. Interacts withpackages/server/src/services/game/sprite.service.ts:55-86(buildSpriteExpressionChoicescollapses variants to one key shown to the model).What's happening
resolveExpressionruns the "prefix variant → random pick" branch before the exact-match branch.getExpressionPrefixVariantonly matches entries of the form${group}_..., so a bare file whose name equals the group key is never a prefix candidate and is shadowed by its own variants whenever 2+ variants exist (prefixMatches.length > 1).buildSpriteExpressionChoicescompounds this by collapsing the variants under the same key already emitted by the bare file, so the model is never offered a way to distinguish them.Suggested fix
Let the bare base file join the group's random pool, and only random-pick when the group is actually collapsed (2+ underscore variants). Replace the prefix/exact block (lines 200-207):
The remaining normalized-exact and containment fallback lines (209-218) are unchanged. Regression avoided: the naive "just move exact-match ahead of the prefix block" suggestion would make the bare sad.png win EVERY time and render sad_01/sad_02 permanently unreachable — the inverse bug, and a violation of the documented "randomly display a concrete matching sprite" group contract. Gating the random pool on the existing
prefixMatches.length > 1condition and adding the bare file only then leaves the single-variant case (happy, happy_01 — not collapsed, listed separately to the model) deterministic as today. All validation entry points funnel through this one function, so the single-site fix covers batched, individual, retry, and fallback paths.AI-investigated against v2.0.6; cited lines read and confirmed. Please verify before fixing.
@SpicyMarinara commented on GitHub (Jun 29, 2026):
Fixed in merged staging PR #3004.