[GH-ISSUE #1782] [Issue]: Sprites parity regressions in selected owners, expression validation, and persona export #865

Closed
opened 2026-10-21 05:22:34 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @Xelvanis on GitHub (Jun 1, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1782

Originally assigned to: @SpicyMarinara on GitHub.

Summary

Static parity audit found three sprites regressions on the refactor branch:

  1. Chat settings now store selected sprite owners as typed owner keys (character:<id> / persona:<id>), but generation still filters by raw character/persona IDs. Selected sprites can be dropped before the Expression Engine gets <available_sprites> context.
  2. Expression Engine sprite results are persisted without the legacy validation/correction pass, so unknown owners or invalid expression names can be saved into message extra.
  3. Current persona sprites are saved under the namespaced persona sprite directory, but persona export/import helpers still use the legacy sprites/<id> path. Persona exports can omit saved persona sprites, and imports can restore them to the wrong namespace.

Expected behavior

  • Sprite owners selected in chat settings should be available to generation for both characters and the active persona.
  • Expression Engine results should be validated against available sprite owners and expressions before persistence. Legacy behavior corrected close matches, resolved prefix/group choices, and dropped unknown owners or nonexistent expressions.
  • Persona export/import should include and restore sprites saved through the current Persona Sprites UI.

Actual behavior

  • Refactor UI writes typed sprite owner keys, while loadAgentAvailableSprites compares the selected set against raw character.id and raw personaId.
  • spriteExpressionsFromAgentResults copies returned characterId, characterName, and expression fields directly into spriteExpressions without checking them against available sprites.
  • Persona sprite CRUD uses sprites/personas/<id>, but persona export reads only sprites/<id> through the generic sprite export helper. Marinara import restore also writes embedded persona sprites to sprites/<id>.

Steps to reproduce

  1. Upload sprites for a character or persona from the current catalog Sprites tab.
  2. Open a roleplay or game chat, enable Expression Engine Sprites in chat settings, and select that character or persona.
  3. Inspect chat metadata: selected sprites are stored as owner keys such as character:<id> or persona:<id>.
  4. Generate with the Expression Engine enabled.
  5. Inspect generation sprite loading: selected owner keys are compared to raw IDs, so selected owners can be filtered out.
  6. Separately, return or replay an Expression Engine result with an unknown owner or invalid expression. Refactor persists the value without the legacy validation/correction step.
  7. Export a persona that has sprites uploaded through the current Persona Sprites UI. The export helper reads sprites/<id>, while current persona sprites live under sprites/personas/<id>.

Impact area

  • App shell, navigation, startup, or providers
  • Catalog resources
  • Chat mode
  • Roleplay mode
  • Game mode
  • Shared mode UI
  • Runtime systems: generation, world-state, visuals, tracker, or haptics
  • Professor Mari or shell tools
  • React-free engine behavior, contracts, agents, or capability ports
  • Shared API wrapper or remote runtime routing
  • Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime
  • Docs, contributor workflow, or templates

Environment

  • Branch or commit: origin/refactor inspected from review/sprites-parity-audit
  • Run mode: Static code parity audit only; app not launched
  • OS + version: Not relevant to static audit
  • Node + pnpm versions: Not run
  • Rust version, if relevant: Not run
  • Remote Runtime URL configured? Not relevant
  • Provider, model, or integration, if relevant: Expression Engine agent path; no provider call was run

Logs, screenshots, or video

No runtime logs or screenshots. Code evidence:

  • Refactor stores typed owner keys in chat settings: src/features/modes/shared/chat-ui/components/ChatSettingsDrawer.tsx:841, src/features/modes/shared/chat-ui/components/ChatSettingsDrawer.tsx:1118
  • Refactor generation filters selected sprites against raw IDs: src/engine/generation/agent-runner.ts:998, src/engine/generation/agent-runner.ts:1001
  • Refactor persists sprite expressions directly from agent results: src/engine/generation/start-generation.ts:1429
  • Legacy validated/corrected expression results before persistence: packages/server/src/routes/generate/expression-agent-utils.ts:190, packages/server/src/routes/generate.routes.ts:8723
  • Refactor persona sprites are namespaced separately from character sprites: src-tauri/src/commands/storage/sprites.rs:1658
  • Refactor persona export still reads generic sprites/<id>: src-tauri/src/commands/storage/exports.rs:360, src-tauri/src/commands/storage/exports.rs:686
  • Refactor Marinara import restore writes embedded sprites to generic sprites/<id>: src-tauri/src/commands/storage/imports/marinara_assets.rs:44

Regression notes

Legacy used raw IDs consistently for selected sprites in chat settings and generation, so the filter matched the stored metadata. Legacy also ran validateSpriteExpressionEntries before saving spriteExpressions, correcting close matches and dropping invalid entries. The persona sprite namespace changed in refactor, but export/import helpers did not fully follow that new owner-aware path.

Additional context

Suggested repair order:

  1. Normalize selected sprite owner keys in generation so raw legacy IDs and current owner keys both work, then pass owner kind into sprite loading.
  2. Port the legacy expression validation/correction logic into the refactor engine path before persisting spriteExpressions.
  3. Make persona export/import sprite helpers owner-aware, with legacy fallback for older sprites/<id> persona data.

Template check

Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @Xelvanis on GitHub (Jun 1, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1782 Originally assigned to: @SpicyMarinara on GitHub. ## Summary Static parity audit found three sprites regressions on the refactor branch: 1. Chat settings now store selected sprite owners as typed owner keys (`character:<id>` / `persona:<id>`), but generation still filters by raw character/persona IDs. Selected sprites can be dropped before the Expression Engine gets `<available_sprites>` context. 2. Expression Engine sprite results are persisted without the legacy validation/correction pass, so unknown owners or invalid expression names can be saved into message extra. 3. Current persona sprites are saved under the namespaced persona sprite directory, but persona export/import helpers still use the legacy `sprites/<id>` path. Persona exports can omit saved persona sprites, and imports can restore them to the wrong namespace. ## Expected behavior - Sprite owners selected in chat settings should be available to generation for both characters and the active persona. - Expression Engine results should be validated against available sprite owners and expressions before persistence. Legacy behavior corrected close matches, resolved prefix/group choices, and dropped unknown owners or nonexistent expressions. - Persona export/import should include and restore sprites saved through the current Persona Sprites UI. ## Actual behavior - Refactor UI writes typed sprite owner keys, while `loadAgentAvailableSprites` compares the selected set against raw `character.id` and raw `personaId`. - `spriteExpressionsFromAgentResults` copies returned `characterId`, `characterName`, and `expression` fields directly into `spriteExpressions` without checking them against available sprites. - Persona sprite CRUD uses `sprites/personas/<id>`, but persona export reads only `sprites/<id>` through the generic sprite export helper. Marinara import restore also writes embedded persona sprites to `sprites/<id>`. ## Steps to reproduce 1. Upload sprites for a character or persona from the current catalog Sprites tab. 2. Open a roleplay or game chat, enable Expression Engine Sprites in chat settings, and select that character or persona. 3. Inspect chat metadata: selected sprites are stored as owner keys such as `character:<id>` or `persona:<id>`. 4. Generate with the Expression Engine enabled. 5. Inspect generation sprite loading: selected owner keys are compared to raw IDs, so selected owners can be filtered out. 6. Separately, return or replay an Expression Engine result with an unknown owner or invalid expression. Refactor persists the value without the legacy validation/correction step. 7. Export a persona that has sprites uploaded through the current Persona Sprites UI. The export helper reads `sprites/<id>`, while current persona sprites live under `sprites/personas/<id>`. ## Impact area - [ ] App shell, navigation, startup, or providers - [x] Catalog resources - [ ] Chat mode - [x] Roleplay mode - [x] Game mode - [x] Shared mode UI - [x] Runtime systems: generation, world-state, visuals, tracker, or haptics - [ ] Professor Mari or shell tools - [x] React-free engine behavior, contracts, agents, or capability ports - [ ] Shared API wrapper or remote runtime routing - [x] Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime - [ ] Docs, contributor workflow, or templates ## Environment - Branch or commit: `origin/refactor` inspected from `review/sprites-parity-audit` - Run mode: Static code parity audit only; app not launched - OS + version: Not relevant to static audit - Node + pnpm versions: Not run - Rust version, if relevant: Not run - Remote Runtime URL configured? Not relevant - Provider, model, or integration, if relevant: Expression Engine agent path; no provider call was run ## Logs, screenshots, or video No runtime logs or screenshots. Code evidence: - Refactor stores typed owner keys in chat settings: `src/features/modes/shared/chat-ui/components/ChatSettingsDrawer.tsx:841`, `src/features/modes/shared/chat-ui/components/ChatSettingsDrawer.tsx:1118` - Refactor generation filters selected sprites against raw IDs: `src/engine/generation/agent-runner.ts:998`, `src/engine/generation/agent-runner.ts:1001` - Refactor persists sprite expressions directly from agent results: `src/engine/generation/start-generation.ts:1429` - Legacy validated/corrected expression results before persistence: `packages/server/src/routes/generate/expression-agent-utils.ts:190`, `packages/server/src/routes/generate.routes.ts:8723` - Refactor persona sprites are namespaced separately from character sprites: `src-tauri/src/commands/storage/sprites.rs:1658` - Refactor persona export still reads generic `sprites/<id>`: `src-tauri/src/commands/storage/exports.rs:360`, `src-tauri/src/commands/storage/exports.rs:686` - Refactor Marinara import restore writes embedded sprites to generic `sprites/<id>`: `src-tauri/src/commands/storage/imports/marinara_assets.rs:44` ## Regression notes Legacy used raw IDs consistently for selected sprites in chat settings and generation, so the filter matched the stored metadata. Legacy also ran `validateSpriteExpressionEntries` before saving `spriteExpressions`, correcting close matches and dropping invalid entries. The persona sprite namespace changed in refactor, but export/import helpers did not fully follow that new owner-aware path. ## Additional context Suggested repair order: 1. Normalize selected sprite owner keys in generation so raw legacy IDs and current owner keys both work, then pass owner kind into sprite loading. 2. Port the legacy expression validation/correction logic into the refactor engine path before persisting `spriteExpressions`. 3. Make persona export/import sprite helpers owner-aware, with legacy fallback for older `sprites/<id>` persona data. ## Template check Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:22:34 +07:00
Author
Owner

@SpicyMarinara commented on GitHub (Jun 1, 2026):

Aaa.

<!-- gh-comment-id:4591275325 --> @SpicyMarinara commented on GitHub (Jun 1, 2026): Aaa.
Author
Owner

@SpicyMarinara commented on GitHub (Jun 1, 2026):

Fixed on refactor in d7770ac9.

What changed:

  • Expression Engine sprite loading now accepts both legacy raw IDs and current owner keys (character: / persona:), and calls sprite storage with the explicit owner type.
  • Runtime exposes available sprites from the agent context so generated sprite results can be validated before persistence.
  • Ported sprite expression validation/correction into the refactor engine path: unknown owners and nonexistent expressions are dropped, close matches/prefix choices are resolved to real expression filenames.
  • Persona export now reads namespaced sprites/personas/ sprites with a legacy sprites/ fallback.
  • Marinara persona import restores embedded sprites into the namespaced persona sprite directory and rolls that directory back on failure.

Verification:

  • pnpm typecheck
  • pnpm check:architecture
  • cargo check --manifest-path src-tauri/Cargo.toml
  • git diff --check HEAD~1..HEAD
<!-- gh-comment-id:4591937193 --> @SpicyMarinara commented on GitHub (Jun 1, 2026): Fixed on refactor in d7770ac9. What changed: - Expression Engine sprite loading now accepts both legacy raw IDs and current owner keys (character:<id> / persona:<id>), and calls sprite storage with the explicit owner type. - Runtime exposes available sprites from the agent context so generated sprite results can be validated before persistence. - Ported sprite expression validation/correction into the refactor engine path: unknown owners and nonexistent expressions are dropped, close matches/prefix choices are resolved to real expression filenames. - Persona export now reads namespaced sprites/personas/<id> sprites with a legacy sprites/<id> fallback. - Marinara persona import restores embedded sprites into the namespaced persona sprite directory and rolls that directory back on failure. Verification: - pnpm typecheck - pnpm check:architecture - cargo check --manifest-path src-tauri/Cargo.toml - git diff --check HEAD~1..HEAD
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#865
No description provided.